Skip to content

fix(mars): enable torch bindings and CONTRIBUTING smoke - #3

Closed
Ceng23333 wants to merge 1 commit into
feat/mars-native-kernelsfrom
feat/mars-torch-smoke
Closed

Ceng23333 wants to merge 1 commit into
feat/mars-native-kernelsfrom
feat/mars-torch-smoke

Conversation

@Ceng23333

@Ceng23333 Ceng23333 commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Compile Mars torch unity sources with system g++ + -DUSE_HPCC=1 / HPCC includes (same MetaX/Moore pattern for vendor-forked torch headers).
  • Add TorchDeviceName<Device::Type::kMars>"cuda" in src/torch/device_.h and src/torch/mars/c10.h stream helpers.
  • Extend scripts/generate_torch_ops.py (kMars in _DEVICE_TYPES / _C10_DEVICE_TYPES) and hand-written torch instantiations under src/torch/ops/*/.
  • Ignore htcc sibling symlinks (*.cc.cu) in .gitignore.

Motivation

CONTRIBUTING smoke (pip install .[dev] + pytest -m smoke) needs Python bindings and Mars torch device mapping. Keep that plumbing out of the kernel PR (InfiniTensor#942).

Depends on InfiniTensor#942 (kernels) and InfiniTensor#941 (platform).

Type of Change

  • feat — new feature / new operator / new platform
  • fix — bug fix
  • perf — performance improvement (no behavioral change)
  • refactor — code restructuring without behavior change
  • test — adding or fixing tests only
  • docs — documentation only
  • build / ci — build system or CI configuration
  • chore — tooling, formatting, or other non-code changes
  • Breaking change (requires a ! in the Conventional Commits prefix or a BREAKING CHANGE: footer)

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Note: Mars / HPCC (WITH_MARS) — torch bindings / CONTRIBUTING smoke enablement.

Smoke Test Result

Host: MetaX X203 / HPCC, container infinilm-dev-refactor-dev (/opt/conda torch 2.8.0+mars, HPCC).
Branch feat/mars-torch-smoke (stack tip). INFINI_RT_ROOT = InfiniLM Mars integration prefix.

python -m pip install .[dev] --no-build-isolation --no-deps \
  --config-settings=cmake.define.INFINI_RT_ROOT=/workspace/InfiniLM/build/integration/mars/prefix \
  --config-settings=cmake.define.WITH_MARS=ON \
  --config-settings=cmake.define.INFINI_OPS_SMOKE_BUILD=ON
# Successfully built InfiniOps (cp310-linux_aarch64); install exit 0

python -m pytest tests -m smoke -q --devices cuda
# 92 passed, 35 skipped, 6235 deselected in 7.59s

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
NVIDIA no N/A - not affected
Iluvatar no N/A - not affected
MetaX no N/A - not affected
Cambricon no N/A - not affected
Moore no N/A - not affected
Ascend no N/A - not affected
Mars/HPCC (WITH_MARS) yes pip smoke + pytest -m smoke passed (92 passed, 35 skipped) --devices cuda (Mars torch). Skips are N/A/env/other-backend or missing Mars ports (cast/cat/linear/matmul), not regressions.
Full `pytest` output (optional)
s......ssssssssss....ssssssss........................................... [ 62%]
......................ssss.......s..........                             [100%]
92 passed, 35 skipped, 6235 deselected in 7.59s

Benchmark / Performance Impact

N/A

Notes for Reviewers

Compile Mars torch sources with system g++ (USE_HPCC), map
TorchDeviceName to cuda, and instantiate Mars torch backends.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Ceng23333

Copy link
Copy Markdown
Owner Author

@Ceng23333 Ceng23333 closed this Aug 24, 2026
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