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
Certain choices for the optional template parameter typename KernelName for parallel_for cause compilation error.
To reproduce
Minimal modification of the basic example from SYCL Basic Code: parallel_for is sufficient: Replace parallel_for by parallel_for<kname> with specific type for kname. Full code:
// example.cxx
#include <CL/sycl.hpp>
#include <cstdint>
template <std::uint8_t N>
struct Something {};
using kname = Something<34>; // problem
//using kname = Something<11>; // no problem for other values
using namespace sycl;
int main() {
queue Q;
int const size = 10;
buffer<int> A{ size };
Q.submit([&](handler& h) {
accessor A_acc(A, h);
h.parallel_for<kname>(range<1>(size), [=](id<1> indx) {
A_acc[indx] = 77;
});
});
host_accessor result(A);
for (int i = 0; i < size; i++)
std::cout << result[i] << " "; std::cout << "\n";
return 0;
}
Compilation via icpx -fsycl example.cxx reproduces the error
In file included from <built-in>:1:
/tmp/icpx-9fdd42b796/example-header-ab166a.h:65:63: warning: missing terminating ' character [-Winvalid-pp-token]
65 | return "::sycl::detail::__pf_kernel_wrapper<::Something<'"'>>";
| ^
/tmp/icpx-9fdd42b796/example-header-ab166a.h:65:63: error: expected ';' after return statement
65 | return "::sycl::detail::__pf_kernel_wrapper<::Something<'"'>>";
| ^
| ;
/tmp/icpx-9fdd42b796/example-header-ab166a.h:112:27: warning: missing terminating ' character [-Winvalid-pp-token]
112 | return "::Something<'"'>";
| ^
/tmp/icpx-9fdd42b796/example-header-ab166a.h:112:27: error: expected ';' after return statement
112 | return "::Something<'"'>";
| ^
| ;
Then, I guess the value of 34 corresponding to the character " causes the compiler generated header /tmp/icpx-9fdd42b796/example-header-ab166a.h to contain these syntax errors: e.g., return "::Something<'"'>"; which should rather be return "::Something<'\"'>";.
The text was updated successfully, but these errors were encountered:
Describe the bug
Certain choices for the optional template parameter
typename KernelName
forparallel_for
cause compilation error.To reproduce
Minimal modification of the basic example from SYCL Basic Code: parallel_for is sufficient: Replace
parallel_for
byparallel_for<kname>
with specific type forkname
. Full code:Compilation via
icpx -fsycl example.cxx
reproduces the errorSee also https://www.godbolt.org/z/scWTq48a6
Environment
2022.2.0
and newer reproduce this error2022.1.0
and older don't reproduce this errorAdditional context
Suspected cause: According to cppref
Then, I guess the value of
34
corresponding to the character"
causes the compiler generated header/tmp/icpx-9fdd42b796/example-header-ab166a.h
to contain these syntax errors: e.g.,return "::Something<'"'>";
which should rather bereturn "::Something<'\"'>";
.The text was updated successfully, but these errors were encountered: