Skip to content

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

Merged
voltjia merged 4 commits into
InfiniTensor:masterfrom
Ceng23333:feat/mars-torch-smoke
Aug 24, 2026
Merged

fix(mars): enable torch bindings and CONTRIBUTING smoke#943
voltjia merged 4 commits into
InfiniTensor:masterfrom
Ceng23333:feat/mars-torch-smoke

Conversation

@Ceng23333

@Ceng23333 Ceng23333 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

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 (#942).

Depends on #942 (kernels) and #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

Ceng23333 and others added 4 commits August 24, 2026 10:01
Enable HPCC/Mars CMake detection, htcc compile wrapper, and device
registration without Mars operator specializations.
Defer WITH_MARS torch host compilation to the smoke follow-up PR.

Co-authored-by: Cursor <cursoragent@cursor.com>
Thin Operator<…, kMars> wrappers under src/native/cuda/mars/ mirroring
metax, reusing shared native/cuda/ops kernels plus HCBLAS gemm glue.

Co-authored-by: Cursor <cursoragent@cursor.com>
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>
@voltjia
voltjia merged commit 997ac66 into InfiniTensor:master Aug 24, 2026
14 of 18 checks passed
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