[llvm-branch-commits] [llvm] [libsycl] add single_task (PR #188797)

Mariya Podchishchaeva via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 30 07:01:26 PDT 2026


================
@@ -0,0 +1,18 @@
+// REQUIRES: any-device
+// RUN: %clangxx -fsycl  %s -o %t.out
+// RUN: %t.out
+
+#include <sycl/sycl.hpp>
+
+class Test;
+
+int main() {
+  sycl::queue q;
+  int *p = sycl::malloc_shared<int>(1, q);
+  *p = 0;
+  q.single_task<Test>([=]() { *p = 42; });
+  q.wait();
+  assert(*p == 42);
----------------
Fznamznon wrote:

Maybe also exit(1) instead of assert? I'm not a fan of asserts since they are wiped out in release builds.

https://github.com/llvm/llvm-project/pull/188797


More information about the llvm-branch-commits mailing list