Skip to content

Commit 86376a8

Browse files
authored
[SYCL] Enable E2E test of fp64 conversion emulation (#15923)
1 parent 48730da commit 86376a8

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp renamed to sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-1.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// REQUIRES: ocloc, gpu, linux, aspect-fp64
1+
// REQUIRES: ocloc, gpu, linux, arch-intel_gpu_dg2_g10
22
// UNSUPPORTED: cuda, hip
3+
// UNSUPPORTED-REASON: FP64 emulation is an Intel specific feature.
34

4-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend "-device pvc" -fsycl-fp64-conv-emu -O0 %s -o %t_opt.out
5+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t_opt.out
56
// RUN: %{run} %t_opt.out
67

78
// Tests that aspect::fp64 is not emitted correctly when -fsycl-fp64-conv-emu
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// REQUIRES: ocloc, linux, arch-intel_gpu_dg2_g10
2+
// UNSUPPORTED: cuda, hip
3+
// UNSUPPORTED-REASON: FP64 emulation is an Intel specific feature.
4+
5+
// RUN: %clangxx -fsycl -fsycl-targets=intel_gpu_dg2_g10 -fsycl-fp64-conv-emu -O0 %s -o %t.out
6+
// RUN: %{run} %t.out
7+
8+
#include <sycl/detail/core.hpp>
9+
using namespace sycl;
10+
11+
template <typename T> struct Increment {
12+
T operator()(T x) const { return x + 1; }
13+
};
14+
15+
template <typename T> struct IntCastThenIncrement {
16+
int operator()(T x) const { return static_cast<int>(x) + 1; }
17+
};
18+
19+
template <typename Op> int test(queue &q) {
20+
double res[] = {1.};
21+
{
22+
buffer<double, 1> buf(res, 1);
23+
q.submit([&](handler &cgh) {
24+
accessor acc(buf, cgh);
25+
cgh.single_task([=] { acc[0] = Op()(acc[0]); });
26+
}).wait();
27+
}
28+
double ref = 1.;
29+
ref = Op()(ref);
30+
if (res[0] != ref) {
31+
std::cout << typeid(Op).name() << " fail: got " << res[0] << ", expected "
32+
<< ref << "\n";
33+
return 1;
34+
}
35+
return 0;
36+
}
37+
38+
int main() {
39+
int nfail = 0;
40+
queue q;
41+
42+
nfail += test<Increment<int>>(q);
43+
nfail += test<Increment<long>>(q);
44+
nfail += test<Increment<float>>(q);
45+
46+
if (q.get_device().has(aspect::fp64))
47+
nfail += test<Increment<double>>(q);
48+
49+
nfail += test<IntCastThenIncrement<double>>(q);
50+
51+
if (nfail == 0)
52+
std::cout << "success\n";
53+
return nfail;
54+
}

sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
// tests to match the required format and in that case you should just update
5555
// (i.e. reduce) the number and the list below.
5656
//
57-
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 382
57+
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 381
5858
//
5959
// List of improperly UNSUPPORTED tests.
6060
// Remove the CHECK once the test has been properly UNSUPPORTED.
@@ -282,7 +282,6 @@
282282
// CHECK-NEXT: NonUniformGroups/opportunistic_group.cpp
283283
// CHECK-NEXT: NonUniformGroups/tangle_group.cpp
284284
// CHECK-NEXT: NonUniformGroups/tangle_group_algorithms.cpp
285-
// CHECK-NEXT: OptionalKernelFeatures/fp64-conv-emu.cpp
286285
// CHECK-NEXT: OptionalKernelFeatures/is_compatible/is_compatible_with_aspects.cpp
287286
// CHECK-NEXT: OptionalKernelFeatures/large-reqd-work-group-size.cpp
288287
// CHECK-NEXT: OptionalKernelFeatures/no-fp64-optimization-declared-aspects.cpp

0 commit comments

Comments
 (0)