Feat/standalone infinirt hygon graph bridge#1402
Merged
Merged
Conversation
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.
voltjia
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
增加hygon的InfiniRT graph的支持
解决原来InfiniLM推理在hygon BW1000上double free的问题