Skip to content

Add MUSA graph-safe op overrides and torch.load map_location translation - #105

Open
froststeam wants to merge 4 commits into
MooreThreads:mainfrom
froststeam:musa-torch-load-map-location
Open

Add MUSA graph-safe op overrides and torch.load map_location translation#105
froststeam wants to merge 4 commits into
MooreThreads:mainfrom
froststeam:musa-torch-load-map-location

Conversation

@froststeam

@froststeam froststeam commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • translate CUDA device strings passed to torch.load(..., map_location=...) to MUSA devices on MUSA platforms
  • add graph-safe MUSA PrivateUse1 overrides for aten::multinomial, aten::log, and aten::log_
  • bump package references from 0.1.83 to 0.1.84

Notes

  • map_location dict source keys are kept unchanged so serialized CUDA storage tags still match; only target devices are translated.
  • The new op overrides are gated by the existing TORCHADA_DISABLE_OP_OVERRIDE_<OP_NAME>=1 mechanism.
  • MUSA op tests use torch.musa.is_available() because torch.cuda.is_available() remains false in this torchada CUDA-compatible setup, while CUDA device strings still map to MUSA tensors.

MUSA Test

Environment:

  • host: 10.20.35.93, GPU: 2 (MUSA_VISIBLE_DEVICES=2, MTHREADS_VISIBLE_DEVICES=2)
  • image: registry.mthreads.com/mcconline/inference/sglang:v0.5.12.post1-ph1-4.3.5-torch2.9.0-latest
  • torch: 2.9.0
  • torch.version.musa: 40305
  • torch_musa: 2.9.0+571893f
  • torchada from PR branch: 0.1.84
  • torchada.is_musa_platform() == True
  • torch.musa.is_available() == True, torch.musa.device_count() == 1
  • torch.empty(1, device="cuda").device == musa:0

Command:

cd /tmp/torchada-pr105
MUSA_VISIBLE_DEVICES=2 MTHREADS_VISIBLE_DEVICES=2 PYTHONPATH=src \
  pytest -q tests/test_device_strings.py tests/test_log.py tests/test_multinomial.py

Result:

51 passed in 9.88s

Local Check

  • git diff --check

@froststeam froststeam changed the title Translate torch.load map_location on MUSA Add MUSA graph-safe op overrides and torch.load map_location translation Aug 21, 2026
Comment thread src/torchada/csrc/musa_ops.mu Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants