| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
GateUpPack_LinearLayer._tp_partition() ends with self.move(), which relocates the shard to get_accelerator().current_device_name(). The test then compares the reassembled shards against full_weight, which stays on CPU, so torch.equal() raises on any accelerator-backed machine: RuntimeError: Expected all tensors to be on the same device, but got other is on cpu, different from other tensors on cuda:0 Compare against full_weight on the shards' device. No-op on CPU-only runs. Signed-off-by: alanhuangyoo <alanhuangyoo@gmail.com>
There was a problem hiding this comment.
Thank you for the catch, @alanhuangyoo! Looks good to me.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
tests/unit/module_inject/test_fused_repartition.py::test_gate_up_partition_covers_the_whole_weight fails on any accelerator-backed machine:
GateUpPack_LinearLayer._tp_partition() finishes with self.move(_partition), and move() resolves its target as
so each shard comes back on the accelerator. full_weight is never moved, and torch.equal() refuses the cross-device comparison. The sibling test test_gate_up_partition_ignores_later_grain_size_changes compares two post-partition tensors, so both operands share a device and it passes — this is the only case in the file that mixes a partitioned tensor with the original.
This compares against full_weight on the shards' device instead. It is a no-op on CPU-only runs, which is why the test passes there.
Before, on master (8x H20, CUDA):
After:
pre-commit run --files tests/unit/module_inject/test_fused_repartition.py is clean.
The test was added in #8185 four days ago. It is not covered by the live CI: modal-torch-latest runs tests/unit/v1/ only, and the self-hosted GPU workflows that would run unit/ have not produced a run in a long time (nv-a6000 last ran 2025-08-01, nv-nightly 2026-01-15, nv-torch-latest-v100 and nv-inference have no runs listed).
Env: torch 2.13.0+cu130, H20 (sm90), single node.