Skip to content

Commit d703f57

Browse files
[SYCL] Transition from ONEAPI/INTEL to ext::oneapi/intel namespaces (#4014)
To be conformant with SYCL 2020, this patch deprecates `ONEAPI` and `INTEL` namespaces without breaking changes in ABI, and introduces new `ext::oneapi` and `ext::intel` namespaces. This patch does: 1. **RT part:** deprecate `ONEAPI` and `INTEL` namespaces, introduce the replacement: `ext::oneapi` and `ext::intel` namespaces. Copy include/CL/sycl/ONEAPI to sycl/ext/oneapi and include/CL/sycl/INTEL to sycl/ext/intel as is. Add deprecation warnings to include/CL/sycl/ONEAPI and include/CL/sycl/INTEL headers. 2. **FE and Tools part:** replace `ONEAPI`/`INTEL` namespaces with `ext::oneapi/intel`, update mangling in tests. Modify `Util::isSycl...` funcs to accept both deprecated and new namespaces for compatibility reasons.
1 parent 6cf48fa commit d703f57

File tree

152 files changed

+7976
-6993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+7976
-6993
lines changed

.github/CODEOWNERS

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ sycl/doc/extensions/ @intel/dpcpp-specification-reviewers
2828

2929
# Sub-groups
3030
sycl/include/CL/sycl/detail/spirv.hpp @Pennycook @AlexeySachkov
31-
sycl/include/CL/sycl/intel/group_algorithm.hpp @Pennycook @AlexeySachkov
32-
sycl/include/CL/sycl/intel/sub_group.hpp @Pennycook @AlexeySachkov
33-
sycl/include/CL/sycl/intel/sub_group_host.hpp @Pennycook @AlexeySachkov
31+
sycl/include/sycl/ext/intel/group_algorithm.hpp @Pennycook @AlexeySachkov
32+
sycl/include/sycl/ext/intel/sub_group.hpp @Pennycook @AlexeySachkov
33+
sycl/include/sycl/ext/intel/sub_group_host.hpp @Pennycook @AlexeySachkov
3434

3535
# PI API
3636
sycl/include/CL/sycl/detail/pi.def @smaslov-intel
@@ -53,17 +53,17 @@ sycl/source/detail/stream_impl.cpp @againull
5353
sycl/source/stream.cpp @againull
5454

5555
# FPGA extensions
56-
sycl/include/CL/sycl/intel/fpga_device_selector.hpp @MrSidims
57-
sycl/include/CL/sycl/intel/fpga_extensions.hpp @MrSidims
58-
sycl/include/CL/sycl/intel/fpga_reg.hpp @MrSidims
59-
sycl/include/CL/sycl/intel/pipes.hpp @MrSidims
56+
sycl/include/sycl/ext/intel/fpga_device_selector.hpp @MrSidims
57+
sycl/include/sycl/ext/intel/fpga_extensions.hpp @MrSidims
58+
sycl/include/sycl/ext/intel/fpga_reg.hpp @MrSidims
59+
sycl/include/sycl/ext/intel/pipes.hpp @MrSidims
6060
sycl/include/CL/sycl/pipes.hpp @MrSidims
6161

6262
# Reduction extension
63-
sycl/include/CL/sycl/intel/reduction.hpp @v-klochkov
63+
sycl/include/sycl/ext/intel/reduction.hpp @v-klochkov
6464

6565
# Function pointers
66-
sycl/include/CL/sycl/intel/function_pointer.hpp @AlexeySachkov
66+
sycl/include/sycl/ext/intel/function_pointer.hpp @AlexeySachkov
6767
sycl/source/function_pointer.cpp @AlexeySachkov
6868

6969
# Half Type

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5121,14 +5121,23 @@ bool Util::isSyclHalfType(QualType Ty) {
51215121
}
51225122

51235123
bool Util::isSyclSpecConstantType(QualType Ty) {
5124-
std::array<DeclContextDesc, 5> Scopes = {
5124+
std::array<DeclContextDesc, 6> Scopes = {
5125+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
5126+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
5127+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
5128+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
5129+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "experimental"),
5130+
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
5131+
"spec_constant")};
5132+
std::array<DeclContextDesc, 5> ScopesDeprecated = {
51255133
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
51265134
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
51275135
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ONEAPI"),
51285136
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "experimental"),
51295137
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
51305138
"spec_constant")};
5131-
return matchQualifiedTypeName(Ty, Scopes);
5139+
return matchQualifiedTypeName(Ty, Scopes) ||
5140+
matchQualifiedTypeName(Ty, ScopesDeprecated);
51325141
}
51335142

