cyx-6 opened a new pull request, #660: URL: https://github.com/apache/tvm-ffi/pull/660
## Motivation The ORC runtime shipped as a separate `liborc_rt*.a` data file next to the extension `.so` and was resolved at startup via a filesystem glob (through the `tvm_ffi_orcjit.DefaultOrcRuntimePath` Python hook). That couples two artifacts, lets the runtime be lost/relocated by repackaging, and does a filesystem glob to find its own runtime on first session. ## What this does Bakes `liborc_rt.a` into the extension `.so`'s `.rodata` via a generated `.incbin` stub (`orc_rt_embed.S.in`) and hands the bytes to `ExecutorNativePlatform` as a **zero-copy** `MemoryBuffer`. The wheel now ships **one artifact**, startup does **no path lookup**, and the runtime cannot be separated from the extension. The embedded `start`/`end` symbols are `.hidden`, so they add no interposition surface and don't affect the existing `--exclude-libs` symbol hiding. This is **Solution A** of the embedded-orcrt design. ### `default_session()` Always uses the embedded runtime and is **deliberately not user-configurable**: a shared process-wide singleton with a hidden runtime knob would let whichever caller runs first silently pick the platform for everyone. The old `DefaultOrcRuntimePath` discovery hook is dropped. ### User-created `ExecutionSession` — new `orc_rt` selector Renamed `orc_rt_path` → `orc_rt`, now a 4-state selector: | `orc_rt=` | meaning | |---|---| | `"auto"` (default) | the embedded runtime | | `str` / `Path` | a custom `liborc_rt` archive on disk | | `bytes` | a custom `liborc_rt` archive in memory | | `None` | no ORC platform | C++ takes `Optional<Variant<String, Bytes>>`; empty `String` == `"auto"`, `nullopt` == `None`. Linux/ELF only, matching where the ORC platform is wired up today; macOS/Windows ignore the selector as before. A custom runtime must match the LLVM/compiler-rt the extension was built against. ## Testing - New `orc_rt` tests: custom path (str + `Path`), in-memory bytes, `None` (no platform), and bad-type rejection. Path/bytes cases are `@skipif` non-Linux (the selector only takes effect on ELF). - Verified locally (aarch64 Linux, LLVM 22): the `.so` carries the hidden `orc_rt_archive` symbols in `.rodata`, absent from the dynamic table; no `liborc_rt*.a` bundled; C++ exception unwinding across a JIT frame works under `auto`/path/bytes (proving `ELFNixPlatform` is genuinely installed). - Full addon suite: 164 passed, 11 skipped. clang-format / ruff / cmake-format / ASF-header all clean. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
