Commit 913c9c9
Apply ROCm grid-overflow cap hygiene to _float_to_fusednbitrowwise_cuda_kernel
Summary:
X-link: https://github.com/facebookresearch/FBGEMM/pull/2931
Tier-1 follow-up to D104903707 / D104937969 / D105282095 / D105286434
— apply the canonical ROCm grid-overflow cap to a `quantize_ops/`
launch site identified by the audit at:
`/home/bensonma415/.llms/plans/permute_metric_layout_etc_rocm_grid_overflow_audit.plan.md`
`_float_to_fusednbitrowwise_cuda_kernel` is launched with grid
`cuda_calc_xblock_count(nrows, 256)` and block `256`. The host fn
reads `const int nrows = input.size(0)`, so total threads are
naturally bounded below 2**31 by valid inputs (the int truncation
silently caps at INT_MAX rows). Thus this kernel cannot strictly
trigger HIP's 2**32 cap with valid input — **the cap added here is
defensive**, applied for hygienic consistency with the broader audit
and to match the canonical pattern from D104903707 / D104937969.
The kernel grid-strides over `row` (line 31), so the cap is
correctness-preserving regardless. NVIDIA codegen sees the host-side
`#ifdef USE_ROCM` block as a plain alias and remains a no-op delta
in PTX/SASS.
Reviewed By: henrylhtsang
Differential Revision: D105286713
fbshipit-source-id: 95f99caa203861b75b45a283f8aa83813ad1bc4e1 parent 2db16a8 commit 913c9c9
2 files changed
Lines changed: 69 additions & 3 deletions
File tree
- fbgemm_gpu
- src/quantize_ops
- test/quantize
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
144 | 145 | | |
145 | 146 | | |
146 | 147 | | |
147 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
34 | 39 | | |
35 | 40 | | |
36 | 41 | | |
| |||
412 | 417 | | |
413 | 418 | | |
414 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
415 | 475 | | |
416 | 476 | | |
417 | 477 | | |
0 commit comments