Skip to content

Commit a73369d

Browse files
authored
[SYCL] Move general language extensions to the ONEAPI namespace (#2231)
This concentrates general language extensions into the ONEAPI namespace. It includes: Atomics Printf Group Algorithms Reductions Sub-groups Specialization Constants Function Pointers Signed-off-by: James Brodman [email protected]
1 parent c709986 commit a73369d

File tree

79 files changed

+611
-557
lines changed

Some content is hidden

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

79 files changed

+611
-557
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3227,9 +3227,10 @@ bool Util::isSyclHalfType(const QualType &Ty) {
32273227

32283228
bool Util::isSyclSpecConstantType(const QualType &Ty) {
32293229
const StringRef &Name = "spec_constant";
3230-
std::array<DeclContextDesc, 4> Scopes = {
3230+
std::array<DeclContextDesc, 5> Scopes = {
32313231
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "cl"},
32323232
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "sycl"},
3233+
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "ONEAPI"},
32333234
Util::DeclContextDesc{clang::Decl::Kind::Namespace, "experimental"},
32343235
Util::DeclContextDesc{Decl::Kind::ClassTemplateSpecialization, Name}};
32353236
return matchQualifiedTypeName(Ty, Scopes);

clang/test/CodeGenSYCL/Inputs/sycl.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ struct get_kernel_name_t<auto_name, Type> {
253253
using name = Type;
254254
};
255255

256+
namespace ONEAPI {
256257
namespace experimental {
257258
template <typename T, typename ID = T>
258259
class spec_constant {
@@ -268,6 +269,7 @@ class spec_constant {
268269
}
269270
};
270271
} // namespace experimental
272+
} // namespace ONEAPI
271273

272274
#define ATTR_SYCL_KERNEL __attribute__((sycl_kernel))
273275
template <typename KernelName = auto_name, typename KernelType>

clang/test/CodeGenSYCL/int_header_spec_const.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ class MyDoubleConst;
2020

2121
int main() {
2222
// Create specialization constants.
23-
cl::sycl::experimental::spec_constant<bool, MyBoolConst> i1(false);
24-
cl::sycl::experimental::spec_constant<char, MyInt8Const> i8(0);
25-
cl::sycl::experimental::spec_constant<unsigned char, MyUInt8Const> ui8(0);
26-
cl::sycl::experimental::spec_constant<short, MyInt16Const> i16(0);
27-
cl::sycl::experimental::spec_constant<unsigned short, MyUInt16Const> ui16(0);
28-
cl::sycl::experimental::spec_constant<int, MyInt32Const> i32(0);
23+
cl::sycl::ONEAPI::experimental::spec_constant<bool, MyBoolConst> i1(false);
24+
cl::sycl::ONEAPI::experimental::spec_constant<char, MyInt8Const> i8(0);
25+
cl::sycl::ONEAPI::experimental::spec_constant<unsigned char, MyUInt8Const> ui8(0);
26+
cl::sycl::ONEAPI::experimental::spec_constant<short, MyInt16Const> i16(0);
27+
cl::sycl::ONEAPI::experimental::spec_constant<unsigned short, MyUInt16Const> ui16(0);
28+
cl::sycl::ONEAPI::experimental::spec_constant<int, MyInt32Const> i32(0);
2929
// Constant used twice, but there must be single entry in the int header,
3030
// otherwise compilation error would be issued.
31-
cl::sycl::experimental::spec_constant<int, MyInt32Const> i32_1(0);
32-
cl::sycl::experimental::spec_constant<unsigned int, MyUInt32Const> ui32(0);
33-
cl::sycl::experimental::spec_constant<float, MyFloatConst> f32(0);
34-
cl::sycl::experimental::spec_constant<double, MyDoubleConst> f64(0);
31+
cl::sycl::ONEAPI::experimental::spec_constant<int, MyInt32Const> i32_1(0);
32+
cl::sycl::ONEAPI::experimental::spec_constant<unsigned int, MyUInt32Const> ui32(0);
33+
cl::sycl::ONEAPI::experimental::spec_constant<float, MyFloatConst> f32(0);
34+
cl::sycl::ONEAPI::experimental::spec_constant<double, MyDoubleConst> f64(0);
3535

3636
double val;
3737
double *ptr = &val; // to avoid "unused" warnings

clang/test/SemaSYCL/Inputs/sycl.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,12 @@ class handler {
218218
}
219219
};
220220

221+
namespace ONEAPI {
221222
namespace experimental {
222-
223223
template <typename T, typename ID = T>
224224
class spec_constant {};
225225
} // namespace experimental
226-
226+
} // namespace ONEAPI
227227
} // namespace sycl
228228
} // namespace cl
229229

