Commit 8453f6c
Fix HIP grid overflow in expand_into_jagged_permute_cuda (#5906)
Summary:
Pull Request resolved: #5906
X-link: https://github.com/facebookresearch/FBGEMM/pull/2824
Apply the same `#ifdef USE_ROCM` cap pattern used in D104903707 /
D104937969 / parent diffs to the launch site in
`expand_into_jagged_permute_cuda` in `sparse_expand_into_jagged_permute.cu`.
The launch uses `dim3(kWarpSize=32, T_blocks=32)` (block size 1024) and
grid `cuda_calc_xblock_count(permute_size, 32)`. Once
`permute_size > 2^27 ≈ 134M`, total threads exceed the HIP `2^32`
limit and the launch is rejected on ROCm.
`expand_into_jagged_permute_kernel` already grid-strides over `t`
(line 27), so capping the grid is correctness-preserving.
The `#ifdef USE_ROCM / #else / #endif` selector keeps NVIDIA codegen
bit-identical and unconditionally caps on ROCm.
Same family of fix as:
- D104903707 (permute_1D_sparse_data — parent diff)
- D104937969 (permute_2D_sparse_data — parent diff)
Reviewed By: henrylhtsang
Differential Revision: D104951014
fbshipit-source-id: c8cd6ec332b8e0284d72e6da7f869def132a35831 parent 90f91ae commit 8453f6c
2 files changed
Lines changed: 97 additions & 3 deletions
File tree
- fbgemm_gpu
- src/sparse_ops
- test/jagged
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
Lines changed: 89 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
25 | 31 | | |
26 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
27 | 39 | | |
28 | 40 | | |
29 | 41 | | |
| |||
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
102 | 189 | | |
103 | 190 | | |
104 | 191 | | |
0 commit comments