Commit 2db16a8
Add grid-stride + ROCm cap to keyed_jagged_index_select_dim1_kernel and keyed_jagged_index_add_dim1_kernel; fast-fail TORCH_CHECK for index_select_scalar_cumsum_kernel (#6025)
Summary:
Pull Request resolved: #6025
X-link: https://github.com/facebookresearch/FBGEMM/pull/2930
Diff 10/10 (final) of the Tier-2 ROCm grid-overflow fix stack.
Three kernels in keyed_jagged_index_select_dim1.cu need attention:
- keyed_jagged_index_select_dim1_kernel (forward) and
keyed_jagged_index_add_dim1_kernel (backward) both used flat
if (tid < N) predication. This diff wraps each in an explicit int64_t
grid-stride for-loop and adds the standard #ifdef USE_ROCM host-side cap
on grid_size at both launch sites.
- index_select_scalar_cumsum_kernel is a cross-block prefix-sum with
block_flags / block_sums coordination. Capping the grid would corrupt the
cumsum. Instead, this diff adds a fast-fail TORCH_CHECK on the host side
before the launch, requiring num_output_lengths < 2^32. The full
algorithmic restructure (per-segment block tiling or two-pass scan via
cub::DeviceScan) is tracked as a Tier-3 follow-up.
Reviewed By: henrylhtsang
Differential Revision: D105205634
fbshipit-source-id: 852630d2c4d3e9ad5e3843b5031443ca997239431 parent c32d210 commit 2db16a8
2 files changed
Lines changed: 122 additions & 6 deletions
File tree
- fbgemm_gpu
- src/jagged_tensor_ops
- test/jagged
Lines changed: 38 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | 172 | | |
174 | 173 | | |
175 | 174 | | |
176 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
177 | 181 | | |
178 | 182 | | |
179 | 183 | | |
| |||
220 | 224 | | |
221 | 225 | | |
222 | 226 | | |
223 | | - | |
224 | 227 | | |
225 | 228 | | |
226 | 229 | | |
227 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
228 | 236 | | |
229 | 237 | | |
230 | 238 | | |
| |||
278 | 286 | | |
279 | 287 | | |
280 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
281 | 303 | | |
282 | 304 | | |
283 | 305 | | |
| |||
453 | 475 | | |
454 | 476 | | |
455 | 477 | | |
456 | | - | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
457 | 484 | | |
458 | 485 | | |
459 | 486 | | |
| |||
633 | 660 | | |
634 | 661 | | |
635 | 662 | | |
636 | | - | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
637 | 669 | | |
638 | 670 | | |
639 | 671 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
350 | 434 | | |
351 | 435 | | |
352 | 436 | | |
0 commit comments