51345143
bool Util::isSyclSpecIdType(QualType Ty) {
@@ -5149,27 +5158,47 @@ bool Util::isSyclKernelHandlerType(QualType Ty) {
51495158
}
51505159

51515160
bool Util::isSyclAccessorNoAliasPropertyType(QualType Ty) {
5152-
std::array<DeclContextDesc, 6> Scopes = {
5161+
std::array<DeclContextDesc, 7> Scopes = {
5162+
Util::DeclContextDesc{Decl::Kind::Namespace, "cl"},
5163+
Util::DeclContextDesc{Decl::Kind::Namespace, "sycl"},
5164+
Util::DeclContextDesc{Decl::Kind::Namespace, "ext"},
5165+
Util::DeclContextDesc{Decl::Kind::Namespace, "oneapi"},
5166+
Util::DeclContextDesc{Decl::Kind::Namespace, "property"},
5167+
Util::DeclContextDesc{Decl::Kind::CXXRecord, "no_alias"},
5168+
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization,
5169+
"instance"}};
5170+
std::array<DeclContextDesc, 6> ScopesDeprecated = {
51535171
Util::DeclContextDesc{Decl::Kind::Namespace, "cl"},
51545172
Util::DeclContextDesc{Decl::Kind::Namespace, "sycl"},
51555173
Util::DeclContextDesc{Decl::Kind::Namespace, "ONEAPI"},
51565174
Util::DeclContextDesc{Decl::Kind::Namespace, "property"},
51575175
Util::DeclContextDesc{Decl::Kind::CXXRecord, "no_alias"},
51585176
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization,
51595177
"instance"}};
5160-
return matchQualifiedTypeName(Ty, Scopes);
5178+
return matchQualifiedTypeName(Ty, Scopes) ||
5179+
matchQualifiedTypeName(Ty, ScopesDeprecated);
51615180
}
51625181

51635182
bool Util::isSyclBufferLocationType(QualType Ty) {
5164-
std::array<DeclContextDesc, 6> Scopes = {
5183+
std::array<DeclContextDesc, 7> Scopes = {
5184+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
5185+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
5186+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
5187+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "intel"),
5188+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "property"),
5189+
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "buffer_location"),
5190+
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
5191+
"instance")};
5192+
std::array<DeclContextDesc, 6> ScopesDeprecated = {
51655193
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
51665194
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
51675195
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "INTEL"),
51685196
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "property"),
51695197
Util::MakeDeclContextDesc(Decl::Kind::CXXRecord, "buffer_location"),
51705198
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
51715199
"instance")};
5172-
return matchQualifiedTypeName(Ty, Scopes);
5200+
return matchQualifiedTypeName(Ty, Scopes) ||
5201+
matchQualifiedTypeName(Ty, ScopesDeprecated);
51735202
}
51745203

51755204
bool Util::isSyclType(QualType Ty, StringRef Name, bool Tmpl) {
@@ -5198,13 +5227,21 @@ bool Util::isSyclFunction(const FunctionDecl *FD, StringRef Name) {
51985227
}
51995228

52005229
bool Util::isAccessorPropertyListType(QualType Ty) {
5201-
std::array<DeclContextDesc, 4> Scopes = {
5230+
std::array<DeclContextDesc, 5> Scopes = {
5231+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
5232+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
5233+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ext"),
5234+
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "oneapi"),
5235+
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
5236+
"accessor_property_list")};
5237+
std::array<DeclContextDesc, 4> ScopesDeprecated = {
52025238
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "cl"),
52035239
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "sycl"),
52045240
Util::MakeDeclContextDesc(Decl::Kind::Namespace, "ONEAPI"),
52055241
Util::MakeDeclContextDesc(Decl::Kind::ClassTemplateSpecialization,
52065242
"accessor_property_list")};
5207-
return matchQualifiedTypeName(Ty, Scopes);
5243+
return matchQualifiedTypeName(Ty, Scopes) ||
5244+
matchQualifiedTypeName(Ty, ScopesDeprecated);
52085245
}
52095246

