You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[SYCL] Host compilation failure for vec4 sqrt (likely other math functions as well) #43
#include <CL/sycl.hpp>
using namespace cl::sycl;
int main() {
queue q;
q.submit([&](handler &cgh) {
cgh.single_task<no_known_host_conversion>([=]() {
float4 f4{2.0};
auto res = cl::sycl::sqrt(f4);
});
});
q.wait();
return 0;
}
The host compilation fails using the above code as it cannot find sqrt overloads for cl::sycl::vec<float, 4> as it appears to default to std::sqrt for host rather than a vec4 implementation. This happens when compiling to fatbinary or compiling host/device separately (device compiles, host fails in this case).
Example error output:
../build/lib/clang/9.0.0/include/CL/sycl.hpp:27:
../build/lib/clang/9.0.0/include/CL/sycl/math.hpp:300:10: error: no matching function for call to 'sqrt'
return __sycl_std::sqrt(x);
^~~~~~~~~~~~~~~~
math_host_conflict.cpp:16:30: note: in instantiation of function template specialization 'cl::sycl::sqrt<cl::sycl::vec<float, 4> >' requested here
auto res = cl::sycl::sqrt(f4);
^
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:143:13: note: candidate function not viable: no known conversion from 'cl::sycl::vec<float, 4>' to 'double' for 1st
argument
__MATHCALL (sqrt,, (Mdouble __x));
^
/usr/include/math.h:273:25: note: expanded from macro '__MATHCALL'
__MATHDECL (Mdouble,function,suffix, args)
^
/usr/include/math.h:275:22: note: expanded from macro '__MATHDECL'
__MATHDECL_1(type, function,suffix, args);
^
/usr/include/math.h:283:31: note: expanded from macro '__MATHDECL_1'
extern type __MATH_PRECNAME(function,suffix) args __THROW
^
/usr/include/math.h:286:42: note: expanded from macro '__MATH_PRECNAME'
#define __MATH_PRECNAME(name,r) __CONCAT(name,r)
^
/usr/include/x86_64-linux-gnu/sys/cdefs.h:105:23: note: expanded from macro '__CONCAT'
#define __CONCAT(x,y) x ## y
^
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:463:3: note: candidate function not viable: no known conversion from 'cl::sycl::vec<float, 4>' to 'float'
for 1st argument
sqrt(float __x)
^
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:467:3: note: candidate function not viable: no known conversion from 'cl::sycl::vec<float, 4>' to
'long double' for 1st argument
sqrt(long double __x)
^
/usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/cmath:475:5: note: candidate template ignored: substitution failure [with _Tp = cl::sycl::vec<float, 4>]: no
type named '__type' in '__gnu_cxx::__enable_if<false, double>'
sqrt(_Tp __x)
^
1 error generated.
I believe this will fail for more than just vec4's and the sqrt function.
Activity
bader commentedon Mar 6, 2019
@agozillon, we have a fix for this issue.
Will upload the patch soon.
Thanks!
agozillon commentedon Mar 7, 2019
awesome, thank you guys for the quick fix!
bader commentedon May 22, 2019
@agozillon, this issue should have been fixed by #48.
Could you confirm that, please?
agozillon commentedon May 22, 2019
I can confirm that this is fixed and I am happy to close the issue if you are! Thank you.
bader commentedon May 22, 2019
@agozillon, thanks for confirmation.
[clang] SIGSEGV at DeduceTemplateArgumentsByTypeMatch
Add assertion in SubIndexOpLowering to ensure an entry type in a memr…
[lldb][TypeSystem] ForEach: Don't hold the TypeSystemMap lock across …
Revert "[Coro] [async] Disable inlining in async coroutine splitting …
Revert "[mlir][loops] Reland Refactor LoopFuseSiblingOp and support p…
Revert "[Clang][analyzer] replace Stmt* with ConstCFGElementRef in Sy…
Revert "[clang][bytecode] Check if block is initialized before invoki…
[LifetimeSafety] Read lifetimebound attribute on implicit 'this' from…