clang/test/SemaSYCL/spec-const-kernel-arg.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
#include <sycl.hpp>
77

88
struct SpecConstantsWrapper {
9-
cl::sycl::experimental::spec_constant<int, class sc_name1> SC1;
10-
cl::sycl::experimental::spec_constant<int, class sc_name2> SC2;
9+
cl::sycl::ONEAPI::experimental::spec_constant<int, class sc_name1> SC1;
10+
cl::sycl::ONEAPI::experimental::spec_constant<int, class sc_name2> SC2;
1111
};
1212

1313
int main() {
14-
cl::sycl::experimental::spec_constant<char, class MyInt32Const> SC;
14+
cl::sycl::ONEAPI::experimental::spec_constant<char, class MyInt32Const> SC;
1515
SpecConstantsWrapper W;
1616
cl::sycl::kernel_single_task<class kernel_sc>(
1717
[=]() {
@@ -23,7 +23,7 @@ int main() {
2323
// CHECK: FunctionDecl {{.*}}kernel_sc{{.*}} 'void ()'
2424
// CHECK: VarDecl {{.*}}'(lambda at {{.*}}'
2525
// CHECK-NEXT: InitListExpr {{.*}}'(lambda at {{.*}}'
26-
// CHECK-NEXT: CXXConstructExpr {{.*}}'cl::sycl::experimental::spec_constant<char, class MyInt32Const>':'cl::sycl::experimental::spec_constant<char, MyInt32Const>'
26+
// CHECK-NEXT: CXXConstructExpr {{.*}}'cl::sycl::ONEAPI::experimental::spec_constant<char, class MyInt32Const>':'cl::sycl::ONEAPI::experimental::spec_constant<char, MyInt32Const>'
2727
// CHECK-NEXT: InitListExpr {{.*}} 'SpecConstantsWrapper'
28-
// CHECK-NEXT: CXXConstructExpr {{.*}} 'cl::sycl::experimental::spec_constant<int, class sc_name1>':'cl::sycl::experimental::spec_constant<int, sc_name1>'
29-
// CHECK-NEXT: CXXConstructExpr {{.*}} 'cl::sycl::experimental::spec_constant<int, class sc_name2>':'cl::sycl::experimental::spec_constant<int, sc_name2>'
28+
// CHECK-NEXT: CXXConstructExpr {{.*}} 'cl::sycl::ONEAPI::experimental::spec_constant<int, class sc_name1>':'cl::sycl::ONEAPI::experimental::spec_constant<int, sc_name1>'
29+
// CHECK-NEXT: CXXConstructExpr {{.*}} 'cl::sycl::ONEAPI::experimental::spec_constant<int, class sc_name2>':'cl::sycl::ONEAPI::experimental::spec_constant<int, sc_name2>'

clang/test/SemaSYCL/spec_const_and_accesor_crash.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ __attribute__((sycl_kernel)) void kernel(const Func &kernelFunc) {
1010
}
1111

1212
int main() {
13-
cl::sycl::experimental::spec_constant<char, class MyInt32Const> spec_const;
13+
cl::sycl::ONEAPI::experimental::spec_constant<char, class MyInt32Const> spec_const;
1414
cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write> accessor;
15-
// CHECK: FieldDecl {{.*}} implicit referenced 'cl::sycl::experimental::spec_constant<char, class MyInt32Const>'
15+
// CHECK: FieldDecl {{.*}} implicit referenced 'cl::sycl::ONEAPI::experimental::spec_constant<char, class MyInt32Const>'
1616
// CHECK: FieldDecl {{.*}} implicit referenced 'cl::sycl::accessor<int, 1, cl::sycl::access::mode::read_write>'
1717
kernel<class MyKernel>([spec_const, accessor]() {});
1818
return 0;

llvm/test/tools/sycl-post-link/sc_sym_two_refs.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
88
target triple = "spir64-unknown-unknown-sycldevice"
99

10-
%"sycl::experimental::spec_constant" = type { i8 }
10+
%"spec_constant" = type { i8 }
1111

1212
@SCSymID = private unnamed_addr constant [10 x i8] c"SpecConst\00", align 1
1313
; CHECK-NOT: @SCSymID
@@ -21,7 +21,7 @@ define weak_odr dso_local spir_kernel void @Kernel() {
2121
}
2222

2323
; Function Attrs: norecurse
24-
define dso_local spir_func float @foo_float(%"sycl::experimental::spec_constant" addrspace(4)* nocapture readnone dereferenceable(1) %0) local_unnamed_addr #3 {
24+
define dso_local spir_func float @foo_float(%"spec_constant" addrspace(4)* nocapture readnone dereferenceable(1) %0) local_unnamed_addr #3 {
2525
%2 = tail call spir_func float @_Z27__sycl_getSpecConstantValueIfET_PKc(i8 addrspace(4)* addrspacecast (i8* getelementptr inbounds ([10 x i8], [10 x i8]* @SCSymID, i64 0, i64 0) to i8 addrspace(4)*))
2626
ret float %2
2727
}

sycl/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ include(AddSYCLExecutable)
1515
set(SYCL_MAJOR_VERSION 3)
1616
set(SYCL_MINOR_VERSION 0)
1717
set(SYCL_PATCH_VERSION 0)
18-
set(SYCL_DEV_ABI_VERSION 0)
18+
set(SYCL_DEV_ABI_VERSION 1)
1919
if (SYCL_ADD_DEV_VERSION_POSTFIX)
2020
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
2121
endif()

sycl/include/CL/sycl.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
#pragma once
1010

11+
#include <CL/sycl/ONEAPI/atomic.hpp>
12+
#include <CL/sycl/ONEAPI/experimental/builtins.hpp>
13+
#include <CL/sycl/ONEAPI/function_pointer.hpp>
14+
#include <CL/sycl/ONEAPI/group_algorithm.hpp>
15+
#include <CL/sycl/ONEAPI/reduction.hpp>
16+
#include <CL/sycl/ONEAPI/sub_group.hpp>
1117
#include <CL/sycl/accessor.hpp>
1218
#include <CL/sycl/aspects.hpp>
1319
#include <CL/sycl/atomic.hpp>
@@ -23,12 +29,6 @@
2329
#include <CL/sycl/handler.hpp>
2430
#include <CL/sycl/id.hpp>
2531
#include <CL/sycl/image.hpp>
26-
#include <CL/sycl/intel/atomic.hpp>
27-
#include <CL/sycl/intel/builtins.hpp>
28-
#include <CL/sycl/intel/function_pointer.hpp>
29-
#include <CL/sycl/intel/group_algorithm.hpp>
30-
#include <CL/sycl/intel/reduction.hpp>
31-
#include <CL/sycl/intel/sub_group.hpp>
3232
#include <CL/sycl/item.hpp>
3333
#include <CL/sycl/kernel.hpp>
3434
#include <CL/sycl/multi_ptr.hpp>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==---------------- atomic.hpp - SYCL_INTEL_extended_atomics --------------==//
1+
//==--------------- atomic.hpp - SYCL_ONEAPI_extended_atomics --------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -8,7 +8,7 @@
88

99
#pragma once
1010

11-
#include <CL/sycl/intel/atomic_accessor.hpp>
12-
#include <CL/sycl/intel/atomic_enums.hpp>
13-
#include <CL/sycl/intel/atomic_fence.hpp>
14-
#include <CL/sycl/intel/atomic_ref.hpp>
11+
#include <CL/sycl/ONEAPI/atomic_accessor.hpp>
12+
#include <CL/sycl/ONEAPI/atomic_enums.hpp>
13+
#include <CL/sycl/ONEAPI/atomic_fence.hpp>
14+
#include <CL/sycl/ONEAPI/atomic_ref.hpp>

0 commit comments

Comments
 (0)