The GitHub Actions job "CI" on tvm-ffi.git/main has succeeded.
Run started by GitHub user cyx-6 (triggered by cyx-6).

Head commit for run:
fb5ad97ad629763f893d7fe593f6b096d0baa737 / Yaxing Cai <[email protected]>
[REFACTOR][OrcJIT] Per-session slab-pool memory manager (#574)

## Summary

Refactors the `tvm_ffi_orcjit` addon along three axes — memory
lifecycle,
LLVM-workaround isolation, and macOS/Windows enablement. 14 commits,
each
independently revertible.

## What changed

**Memory lifecycle.** The fixed ~1 GB per-session arena becomes a
growable
pool of fixed-size `Slab`s. Dropping a `DynamicLibrary` now calls
`removeJITDylib` and actually frees its JIT pages (previously code
accumulated until session destruction). `Session.clear_free_slabs()`
releases drained slabs back to the OS. `orcjit_memory_manager.cc` shrank
~740 → 174 lines with `Slab` pulled into its own `orcjit_slab.{h,cc}`.

**LLVM-workaround isolation.** Every upstream-LLVM workaround — formerly
inlined in `orcjit_session.cc` — moved into `llvm_patches/` (5 modules:
`gotpcrelx_fix`, `init_fini_plugin`, `macho_cxa_atexit_shim`,
`win_coff_pdata_strip`, `win_dll_import_generator`). Each has a
fixed-shape
header with issue links, trigger, symptom, and a `## Removal` checklist
so
it's mechanically deletable once upstream fixes land.
`orcjit_session.cc`
shrank ~870 → 320 lines of pure orchestration.

**macOS + Windows enablement.** macOS: skip `MachOPlatform` to sidestep
the
compact-unwind 32-bit-delta bug, and interpose `___cxa_atexit`
per-JITDylib
with a TLS-routed shim that drains at dylib drop. Windows: stub DLL
imports
through JIT-allocated PLT entries (keeps PCRel32 in range) and strip
`.pdata` / `.xdata` relocations pre-graph-build. The three-platform
strategy is documented inline in each patch header.

**Function lifetime + perf.** Captured `Function` values hold a ref to
the
owning dylib so JIT pages survive as long as the handle.
`FunctionObj::safe_call` binds directly to the JIT'd thunk, eliminating
a
per-call indirection.

## API

- **Break**: `ExecutionSession(arena_size=…)` →
`ExecutionSession(slab_size=…)`.
Size is per-slab, default 64 MB; `-1` disables the pool (LLJIT falls
back
  to scattered mmap).
- **New**: `ExecutionSession.clear_free_slabs() -> int` — reclaims
drained
  slabs, returns the count.

## Test plan

- [x] aarch64 Linux: `pytest addons/tvm_ffi_orcjit/tests`
- [x] macOS arm64: 99 passed, 42 skipped
- [ ] CI: lint / clang-tidy / Windows / x86_64 Linux

Report URL: https://github.com/apache/tvm-ffi/actions/runs/25736151577

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to