File tree Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Expand file tree Collapse file tree 3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -12556,7 +12556,7 @@ class Sema final {
12556
12556
private:
12557
12557
// We store SYCL Kernels here and handle separately -- which is a hack.
12558
12558
// FIXME: It would be best to refactor this.
12559
- SmallVector <Decl*, 4 > SyclDeviceDecls;
12559
+ llvm::SetVector <Decl * > SyclDeviceDecls;
12560
12560
// SYCL integration header instance for current compilation unit this Sema
12561
12561
// is associated with.
12562
12562
std::unique_ptr<SYCLIntegrationHeader> SyclIntHeader;
@@ -12567,8 +12567,8 @@ class Sema final {
12567
12567
bool ConstructingOpenCLKernel = false;
12568
12568
12569
12569
public:
12570
- void addSyclDeviceDecl(Decl *d) { SyclDeviceDecls.push_back (d); }
12571
- SmallVectorImpl <Decl *> &syclDeviceDecls() { return SyclDeviceDecls; }
12570
+ void addSyclDeviceDecl(Decl *d) { SyclDeviceDecls.insert (d); }
12571
+ llvm::SetVector <Decl *> &syclDeviceDecls() { return SyclDeviceDecls; }
12572
12572
12573
12573
/// Lazily creates and returns SYCL integration header instance.
12574
12574
SYCLIntegrationHeader &getSyclIntegrationHeader() {
Original file line number Diff line number Diff line change @@ -1460,6 +1460,15 @@ void Sema::MarkDevice(void) {
1460
1460
// it is recursive.
1461
1461
MarkDeviceFunction Marker (*this );
1462
1462
Marker.SYCLCG .addToCallGraph (getASTContext ().getTranslationUnitDecl ());
1463
+
1464
+ // Iterate through SYCL_EXTERNAL functions and add them to the device decls.
1465
+ for (const auto &entry : *Marker.SYCLCG .getRoot ()) {
1466
+ if (auto *FD = dyn_cast<FunctionDecl>(entry.Callee ->getDecl ())) {
1467
+ if (FD->hasAttr <SYCLDeviceAttr>() && !FD->hasAttr <SYCLKernelAttr>())
1468
+ addSyclDeviceDecl (FD);
1469
+ }
1470
+ }
1471
+
1463
1472
for (Decl *D : syclDeviceDecls ()) {
1464
1473
if (auto SYCLKernel = dyn_cast<FunctionDecl>(D)) {
1465
1474
llvm::SmallPtrSet<FunctionDecl *, 10 > VisitedSet;
Original file line number Diff line number Diff line change @@ -48,6 +48,17 @@ void bar() {
48
48
kernel<class kernel_name5 >([]() [[cl::intel_reqd_sub_group_size (2 )]] { });
49
49
}
50
50
51
+ #ifdef TRIGGER_ERROR
52
+ // expected-note@+1 {{conflicting attribute is here}}
53
+ [[cl::intel_reqd_sub_group_size(2 )]] void sg_size2 () {}
54
+
55
+ // expected-note@+2 {{conflicting attribute is here}}
56
+ // expected-error@+1 {{conflicting attributes applied to a SYCL kernel}}
57
+ [[cl::intel_reqd_sub_group_size(4 )]] __attribute__((sycl_device)) void sg_size4 () {
58
+ sg_size2 ();
59
+ }
60
+ #endif
61
+
51
62
// CHECK: FunctionDecl {{.*}} {{.*}}kernel_name1
52
63
// CHECK: IntelReqdSubGroupSizeAttr {{.*}} 16
53
64
// CHECK: FunctionDecl {{.*}} {{.*}}kernel_name2
You can’t perform that action at this time.
0 commit comments