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 }}
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.
This function works when AccessorT::value_type is a scalar type but when AccessorT::value_type is a vec type such as cl::sycl::cl_uchar16, compiler errors occurred:
1> C:/Develop/TestSYCL/TestSYCL.cpp:36:9: error: no viable conversion from returned value of type 'unsigned char __attribute__((ext_vector_type(16)))' (vector of 16 'unsigned char' values) to function return type 'const cl::sycl::vec<unsigned char, 16>'
1> return (id[0] < range[0] && id[1] < range[1]) ? acc[id] : typename AccessorT::value_type();
1> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1> C:/Program Files/Codeplay/ComputeCpp/include\SYCL/vec.h:9461:3: note: candidate constructor not viable: no known conversion from 'unsigned char __attribute__((ext_vector_type(16)))' (vector of 16 'unsigned char' values) to 'const vec<unsigned char, 16> &' for 1st argument
1> vec(const vec<dataT, kElems> &rhs) {
1> ^
1> C:/Program Files/Codeplay/ComputeCpp/include\SYCL/vec.h:9437:3: note: candidate template ignored: could not match 'swizzled_vec<unsigned char, kElemsRhs, kIndexRhsN...>' against 'unsigned char __attribute__((ext_vector_type(16)))' (vector of 16 'unsigned char' values)
1> vec(const swizzled_vec<dataT, kElemsRhs, kIndexRhsN...> &rhs) {
I'm using ComputeCpp 0.5.0 with Visual Studio 2015.
Update: the following variations of the function do compile without errors:
template<typename AccessorT>
inlinetypename AccessorT::value_type guarded_read(AccessorT& acc, const sycl::id<2>& id)
{
auto range = acc.get_range();
if (id[0] < range[0] && id[1] < range[1])
return acc[id];
elsereturntypenameAccessorT::value_type();
}
Hi @wdx04, thanks very much for your bug report, it's very clear. I've managed to reproduce this, vectors are a rather complicated part of our implementation so occasionally problems like this will pop up. What I'm going to do is that on Monday, I'll make a bug internally for this, then we can start working on it. I don't think the fix will be finished next week, which means this might remain as it is for a little while. Is that a problem for you? I suppose that, since you have the two other versions that do work, you might be OK. One thing I've discovered is that it appears only to happen for the device compiler, the host can compile it just fine. Hopefully that can help us narrow down what the problem is.
Hi,
I created a template function to read from an accessor with id range check(when id is out of range, return a default-constructed value instead):
This function works when AccessorT::value_type is a scalar type but when AccessorT::value_type is a vec type such as cl::sycl::cl_uchar16, compiler errors occurred:
I'm using ComputeCpp 0.5.0 with Visual Studio 2015.
Update: the following variations of the function do compile without errors:
The text was updated successfully, but these errors were encountered: