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
add kWarpSizeHost() for host-side launch configs (#6024)
Summary:
X-link: facebookresearch/FBGEMM#2934
Host-side launch configurations compute block/grid dims from `kWarpSize`. On ROCm, `kWarpSize` is a device-pass constant: during the host compilation pass it is a placeholder 64 (so `__global__` kernel bodies parse), which is wrong for sizing host-side `dim3` / grid quotients on a multi-arch wheel that runs on a wave32 arch (e.g. gfx1100), where the launch would use 64 lanes per warp instead of 32.
Add `kWarpSizeHost()` in `cuda_prelude.cuh`:
- CUDA: constexpr function returning 32 (usable as a template argument).
- ROCm: inline function returning `at::cuda::warp_size()`, a cached device-properties lookup of the active device's warp size.
Switch host-side `dim3` / quotient sites in the non-cache, non-TBE-codegen kernels (sparse, jagged, permute, quantize, input_combine, layout_transform, embedding_inplace, bounds_check) to `kWarpSizeHost()`. Device code keeps `kWarpSize`, which is per-arch correct via the device pass. Cache-geometry and TBE codegen sites are converted in later PRs in this chain.
Second in the chain splitting #5804 into reviewable pieces; stacked on #6014.
Authored with assistance from Claude (Anthropic).
Reviewed By: henrylhtsang
Differential Revision: D112414352
Pulled By: q10
0 commit comments