Skip to content

[SYCL-PTX] Fix __spirv_GroupAsyncCopy #1451

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions libclc/generic/libspirv/async/async_work_group_strided_copy.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@
//
//===----------------------------------------------------------------------===//

#define STRIDED_COPY(DST_AS, SRC_AS, DST_STRIDE, SRC_STRIDE) \
size_t size = __spirv_LocalInvocationId_x() * \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand correctly that hang happens because size can computed to 0 for some of the work items?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the update from ocl to spir-v inadvertently changed the step computation from "getting the workgroup size" to "mixing up all local ids". This bug was hidden so far as it relied on a header implementation (removed with #1384).

__spirv_LocalInvocationId_y() * \
__spirv_LocalInvocationId_z(); \
size_t id = (__spirv_WorkgroupSize_y() * __spirv_WorkgroupSize_z() * \
__spirv_LocalInvocationId_x()) + \
(__spirv_WorkgroupSize_z() * \
__spirv_LocalInvocationId_y()) + \
__spirv_LocalInvocationId_z(); \
size_t i; \
\
for (i = id; i < num_gentypes; i += size) { \
dst[i * DST_STRIDE] = src[i * SRC_STRIDE]; \
#define STRIDED_COPY(DST_AS, SRC_AS, DST_STRIDE, SRC_STRIDE) \
size_t size = __spirv_WorkgroupSize_x() * __spirv_WorkgroupSize_y() * \
__spirv_WorkgroupSize_z(); \
size_t id = (__spirv_WorkgroupSize_y() * __spirv_WorkgroupSize_x() * \
__spirv_LocalInvocationId_z()) + \
(__spirv_WorkgroupSize_x() * __spirv_LocalInvocationId_y()) + \
__spirv_LocalInvocationId_x(); \
size_t i; \
\
for (i = id; i < num_gentypes; i += size) { \
dst[i * DST_STRIDE] = src[i * SRC_STRIDE]; \
}

_CLC_OVERLOAD _CLC_DEF event_t
Expand Down