File tree Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Expand file tree Collapse file tree 4 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -10825,7 +10825,7 @@ def err_sycl_non_std_layout_type : Error<
1082510825def err_sycl_non_constant_array_type : Error<
1082610826 "kernel parameter is not a constant size array %0">;
1082710827def err_conflicting_sycl_kernel_attributes : Error<
10828- "conflicting attributes applied to a SYCL kernel">;
10828+ "conflicting attributes applied to a SYCL kernel or SYCL_EXTERNAL function ">;
1082910829def err_conflicting_sycl_function_attributes : Error<
1083010830 "%0 attribute conflicts with '%1' attribute">;
1083110831def err_sycl_x_y_z_arguments_must_be_one : Error<
Original file line number Diff line number Diff line change @@ -12582,7 +12582,7 @@ class Sema final {
1258212582private:
1258312583 // We store SYCL Kernels here and handle separately -- which is a hack.
1258412584 // FIXME: It would be best to refactor this.
12585- SmallVector <Decl*, 4 > SyclDeviceDecls;
12585+ llvm::SetVector <Decl * > SyclDeviceDecls;
1258612586 // SYCL integration header instance for current compilation unit this Sema
1258712587 // is associated with.
1258812588 std::unique_ptr<SYCLIntegrationHeader> SyclIntHeader;
@@ -12593,8 +12593,8 @@ class Sema final {
1259312593 bool ConstructingOpenCLKernel = false;
1259412594
1259512595public:
12596- void addSyclDeviceDecl(Decl *d) { SyclDeviceDecls.push_back (d); }
12597- SmallVectorImpl <Decl *> &syclDeviceDecls() { return SyclDeviceDecls; }
12596+ void addSyclDeviceDecl(Decl *d) { SyclDeviceDecls.insert (d); }
12597+ llvm::SetVector <Decl *> &syclDeviceDecls() { return SyclDeviceDecls; }
1259812598
1259912599 /// Lazily creates and returns SYCL integration header instance.
1260012600 SYCLIntegrationHeader &getSyclIntegrationHeader() {
Original file line number Diff line number Diff line change @@ -1617,6 +1617,15 @@ void Sema::MarkDevice(void) {
16171617 // it is recursive.
16181618 MarkDeviceFunction Marker (*this );
16191619 Marker.SYCLCG .addToCallGraph (getASTContext ().getTranslationUnitDecl ());
1620+
1621+ // Iterate through SYCL_EXTERNAL functions and add them to the device decls.
1622+ for (const auto &entry : *Marker.SYCLCG .getRoot ()) {
1623+ if (auto *FD = dyn_cast<FunctionDecl>(entry.Callee ->getDecl ())) {
1624+ if (FD->hasAttr <SYCLDeviceAttr>() && !FD->hasAttr <SYCLKernelAttr>())
1625+ addSyclDeviceDecl (FD);
1626+ }
1627+ }
1628+
16201629 for (Decl *D : syclDeviceDecls ()) {
16211630 if (auto SYCLKernel = dyn_cast<FunctionDecl>(D)) {
16221631 llvm::SmallPtrSet<FunctionDecl *, 10 > VisitedSet;
Original file line number Diff line number Diff line change @@ -48,6 +48,17 @@ void bar() {
4848 kernel<class kernel_name5 >([]() [[cl::intel_reqd_sub_group_size (2 )]] { });
4949}
5050
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+
5162// CHECK: FunctionDecl {{.*}} {{.*}}kernel_name1
5263// CHECK: IntelReqdSubGroupSizeAttr {{.*}}
5364// CHECK-NEXT: IntegerLiteral{{.*}}16{{$}}
You can’t perform that action at this time.
0 commit comments