Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
43 changes: 43 additions & 0 deletions sycl/test-e2e/OptionalKernelFeatures/conv.cpp
Original file line number Diff line number Diff line change
@@ -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 <sycl/detail/core.hpp>
using namespace sycl;

template <typename T> T op(T x) { return x + 1; }

template <typename T> 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<T>(acc[0]); });
}).wait();
}
double ref = 1.;
ref = op<T>(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<int>(q);
nfail += test<long>(q);
nfail += test<float>(q);
if (q.get_device().has(aspect::fp64))
nfail += test<double>(q);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also have test_conv or something, which would use a different op. Right now the op you have performs an operation directly on T. The new op should do static_cast<int>(x) + 1. test_conv<double> should be launched regardless of double support on a device and it should always work. For simplicity, op could be made a template argument of test, I guess.


if (nfail == 0)
std::cout << "success\n";
return nfail;
}
7 changes: 3 additions & 4 deletions sycl/test-e2e/OptionalKernelFeatures/fp64-conv-emu.cpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Loading