Closed
Description
Hello!
Given that the -sycl-std=2020
switch is allowed and SYCL_LANGUAGE_VERSION
is set to 202001, one would expect that the provisional specs are supported.
I wasn't able to find details about any limitations related to the support for the SYCL 2020 standard in the current version of the compiler. Please, point me to such a document if it exists.
However, the following program, seemingly compliant with the specs, fails to compile with the latest sycl
branch (f58c568).
#include <iostream>
// Section 4.3 Header files and namespaces
#include <SYCL/sycl.hpp>
auto myKernel(cl::sycl::handler& cgh)
{
sycl::stream debug(10240, 128, cgh);
return [=](cl::sycl::nd_item<1> itemIdx) {
if (itemIdx.get_global_linear_id() == 0) {
// Section 4.10.1.8 sub_group class
sycl::sub_group sg = itemIdx.get_sub_group();
float f = 0;
// Section 4.19.5.4 group_reduce
f = sycl::group_reduce(sg, f, sycl::plus<float>{});
debug << " Sub_group range: " << sg.get_local_range()[0] << cl::sycl::endl;
}
};
}
constexpr int numBlocks = 8;
constexpr int blockSize = 16;
int main()
{
cl::sycl::device dev(cl::sycl::gpu_selector{});
cl::sycl::queue q{dev};
std::cout << "Running 1D kernel" << std::endl;
const cl::sycl::nd_range<1> range1D{ { numBlocks * blockSize }, { blockSize } };
q.submit([&](cl::sycl::handler& cgh) {
auto kernel = myKernel(cgh);
// Section 4.14.2 Defining kernels as lambda functions
cgh.parallel_for(range1D, kernel);
}).wait_and_throw();
std::cout << " Done" << std::endl;
return 0;
}
Compilation options: clang++ -fsycl -sycl-std=2020 ./sycl_2020.cpp -o sycl_2020
.
References to specific parts of SYCL2020 provisional specs that are apparently missing:
- Section 4.3: The include should be
SYCL/sycl.hpp
, but onlyCL/sycl.hpp
is available. - Section 4.14.2: Providing a name for lambda-kernel must be optional, but requires
-fsycl-unnamed-lambda
to work. - Section 4.10.1.8: There should be
sycl::sub_group
class, but onlysycl::ONEAPI::sub_group
is available. - Section 4.19.5.4: There should be
sycl::group_reduce
function, but onlysycl::ONEAPI::reduce
is available. - Section 4.19.3: There should be
sycl::plus
functor, but onlysycl::ONEAPI::plus
is available.
Metadata
Metadata
Assignees
Labels
No labels