Skip to content

refactor!: support modern InfiniLM execution - #50

Open
gongchensu wants to merge 3 commits into
masterfrom
refactor/modern-infini-stack-review
Open

gongchensu wants to merge 3 commits into
masterfrom
refactor/modern-infini-stack-review

Conversation

@gongchensu

@gongchensu gongchensu commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add DeviceGuard in include/infini/rt/device_guard.h for scoped runtime device selection.
  • Add ReusableMemoryPool in include/infini/rt/reusable_memory_pool.h and src/reusable_memory_pool.cc, with block reuse, logical ownership tracking, pin transactions, graph retention leases, and trimming of unused blocks.
  • Extend scripts/generate_public_headers.py with GetDeviceCount(Device::Type, int*) and IsEventNotReady(Error), including NVIDIA's not-ready status mapping.
  • Change Float16::FromFloat in src/data_type.h to round to nearest, ties to even, including subnormal boundary handling.
  • Initialize Ascend lazily through SetDevice and GetDeviceCount; change Cambricon FP16/BF16 type mappings to InfiniRT storage types, removing the BANG half-header dependency from that RT header.

Compared revisions: master@5175a69 → refactor/modern-infini-stack-review@b413816 (2 commits, 8 files).

Motivation

Provide the shared runtime primitives required by the modern InfiniLM stack: scoped device selection, reusable memory, and retained storage for recorded graphs. Keep these resource-management facilities in InfiniRT while supporting the coordinated Ascend and Cambricon integration in the matching stack branches.

The FP16 conversion change also aligns host conversion with round-to-nearest-even behavior used by CUDA.

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 changed the title Refactor/modern infini stack review refactor!: support modern InfiniLM execution Oct 15, 2026
* fix: guard pool capture and validate runtime device selection

Reject unavailable devices before dispatch and prevent CUDA pool growth during native capture. Complete event not-ready mappings and cover the failure paths with regression tests.

* fix: restore device after same-device guard scopes

* style: satisfy Ruff and clang-format checks

This branch has not been deployed

No deployments
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