-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL][LIBCLC] Change __clc_size_t to unsigned (#4784)
This changes the `__clc_size_t` from a signed 64-bit int to an unsigned 64-bit int. The change results in the correct mangled name for `GroupAsyncCopy` built-ins. This is a proposed solution to issue #4502
- Loading branch information
1 parent
701e480
commit c2ccc43
Showing
2 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o - | ||
|
||
// Test checks for that no compile errors occur for | ||
// builtin async_work_group_copy | ||
#include <sycl/sycl.hpp> | ||
|
||
using namespace cl::sycl; | ||
|
||
// Define the number of work items to enqueue. | ||
const size_t NElems = 32; | ||
const size_t WorkGroupSize = 8; | ||
const size_t NWorkGroups = NElems / WorkGroupSize; | ||
|
||
template <typename T> void async_work_group_test() { | ||
queue Q; | ||
|
||
buffer<T, 1> InBuf(NElems); | ||
buffer<T, 1> OutBuf(NElems); | ||
|
||
Q.submit([&](handler &CGH) { | ||
auto In = InBuf.template get_access<access::mode::read>(CGH); | ||
auto Out = OutBuf.template get_access<access::mode::write>(CGH); | ||
accessor<T, 1, access::mode::read_write, access::target::local> Local( | ||
range<1>{WorkGroupSize}, CGH); | ||
|
||
nd_range<1> NDR{range<1>(NElems), range<1>(WorkGroupSize)}; | ||
CGH.parallel_for(NDR, [=](nd_item<1> NDId) { | ||
auto GrId = NDId.get_group_linear_id(); | ||
auto Group = NDId.get_group(); | ||
size_t Offset = GrId * WorkGroupSize; | ||
auto E = NDId.async_work_group_copy( | ||
Local.get_pointer(), In.get_pointer() + Offset, WorkGroupSize); | ||
E = NDId.async_work_group_copy(Out.get_pointer() + Offset, | ||
Local.get_pointer(), WorkGroupSize); | ||
}); | ||
}).wait(); | ||
} | ||
|
||
template <typename T> void test() { | ||
async_work_group_test<T>(); | ||
async_work_group_test<vec<T, 2>>(); | ||
async_work_group_test<vec<T, 3>>(); | ||
async_work_group_test<vec<T, 4>>(); | ||
async_work_group_test<vec<T, 8>>(); | ||
async_work_group_test<vec<T, 16>>(); | ||
async_work_group_test<detail::make_unsigned_t<T>>(); | ||
async_work_group_test<vec<detail::make_unsigned_t<T>, 2>>(); | ||
async_work_group_test<vec<detail::make_unsigned_t<T>, 3>>(); | ||
async_work_group_test<vec<detail::make_unsigned_t<T>, 4>>(); | ||
async_work_group_test<vec<detail::make_unsigned_t<T>, 8>>(); | ||
async_work_group_test<vec<detail::make_unsigned_t<T>, 16>>(); | ||
} | ||
|
||
int main() { | ||
test<int8_t>(); | ||
test<int16_t>(); | ||
test<int32_t>(); | ||
test<int64_t>(); | ||
test<cl::sycl::cl_half>(); | ||
test<float>(); | ||
test<double>(); | ||
return 1; | ||
} |