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<
10825
10825
def err_sycl_non_constant_array_type : Error<
10826
10826
"kernel parameter is not a constant size array %0">;
10827
10827
def 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 ">;
10829
10829
def err_conflicting_sycl_function_attributes : Error<
10830
10830
"%0 attribute conflicts with '%1' attribute">;
10831
10831
def 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 {
12582
12582
private:
12583
12583
// We store SYCL Kernels here and handle separately -- which is a hack.
12584
12584
// FIXME: It would be best to refactor this.
12585
- SmallVector <Decl*, 4 > SyclDeviceDecls;
12585
+ llvm::SetVector <Decl * > SyclDeviceDecls;
12586
12586
// SYCL integration header instance for current compilation unit this Sema
12587
12587
// is associated with.
12588
12588
std::unique_ptr<SYCLIntegrationHeader> SyclIntHeader;
@@ -12593,8 +12593,8 @@ class Sema final {
12593
12593
bool ConstructingOpenCLKernel = false;
12594
12594
12595
12595
public:
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; }
12598
12598
12599
12599
/// Lazily creates and returns SYCL integration header instance.
12600
12600
SYCLIntegrationHeader &getSyclIntegrationHeader() {
Original file line number Diff line number Diff line change @@ -1617,6 +1617,15 @@ void Sema::MarkDevice(void) {
1617
1617
// it is recursive.
1618
1618
MarkDeviceFunction Marker (*this );
1619
1619
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
+
1620
1629
for (Decl *D : syclDeviceDecls ()) {
1621
1630
if (auto SYCLKernel = dyn_cast<FunctionDecl>(D)) {
1622
1631
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 {{.*}}
53
64
// CHECK-NEXT: IntegerLiteral{{.*}}16{{$}}
You can’t perform that action at this time.
0 commit comments