Skip to content

Commit f2a095e

Browse files
committed
Respond to reviews
Signed-off-by: Zahira Ammarguellat <[email protected]>
1 parent b4b243b commit f2a095e

File tree

4 files changed

+36
-34
lines changed

4 files changed

+36
-34
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11611,7 +11611,7 @@ def ext_sycl_2020_attr_spelling : ExtWarn<
1161111611
"use of attribute %0 is a SYCL 2020 extension">,
1161211612
InGroup<Sycl2017Compat>;
1161311613
def err_sycl_esimd_not_supported_for_type : Error<
11614-
"type %0 is not support in 'esimd' context">;
11614+
"type %0 is not supported in 'esimd' context">;
1161511615

1161611616
// errors of expect.with.probability
1161711617
def err_probability_not_constant_float : Error<

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,13 +1668,13 @@ class SyclKernelFieldChecker : public SyclKernelFieldHandler {
16681668
return SemaRef.Diag(Loc.getBegin(),
16691669
diag::err_sycl_esimd_not_supported_for_type)
16701670
<< RecD;
1671-
else
1672-
return false;
1671+
return false;
16731672
}
16741673

16751674
public:
1676-
SyclKernelFieldChecker(Sema &S)
1677-
: SyclKernelFieldHandler(S), Diag(S.getASTContext().getDiagnostics()) {}
1675+
SyclKernelFieldChecker(Sema &S, bool isSIMD)
1676+
: SyclKernelFieldHandler(S), Diag(S.getASTContext().getDiagnostics()),
1677+
IsSIMD(isSIMD) {}
16781678
static constexpr const bool VisitNthArrayElement = false;
16791679
bool isValid() { return !IsInvalid; }
16801680

@@ -3619,11 +3619,12 @@ void Sema::CheckSYCLKernelCall(FunctionDecl *KernelFunc, SourceRange CallLoc,
36193619
if (KernelObj->isInvalidDecl())
36203620
return;
36213621

3622+
bool IsSIMDKernel = isESIMDKernelType(KernelObj);
3623+
36223624
SyclKernelDecompMarker DecompMarker(*this);
3623-
SyclKernelFieldChecker FieldChecker(*this);
3625+
SyclKernelFieldChecker FieldChecker(*this, IsSIMDKernel);
36243626
SyclKernelUnionChecker UnionChecker(*this);
36253627

3626-
bool IsSIMDKernel = isESIMDKernelType(KernelObj);
36273628
SyclKernelArgsSizeChecker ArgsSizeChecker(*this, Args[0]->getExprLoc(),
36283629
IsSIMDKernel);
36293630

clang/test/CodeGenSYCL/esimd-special-class.cpp

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// RUN: %clang_cc1 -fsycl-is-device -verify \
2+
// RUN: -internal-isystem %S/Inputs -triple spir64-unknown-unknown \
3+
// RUN: -fsyntax-only -disable-llvm-passes -emit-llvm %s -o - %s
4+
5+
// The test is to ensure that the use of sycl_explicit_simd attribute doesn't
6+
// crash when used with sampler or stream. Currently samplers/stream are not
7+
// supported in esimd.
8+
9+
#include "sycl.hpp"
10+
using namespace cl::sycl;
11+
void test() {
12+
13+
queue q;
14+
15+
q.submit([&](handler &h) {
16+
cl::sycl::sampler smplr;
17+
cl::sycl::stream Stream(1024, 128, h);
18+
// expected-note@+1{{in instantiation of function template specialization}}
19+
h.single_task<class esimd_kernel>(
20+
// expected-error@+1{{type 'sampler' is not supported in 'esimd' context}}
21+
[=]() [[intel::sycl_explicit_simd]] { smplr.use(); });
22+
23+
// expected-note@+1{{in instantiation of function template specialization}}
24+
h.single_task<class StreamTester>(
25+
// expected-error@+1{{type 'stream' is not supported in 'esimd' context}}
26+
[=]() [[intel::sycl_explicit_simd]] { Stream.use(); });
27+
});
28+
}

0 commit comments

Comments
 (0)