Skip to content

fix: accept PyTorch 2.11 extension path query arguments - #110

Draft
yeahdongcn wants to merge 1 commit into
mainfrom
xd/inductor-cpp-path-signatures
Draft

fix: accept PyTorch 2.11 extension path query arguments#110
yeahdongcn wants to merge 1 commit into
mainfrom
xd/inductor-cpp-path-signatures

Conversation

@yeahdongcn

Copy link
Copy Markdown
Collaborator

Summary

Support modern PyTorch extension path discovery without dropping legacy CUDA-call compatibility:

  • Accept include_paths(device_type, torch_include_dirs).
  • Accept library_paths(device_type, torch_include_dirs, cross_target_platform) including keyword calls.
  • Retain legacy positional CUDA booleans, (cuda_bool, device_name), cuda=..., device-name precedence and the legacy default CPU library result.
  • Respect explicit Torch-path inclusion/exclusion and forward supported options on non-MUSA Torch versions.
  • Reject unsupported MUSA cross-target discovery explicitly.

This fixes a real Inductor CPU-helper compilation failure during regional MUSA Graph bring-up: include_paths("cpu", False) was bound to (cuda, device_type), causing False.lower().

Tests

  • Changed-file pre-commit hooks: pass.
  • 17 CPU-only contract cases: pass (mocked MUSA and old/new native API signatures).
  • Cold-cache CPU Inductor compilation plus numerical check on torch/torch_musa 2.11.0.post1+musa5.2.0: pass using the full-Torch CPU helper ABI.

The runtime test applied only these path-helper definitions to the existing torchada 0.1.83 image, preserving its other patches and tuning configs. The test used a fresh TORCHINDUCTOR_CACHE_DIR.

Scope / remaining validation

The tested MUSA build still emits the full Torch CPU prefix, so its first-build smoke requires torch._inductor.config.aot_inductor.link_libtorch = None before compilation. The default header-only mode exposed a separate missing-header issue after this signature error was fixed. This PR does not change that provider/compiler behavior or claim the default header-only mode now works.

Full MAGI-2 MUSA Graph validation is ongoing. No attention, MoE kernel, model quantization, or serving parallelism changes are included here.

Signed-off-by: Xiaodong Ye <xiaodong.ye@mthreads.com>
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.

1 participant