52105247
bool Util::matchContext(const DeclContext *Ctx,

clang/test/CodeGenSYCL/Inputs/sycl.hpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,28 +94,34 @@ class property_list {
9494
bool operator!=(const property_list &rhs) const { return false; }
9595
};
9696

97-
namespace INTEL {
97+
namespace ext {
98+
namespace intel {
9899
namespace property {
99100
// Compile time known accessor property
100101
struct buffer_location {
101102
template <int> class instance {};
102103
};
103104
} // namespace property
104-
} // namespace INTEL
105+
} // namespace intel
106+
} // namespace ext
105107

106-
namespace ONEAPI {
108+
namespace ext {
109+
namespace oneapi {
107110
namespace property {
108111
// Compile time known accessor property
109112
struct no_alias {
110113
template <bool> class instance {};
111114
};
112115
} // namespace property
113-
} // namespace ONEAPI
116+
} // namespace oneapi
117+
} // namespace ext
114118

115-
namespace ONEAPI {
119+
namespace ext {
120+
namespace oneapi {
116121
template <typename... properties>
117122
class accessor_property_list {};
118-
} // namespace ONEAPI
123+
} // namespace oneapi
124+
} // namespace ext
119125

120126
template <int dim>
121127
struct id {
@@ -166,7 +172,7 @@ struct _ImplT {
166172
template <typename dataT, int dimensions, access::mode accessmode,
167173
access::target accessTarget = access::target::global_buffer,
168174
access::placeholder isPlaceholder = access::placeholder::false_t,
169-
typename propertyListT = ONEAPI::accessor_property_list<>>
175+
typename propertyListT = ext::oneapi::accessor_property_list<>>
170176
class accessor {
171177

172178
public:
@@ -286,7 +292,8 @@ struct get_kernel_name_t<auto_name, Type> {
286292
using name = Type;
287293
};
288294

289-
namespace ONEAPI {
295+
namespace ext {
296+
namespace oneapi {
290297
namespace experimental {
291298
template <typename T, typename ID = T>
292299
class spec_constant {
@@ -302,7 +309,8 @@ class spec_constant {
302309
}
303310
};
304311
} // namespace experimental
305-
} // namespace ONEAPI
312+
} // namespace oneapi
313+
} // namespace ext
306314

307315
class kernel_handler {
308316
void __init_specialization_constants_buffer(char *specialization_constants_buffer) {}

clang/test/CodeGenSYCL/accessor_inheritance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ int main() {
7272
// Check accessors initialization
7373
// CHECK: [[ACC_FIELD:%[a-zA-Z0-9_]+]] = getelementptr inbounds %struct{{.*}}Base, %struct{{.*}}Base addrspace(4)* [[BITCAST]], i32 0, i32 2
7474
// Default constructor call
75-
// CHECK: call spir_func void @_ZN2cl4sycl8accessorIcLi1ELNS0_6access4modeE1024ELNS2_6targetE2014ELNS2_11placeholderE0ENS0_6ONEAPI22accessor_property_listIJEEEEC1Ev(%"class{{.*}}cl::sycl::accessor" addrspace(4)* {{[^,]*}} [[ACC_FIELD]])
75+
// CHECK: call spir_func void @_ZN2cl4sycl8accessorIcLi1ELNS0_6access4modeE1024ELNS2_6targetE2014ELNS2_11placeholderE0ENS0_3ext6oneapi22accessor_property_listIJEEEEC1Ev(%"class{{.*}}cl::sycl::accessor" addrspace(4)* {{[^,]*}} [[ACC_FIELD]])
7676
// CHECK: [[BITCAST1:%[a-zA-Z0-9_]+]] = bitcast %struct{{.*}}Captured addrspace(4)* [[GEP]] to i8 addrspace(4)*
7777
// CHECK: [[GEP1:%[a-zA-Z0-9_]+]] = getelementptr inbounds i8, i8 addrspace(4)* [[BITCAST1]], i64 20
7878
// CHECK: [[BITCAST2:%[a-zA-Z0-9_]+]] = bitcast i8 addrspace(4)* [[GEP1]] to %"class{{.*}}cl::sycl::accessor" addrspace(4)*
7979
// Default constructor call
80-
// CHECK: call spir_func void @_ZN2cl4sycl8accessorIcLi1ELNS0_6access4modeE1024ELNS2_6targetE2014ELNS2_11placeholderE0ENS0_6ONEAPI22accessor_property_listIJEEEEC2Ev(%"class{{.*}}cl::sycl::accessor" addrspace(4)* {{[^,]*}} [[BITCAST2]])
80+
// CHECK: call spir_func void @_ZN2cl4sycl8accessorIcLi1ELNS0_6access4modeE1024ELNS2_6targetE2014ELNS2_11placeholderE0ENS0_3ext6oneapi22accessor_property_listIJEEEEC2Ev(%"class{{.*}}cl::sycl::accessor" addrspace(4)* {{[^,]*}} [[BITCAST2]])
8181

8282
// CHECK C field initialization
8383
// CHECK: [[FIELD_C:%[a-zA-Z0-9_]+]] = getelementptr inbounds %struct{{.*}}Captured, %struct{{.*}}Captured addrspace(4)* [[GEP]], i32 0, i32 2

clang/test/CodeGenSYCL/accessor_no_alias_property.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ int main() {
1212
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write,
1313
cl::sycl::access::target::global_buffer,
1414
cl::sycl::access::placeholder::false_t,
15-
cl::sycl::ONEAPI::accessor_property_list<
16-
cl::sycl::ONEAPI::property::no_alias::instance<true>>>
15+
cl::sycl::ext::oneapi::accessor_property_list<
16+
cl::sycl::ext::oneapi::property::no_alias::instance<true>>>
1717
accessorA;
1818

1919
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write,
2020
cl::sycl::access::target::global_buffer,
2121
cl::sycl::access::placeholder::false_t,
22-
cl::sycl::ONEAPI::accessor_property_list<
23-
cl::sycl::INTEL::property::buffer_location::instance<1>>>
22+
cl::sycl::ext::oneapi::accessor_property_list<
23+
cl::sycl::ext::intel::property::buffer_location::instance<1>>>
2424
accessorB;
2525

2626
cl::sycl::kernel_single_task<class kernel_function1>(

clang/test/CodeGenSYCL/buffer_location.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ struct Base {
1010
cl::sycl::accessor<char, 1, cl::sycl::access::mode::read,
1111
cl::sycl::access::target::global_buffer,
1212
cl::sycl::access::placeholder::false_t,
13-
cl::sycl::ONEAPI::accessor_property_list<
14-
cl::sycl::INTEL::property::buffer_location::instance<2>>>
13+
cl::sycl::ext::oneapi::accessor_property_list<
14+
cl::sycl::ext::intel::property::buffer_location::instance<2>>>
1515
AccField;
1616
};
1717

1818
struct Captured : Base,
1919
cl::sycl::accessor<char, 1, cl::sycl::access::mode::read,
2020
cl::sycl::access::target::global_buffer,
2121
cl::sycl::access::placeholder::false_t,
22-
cl::sycl::ONEAPI::accessor_property_list<
23-
cl::sycl::INTEL::property::buffer_location::instance<2>>> {
22+
cl::sycl::ext::oneapi::accessor_property_list<
23+
cl::sycl::ext::intel::property::buffer_location::instance<2>>> {
2424
int C;
2525
};
2626

@@ -29,8 +29,8 @@ int main() {
2929
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write,
3030
cl::sycl::access::target::global_buffer,
3131
cl::sycl::access::placeholder::false_t,
32-
cl::sycl::ONEAPI::accessor_property_list<
33-
cl::sycl::INTEL::property::buffer_location::instance<3>>>
32+
cl::sycl::ext::oneapi::accessor_property_list<
33+
cl::sycl::ext::intel::property::buffer_location::instance<3>>>
3434
accessorA;
3535
cl::sycl::kernel_single_task<class kernel_function>(
3636
[=]() {

clang/test/CodeGenSYCL/int_header_spec_const.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,22 @@ class MySpecConstantWithinANamespace;
2424

2525
int main() {
2626
// Create specialization constants.
27-
cl::sycl::ONEAPI::experimental::spec_constant<bool, MyBoolConst> i1(false);
28-
cl::sycl::ONEAPI::experimental::spec_constant<char, MyInt8Const> i8(0);
29-
cl::sycl::ONEAPI::experimental::spec_constant<unsigned char, MyUInt8Const> ui8(0);
30-
cl::sycl::ONEAPI::experimental::spec_constant<short, MyInt16Const> i16(0);
31-
cl::sycl::ONEAPI::experimental::spec_constant<unsigned short, MyUInt16Const> ui16(0);
32-
cl::sycl::ONEAPI::experimental::spec_constant<int, MyInt32Const> i32(0);
27+
cl::sycl::ext::oneapi::experimental::spec_constant<bool, MyBoolConst> i1(false);
28+
cl::sycl::ext::oneapi::experimental::spec_constant<char, MyInt8Const> i8(0);
29+
cl::sycl::ext::oneapi::experimental::spec_constant<unsigned char, MyUInt8Const> ui8(0);
30+
cl::sycl::ext::oneapi::experimental::spec_constant<short, MyInt16Const> i16(0);
31+
cl::sycl::ext::oneapi::experimental::spec_constant<unsigned short, MyUInt16Const> ui16(0);
32+
cl::sycl::ext::oneapi::experimental::spec_constant<int, MyInt32Const> i32(0);
3333
// Constant used twice, but there must be single entry in the int header,
3434
// otherwise compilation error would be issued.
35-
cl::sycl::ONEAPI::experimental::spec_constant<int, MyInt32Const> i32_1(0);
36-
cl::sycl::ONEAPI::experimental::spec_constant<unsigned int, MyUInt32Const> ui32(0);
37-
cl::sycl::ONEAPI::experimental::spec_constant<float, MyFloatConst> f32(0);
38-
cl::sycl::ONEAPI::experimental::spec_constant<double, MyDoubleConst> f64(0);
35+
cl::sycl::ext::oneapi::experimental::spec_constant<int, MyInt32Const> i32_1(0);
36+
cl::sycl::ext::oneapi::experimental::spec_constant<unsigned int, MyUInt32Const> ui32(0);
37+
cl::sycl::ext::oneapi::experimental::spec_constant<float, MyFloatConst> f32(0);
38+
cl::sycl::ext::oneapi::experimental::spec_constant<double, MyDoubleConst> f64(0);
3939
// Kernel name can be used as a spec constant name
40-
cl::sycl::ONEAPI::experimental::spec_constant<int, SpecializedKernel> spec1(0);
40+
cl::sycl::ext::oneapi::experimental::spec_constant<int, SpecializedKernel> spec1(0);
4141
// Spec constant name can be declared within a namespace
42-
cl::sycl::ONEAPI::experimental::spec_constant<int, test::MySpecConstantWithinANamespace> spec2(0);
42+
cl::sycl::ext::oneapi::experimental::spec_constant<int, test::MySpecConstantWithinANamespace> spec2(0);
4343

4444
double val;
4545
double *ptr = &val; // to avoid "unused" warnings

clang/test/SemaSYCL/Inputs/sycl.hpp

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,22 @@ enum class address_space : int {
3939

4040
class property_list {};
4141

42-
namespace INTEL {
42+
namespace ext {
43+
namespace intel {
4344
namespace property {
4445
struct buffer_location {
4546
template <int> class instance {};
4647
};
4748
} // namespace property
48-
} // namespace INTEL
49+
} // namespace intel
50+
} // namespace ext
4951

50-
namespace ONEAPI {
52+
namespace ext {
53+
namespace oneapi {
5154
template <typename... properties>
5255
class accessor_property_list {};
53-
} // namespace ONEAPI
56+
} // namespace oneapi
57+
} // namespace ext
5458

5559
namespace detail {
5660
namespace half_impl {
@@ -102,7 +106,7 @@ struct DeviceValueType<dataT, access::target::local> {
102106
template <typename dataT, int dimensions, access::mode accessmode,
103107
access::target accessTarget = access::target::global_buffer,
104108
access::placeholder isPlaceholder = access::placeholder::false_t,
105-
typename propertyListT = ONEAPI::accessor_property_list<>>
109+
typename propertyListT = ext::oneapi::accessor_property_list<>>
106110
class accessor {
107111

108112
public:
@@ -312,12 +316,14 @@ class stream {
312316
int FlushBufferSize;
313317
};
314318

315-
namespace ONEAPI {
319+
namespace ext {
320+
namespace oneapi {
316321
namespace experimental {
317322
template <typename T, typename ID = T>
318323
class spec_constant {};
319324
} // namespace experimental
320-
} // namespace ONEAPI
325+
} // namespace oneapi
326+
} // namespace ext
321327
} // namespace sycl
322328
} // namespace cl
323329

0 commit comments

Comments
 (0)