Commit 315db02
authored
Fix convert_to_rows dropping the trailing column at a tile boundary (#4493)
## Summary
- `detail::determine_tiles` had an off-by-one in how it accounts for the
first column of a new tile after the running tile is closed mid-loop.
When the shmem-budget threshold happened to fire on the very last column
of the table, the tail-close at the end of the loop was skipped and that
column was never emitted to the kernel. `rmm::device_buffer` is not
zero-initialized, so the dropped column read back whatever the pool
allocator had there — typically 0, occasionally stale — yielding the
non-deterministic `b = 0` failures tracked in NVIDIA/spark-rapids#10062.
- Fix: set `current_tile_width = 1` after the reset. `col` is the first
(and so far only) column of the new tile.
- Add `ColumnToRowTests.PivotLikeLayout` that reproduces the failing
schema (191 INT64 + 1 INT32). It reads the trailing INT32 from the raw
JCUDF bytes directly rather than round-tripping through
`convert_from_rows`, which would mask the bug by using the same layout
code on the read side.
The failing pivot schema packs to exactly 192 columns; with the default
48 KB shmem budget and `tile_height = 32`, the 191 Longs fit in one tile
(`1528 * 32 = 48896 ≤ 49136`) and adding the trailing Int tips the
estimate to `1536 * 32 = 49152 > 49136`, firing the threshold on the
last column — the shape required to hit this bug. The existing
`convert_to_rows` tests all use uniform-size schemas, so the threshold
either fired early (leaving later columns to re-increment the width) or
never fired; none reached the "threshold fires on the last column" path.
Related to NVIDIA/spark-rapids#10062.
## Test plan
- [x] `ROW_CONVERSION` gtest, including the new
`ColumnToRowTests.PivotLikeLayout`, passes
- [x] With this fix applied and the `isAcceleratedTransposeSupported`
workaround reverted in spark-rapids, the
`test_hash_multiple_grpby_pivot` integration test passes under
`DATAGEN_SEED=1702610203`
---------
Signed-off-by: Haoyang Li <haoyangl@nvidia.com>1 parent 83f4a14 commit 315db02
2 files changed
Lines changed: 62 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1733 | 1733 | | |
1734 | 1734 | | |
1735 | 1735 | | |
1736 | | - | |
| 1736 | + | |
1737 | 1737 | | |
1738 | 1738 | | |
1739 | 1739 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
437 | 439 | | |
438 | 440 | | |
439 | 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 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
440 | 500 | | |
441 | 501 | | |
442 | 502 | | |
| |||
0 commit comments