Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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,7 @@
// REQUIRES: ocloc, gpu, linux, aspect-fp64
// 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
// 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
52 changes: 52 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,52 @@
// 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> 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;
}
Loading