Repository navigation
Commit fbeb316
authored
[PyTorch] Fix fake kernel metadata mismatch for empty-input MoE permute ops (#3444)
Fix fake kernel metadata mismatch for empty-input MoE permute ops
For empty input, moe_permute (mask and index map) returned row_id_map
created with torch.tensor([]) (float32), while the registered fake
kernels declare int32 with different shapes. PyTorch >= 2.14 inductor
validates fallback output dtype metadata at runtime (pytorch#183731),
so torch.compile'd empty-input permute now errors with
'expected dtype torch.int32 but got torch.float32'.
Return correctly-typed empty tensors from the eager fast paths, align
the index-map fake output shape with the empty-input fast path, and
keep permuted_probs dtype consistent between eager and fake.
Add an empty-input test for the index map path.
Signed-off-by: Pawel Gadzinski <pgadzinski@nvidia.com>1 parent 4fba94a commit fbeb316
2 files changed
Lines changed: 32 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1705 | 1705 | | |
1706 | 1706 | | |
1707 | 1707 | | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
1708 | 1727 | | |
1709 | 1728 | | |
1710 | 1729 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
290 | 291 | | |
291 | 292 | | |
292 | 293 | | |
293 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
294 | 301 | | |
295 | 302 | | |
296 | 303 | | |
| |||
450 | 457 | | |
451 | 458 | | |
452 | 459 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 460 | + | |
458 | 461 | | |
459 | 462 | | |
460 | 463 | | |
| |||
0 commit comments