From 4248b441345a0db83d028093ef97b285ec4179c3 Mon Sep 17 00:00:00 2001 From: "Cai, Justin" Date: Tue, 8 Oct 2024 09:37:09 -0700 Subject: [PATCH 1/4] [SYCL] Enable E2E test of fp64 conversion emulation --- sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp index 5094a1d0af48f..6d757429b5a2d 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp @@ -1,9 +1,8 @@ -// REQUIRES: ocloc, gpu, linux +// REQUIRES: ocloc, gpu, linux, arch-intel_gpu_dg2_g10 // UNSUPPORTED: cuda, hip -// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device pvc" -fsycl-fp64-conv-emu -O0 %s -o %t_opt.out -// TODO: Enable when GPU driver is updated. -// RUNx: %{run} %t_opt.out +// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t_opt.out +// RUN: %{run} %t_opt.out // Tests that aspect::fp64 is not emitted correctly when -fsycl-fp64-conv-emu // flag is used. From b939aebb8a93a37883d1b0de4797cf0b31646cae Mon Sep 17 00:00:00 2001 From: "Cai, Justin" Date: Wed, 13 Nov 2024 14:56:01 -0800 Subject: [PATCH 2/4] Add additional test --- sycl/test-e2e/OptionalKernelFeatures/conv.cpp | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sycl/test-e2e/OptionalKernelFeatures/conv.cpp diff --git a/sycl/test-e2e/OptionalKernelFeatures/conv.cpp b/sycl/test-e2e/OptionalKernelFeatures/conv.cpp new file mode 100644 index 0000000000000..f440e1ae55844 --- /dev/null +++ b/sycl/test-e2e/OptionalKernelFeatures/conv.cpp @@ -0,0 +1,43 @@ +// REQUIRES: ocloc, linux, arch-intel_gpu_dg2_g10 + +// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t.out +// RUN: %{run} %t.out + +#include +using namespace sycl; + +template T op(T x) { return x + 1; } + +template int test(queue &q) { + double res[] = {1.}; + { + buffer buf(res, 1); + q.submit([&](handler &cgh) { + accessor acc(buf, cgh); + cgh.single_task([=] { acc[0] = op(acc[0]); }); + }).wait(); + } + double ref = 1.; + ref = op(ref); + if (res[0] != ref) { + std::cout << typeid(T).name() << " fail: got " << res[0] << ", expected " + << ref << "\n"; + return 1; + } + return 0; +} + +int main() { + int nfail = 0; + queue q; + + nfail += test(q); + nfail += test(q); + nfail += test(q); + if (q.get_device().has(aspect::fp64)) + nfail += test(q); + + if (nfail == 0) + std::cout << "success\n"; + return nfail; +} \ No newline at end of file From f6e2e794430f7c1401b22b2674724e9aa284a1bd Mon Sep 17 00:00:00 2001 From: "Cai, Justin" Date: Thu, 21 Nov 2024 01:21:09 +0000 Subject: [PATCH 3/4] Address review comments --- ...{fp64-conv-emu.cpp => fp64-conv-emu-1.cpp} | 0 .../{conv.cpp => fp64-conv-emu-2.cpp} | 29 ++++++++++++------- 2 files changed, 19 insertions(+), 10 deletions(-) rename sycl/test-e2e/OptionalKernelFeatures/{fp64-conv-emu.cpp => fp64-conv-emu-1.cpp} (100%) rename sycl/test-e2e/OptionalKernelFeatures/{conv.cpp => fp64-conv-emu-2.cpp} (50%) diff --git a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp similarity index 100% rename from sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp rename to sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp diff --git a/sycl/test-e2e/OptionalKernelFeatures/conv.cpp b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp similarity index 50% rename from sycl/test-e2e/OptionalKernelFeatures/conv.cpp rename to sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp index f440e1ae55844..ed069b69b4377 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/conv.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp @@ -6,21 +6,27 @@ #include using namespace sycl; -template T op(T x) { return x + 1; } +template struct Increment { + T operator()(T x) const { return x + 1; } +}; -template int test(queue &q) { +template struct IntCastThenIncrement { + int operator()(T x) const { return static_cast(x) + 1; } +}; + +template int test(queue &q) { double res[] = {1.}; { buffer buf(res, 1); q.submit([&](handler &cgh) { accessor acc(buf, cgh); - cgh.single_task([=] { acc[0] = op(acc[0]); }); + cgh.single_task([=] { acc[0] = Op()(acc[0]); }); }).wait(); } double ref = 1.; - ref = op(ref); + ref = Op()(ref); if (res[0] != ref) { - std::cout << typeid(T).name() << " fail: got " << res[0] << ", expected " + std::cout << typeid(Op).name() << " fail: got " << res[0] << ", expected " << ref << "\n"; return 1; } @@ -31,13 +37,16 @@ int main() { int nfail = 0; queue q; - nfail += test(q); - nfail += test(q); - nfail += test(q); + nfail += test>(q); + nfail += test>(q); + nfail += test>(q); + if (q.get_device().has(aspect::fp64)) - nfail += test(q); + nfail += test>(q); + + nfail += test>(q); if (nfail == 0) std::cout << "success\n"; return nfail; -} \ No newline at end of file +} From 59f8cb209e1da74401b1281ac7e08268f0beceb9 Mon Sep 17 00:00:00 2001 From: "Cai, Justin" Date: Thu, 21 Nov 2024 17:10:04 +0000 Subject: [PATCH 4/4] Add unsupported reason --- sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp | 1 + sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp | 2 ++ .../test/e2e_test_requirements/no-unsupported-without-info.cpp | 3 +-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp index 6d757429b5a2d..28ae4c88556e2 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp @@ -1,5 +1,6 @@ // REQUIRES: ocloc, gpu, linux, arch-intel_gpu_dg2_g10 // UNSUPPORTED: cuda, hip +// UNSUPPORTED-REASON: FP64 emulation is an Intel specific feature. // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t_opt.out // RUN: %{run} %t_opt.out diff --git a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp index ed069b69b4377..129dca7ec9b06 100644 --- a/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp +++ b/sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp @@ -1,4 +1,6 @@ // REQUIRES: ocloc, linux, arch-intel_gpu_dg2_g10 +// UNSUPPORTED: cuda, hip +// UNSUPPORTED-REASON: FP64 emulation is an Intel specific feature. // RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t.out // RUN: %{run} %t.out diff --git a/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp b/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp index ca458439cc4d0..43fddf498f370 100644 --- a/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp +++ b/sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp @@ -54,7 +54,7 @@ // tests to match the required format and in that case you should just update // (i.e. reduce) the number and the list below. // -// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 423 +// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 422 // // List of improperly UNSUPPORTED tests. // Remove the CHECK once the test has been properly UNSUPPORTED. @@ -323,7 +323,6 @@ // CHECK-NEXT: NonUniformGroups/opportunistic_group.cpp // CHECK-NEXT: NonUniformGroups/tangle_group.cpp // CHECK-NEXT: NonUniformGroups/tangle_group_algorithms.cpp -// CHECK-NEXT: OptionalKernelFeatures/fp64-conv-emu.cpp // CHECK-NEXT: OptionalKernelFeatures/is_compatible/is_compatible_with_aspects.cpp // CHECK-NEXT: OptionalKernelFeatures/large-reqd-work-group-size.cpp // CHECK-NEXT: OptionalKernelFeatures/no-fp64-optimization-declared-aspects.cpp