Repository navigation
fix(ck-tile): use __builtin_memcpy for buffer resource casts in device code - #13393
Merged
Merged
Conversation
1 task done
✅ All Checks Passed — Ready for Review
📖 Need help? See the Policy FAQ for details on every check and how to fix failures. |
|
🎉 All checks passed! This PR is ready for review. |
1 task
illsilin
approved these changes
Oct 10, 2026
illsilin
enabled auto-merge (squash)
October 10, 2026 01:46
assistant-librarian Bot
pushed a commit
to ROCm/composable_kernel
that referenced
this pull request
Oct 10, 2026
fix(ck-tile): use __builtin_memcpy for buffer resource casts in device code (#13393) ## Motivation `cast_to_amdgpu_buffer_rsrc_t` copies the buffer descriptor with `std::memcpy` inside a `CK_TILE_DEVICE` function. With the MSVC C runtime on Windows, `memcpy` has no device overload, so every ck_tile kernel that goes through the buffer addressing path fails to compile with `reference to __host__ function 'memcpy' in __device__ function`. This blocks CK tile kernels in downstream projects such as aiter on Windows. Fixes #10079 ## Technical Details Both definitions, in `amd_buffer_addressing.hpp` and `amd_buffer_addressing_builtins.hpp`, now use `__builtin_memcpy`, as `amd_wave_read_first_lane.hpp` already does. On Linux it lowers to the same intrinsic as before. This is the same change as #10067, which was closed as stale, without the added test scaffolding. ## Test Plan On Windows with gfx1200 and the ROCm 10.2 nightly, built a minimal HIP program that makes a wave buffer resource, casts it with `cast_to_amdgpu_buffer_rsrc_t`, and does one in-range and one out-of-range `raw_buffer_load`. Also rebuilt the aiter CK tile layernorm2d instances against the patched headers. ## Test Result Before the change the program and the layernorm instances fail to compile with the error above. After it, both build, the in-range load returns the expected value and the out-of-range load returns 0, so the descriptor's base address and `num_records` survive the copy. ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/TheRock/blob/main/GOVERNANCE.md#pull-requests. Co-authored-by: Illia Silin <98187287+illsilin@users.noreply.github.com>
This was referenced Oct 10, 2026
Closed
Merged
Merged
Closed
Contributor
TheRock Submodule Bump ActivityNewest first
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
cast_to_amdgpu_buffer_rsrc_tcopies the buffer descriptor withstd::memcpyinside aCK_TILE_DEVICEfunction. With the MSVC C runtime on Windows,memcpyhas no device overload, so every ck_tile kernel that goes through the buffer addressing path fails to compile withreference to __host__ function 'memcpy' in __device__ function. This blocks CK tile kernels in downstream projects such as aiter on Windows.Fixes #10079
Technical Details
Both definitions, in
amd_buffer_addressing.hppandamd_buffer_addressing_builtins.hpp, now use__builtin_memcpy, asamd_wave_read_first_lane.hppalready does. On Linux it lowers to the same intrinsic as before. This is the same change as #10067, which was closed as stale, without the added test scaffolding.Test Plan
On Windows with gfx1200 and the ROCm 10.2 nightly, built a minimal HIP program that makes a wave buffer resource, casts it with
cast_to_amdgpu_buffer_rsrc_t, and does one in-range and one out-of-rangeraw_buffer_load. Also rebuilt the aiter CK tile layernorm2d instances against the patched headers.Test Result
Before the change the program and the layernorm instances fail to compile with the error above. After it, both build, the in-range load returns the expected value and the out-of-range load returns 0, so the descriptor's base address and
num_recordssurvive the copy.Submission Checklist