Skip to content

Feat/standalone infinirt hygon graph bridge#1402

Merged
voltjia merged 2 commits into
issue/1373from
feat/standalone-infinirt-hygon-graph-bridge
Jul 21, 2026
Merged

Feat/standalone infinirt hygon graph bridge#1402
voltjia merged 2 commits into
issue/1373from
feat/standalone-infinirt-hygon-graph-bridge

Conversation

@gongchensu

Copy link
Copy Markdown
Collaborator

增加hygon的InfiniRT graph的支持
解决原来InfiniLM推理在hygon BW1000上double free的问题

The previous preload path opened Torch HIP libraries and flash_attn_2_cuda directly with ctypes. That bypassed Python extension initialization order and caused a reproducible double free during process teardown once the Hygon runtime context was active.

Import Torch and FlashAttention through Python's module machinery first, then promote the initialized FlashAttention extension with RTLD_GLOBAL and retain its handle. This preserves symbol visibility for dlsym-based Hygon operators while keeping module ownership and teardown under Python.

Keep the change scoped to the Hygon preload path; the MetaX HPCC loading behavior is unchanged.
Register the Hygon backend in centralized context initialization. Without this call, Hygon devices are absent from the runtime table, cuda device aliases cannot resolve to HYGON, and the InfiniRT C++ graph bridge has no active Hygon runtime to capture.

DeviceEnabled keeps the initialization compiled out for builds that do not include the Hygon backend.
@gongchensu gongchensu self-assigned this Jul 21, 2026
Comment thread src/infinicore/context/context_impl.cc
Comment thread src/infinicore/context/context_impl.cc
@voltjia
voltjia merged commit 7e1a1aa into issue/1373 Jul 21, 2026
0 of 10 checks passed
@voltjia
voltjia deleted the feat/standalone-infinirt-hygon-graph-bridge branch July 21, 2026 07:12
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.

3 participants