Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 4869162

Browse files
[SYCL] Remove UB in sampler.cpp (#1177)
The SYCL 2020 specification states that the instance of a moved SYCL object is invalid, so any operations after a move exhibit undefined behaviour. sampler.cpp moves a sampler before hashing the moved object. In that case, the hasher will extract a nullptr implementation, which with intel/llvm#6598 will fail an assertion. Since this is UB, failing the assertion is valid and the UB case should be removed. This commit removes the UB operation and removes the unnecessary opencl_icd requirement in sampler.cpp. Signed-off-by: Larsen, Steffen <[email protected]>
1 parent 9e32012 commit 4869162

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

SYCL/Basic/sampler/sampler.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// REQUIRES: opencl, opencl_icd
2-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-dead-args-optimization %s -o %t.out %opencl_lib
1+
// REQUIRES: opencl
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-dead-args-optimization %s -o %t.out
33
// RUN: %HOST_RUN_PLACEHOLDER %t.out
44
// RUN: %CPU_RUN_PLACEHOLDER %t.out
55
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -67,7 +67,6 @@ int main() {
6767
A = std::move(B);
6868
assert(Hasher(C) == Hasher(A));
6969
assert(C == A);
70-
assert(Hasher(C) != Hasher(B));
7170

7271
SamplerWrapper WrappedSmplr(sycl::coordinate_normalization_mode::normalized,
7372
sycl::addressing_mode::repeat,

0 commit comments

Comments
 (0)