Closed
Description
Hi,
I was wondering if anyone would be happy to explain why the following code,
#include <iostream>
#include <sycl/sycl.hpp>
int main(int argc, char** argv) {
sycl::queue queue{};
int c = -9;
{
sycl::buffer buf(&c, sycl::range(1));
queue.submit([&] (sycl::handler& cgh) {
sycl::accessor acc(buf, cgh, sycl::read_write);
cgh.single_task([=] () {
acc[0] = std::abs(acc[0]);
});
});
}
std::cout << c << std::endl;
}
does not compile for AMD GPUs:
clang++ -fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx90a -o abs abs.cc
lld: error: undefined hidden symbol: abs
>>> referenced by lto.tmp:(typeinfo name for main::'lambda'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::'lambda'())
>>> referenced by lto.tmp:(typeinfo name for main::'lambda'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::'lambda'())
llvm-foreach:
clang++: error: amdgcn-link command failed with exit code 1 (use -v to see invocation)
I'm pretty sure this is because we don't support CXX standard library functions for the HIP backend...
But then, why/how does replacing the type declaration with double c = -9;
work?
Thank you,
-Nuno