Skip to content

[SYCL] Enable E2E test of fp64 conversion emulation #15923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// REQUIRES: ocloc, gpu, linux, aspect-fp64
// 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=spir64_gen -Xsycl-target-backend "-device pvc" -fsycl-fp64-conv-emu -O0 %s -o %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
Expand Down
54 changes: 54 additions & 0 deletions sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu-2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// 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

#include <sycl/detail/core.hpp>
using namespace sycl;

template <typename T> struct Increment {
T operator()(T x) const { return x + 1; }
};

template <typename T> struct IntCastThenIncrement {
int operator()(T x) const { return static_cast<int>(x) + 1; }
};

template <typename Op> int test(queue &q) {
double res[] = {1.};
{
buffer<double, 1> 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(Op).name() << " fail: got " << res[0] << ", expected "
<< ref << "\n";
return 1;
}
return 0;
}

int main() {
int nfail = 0;
queue q;

nfail += test<Increment<int>>(q);
nfail += test<Increment<long>>(q);
nfail += test<Increment<float>>(q);

if (q.get_device().has(aspect::fp64))
nfail += test<Increment<double>>(q);

nfail += test<IntCastThenIncrement<double>>(q);

if (nfail == 0)
std::cout << "success\n";
return nfail;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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: 382
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 381
//
// List of improperly UNSUPPORTED tests.
// Remove the CHECK once the test has been properly UNSUPPORTED.
Expand Down Expand Up @@ -282,7 +282,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
Expand Down
Loading