Skip to content

feat(metax): add graph capture and replay support#31

Open
gongchensu wants to merge 5 commits into
InfiniTensor:masterfrom
gongchensu:feat/metax-infinirt-graph
Open

feat(metax): add graph capture and replay support#31
gongchensu wants to merge 5 commits into
InfiniTensor:masterfrom
gongchensu:feat/metax-infinirt-graph

Conversation

@gongchensu

@gongchensu gongchensu commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add MetaX graph capture and replay support by adapting the MC stream and graph APIs in src/native/cuda/metax/runtime_.h.
  • Reuse the shared GraphRuntime implementation and adapt the five-argument mcGraphInstantiate signature.
  • Add native MetaX graph coverage in tests/CMakeLists.txt and update docs/backends.md.

Motivation

MetaX MC runtime provides stream capture and graph execution APIs, but InfiniRT did not expose them through its graph runtime abstraction. This prevented downstream users such as InfiniCore and InfiniLM from using the InfiniRT graph capture and replay path on MetaX devices.

Related issue: N/A - this change is not associated with an existing issue.

Type of Change

  • feat - new feature / new backend capability / new public API
  • fix - bug fix
  • perf - performance improvement without behavior 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)
  • Hygon (WITH_HYGON)
  • MetaX (WITH_METAX)
  • Moore (WITH_MOORE)
  • Cambricon (WITH_CAMBRICON)
  • Ascend (WITH_ASCEND)
  • Build system / CMake / generated headers
  • Public headers / installed consumer API
  • Documentation only

Smoke Build and Test Result

paste smoke build and test output here

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
CPU
NVIDIA
Iluvatar
Hygon
MetaX
Moore
Cambricon
Ascend
Full `ctest` output (optional)
paste here

Benchmark / Performance Impact

Notes for Reviewers

@gongchensu gongchensu self-assigned this Jul 16, 2026
@gongchensu
gongchensu requested a review from voltjia July 16, 2026 03:20
Distinguish HPCC and MACA SDK signals during automatic backend selection. Reject ambiguous hosts unless WITH_MARS or WITH_METAX is selected explicitly, while preserving PCI fallback when neither SDK is present.

Expose Mars through installed package consumer metadata, document the device selection rules, and cover dual-SDK detection with a CMake regression test.

@voltjia voltjia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 PR 最好是拆成两个,一个专门适配 MetaX 的,另一个是添加 Mars 的。然后我看原先沐曦的内容是在 cuda 下面,现在都被移动到了 maca 下面,而且添加了新的 runtime_.h,目前先不这么做,之前是特地把所有类 CUDA 平台都放到了 cuda 下面,所以按理说应该也不用添加新的 runtime_.h,这一点对于 Mars 应该也一样,否则要是按这么说的话,摩尔也得挪到 musa 下面了。除此之外,我看代码中有不少 ”ambiguous“ 字眼,说是 MetaX 和 Mars 互相分不清,其实恰恰是分的很清楚,所以咱们才完全拆开,所以按理说不需要类似的内容。还有些格式化的内容,原本存在的一些空行啥的我看给删了,这种改动非必要的话都先不做,保证 PR 的小化。

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