You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ORCJIT] Reinject contexts on first function lookup (#655)
## Summary
- defer context injection from empty-library construction to the first
ordinary function lookup
- cache each successful refresh; after LLVM accepts an object,
AddObjectFile publishes the refresh flag as false
- keep AddObjectFile outside the thread-safety contract: it must not
race GetFunction, and a failed add naturally leaves the prior flag
unchanged
- keep concurrent GetFunction calls thread-safe with an acquire fast
path and a mutex-protected, double-checked refresh on the false path,
followed by one ordinary symbol lookup
- preserve ordinary GetSymbol initializer execution and LLVM error
propagation
- keep the ORCJIT wheel test environment aligned with the
repository-wide parallel pytest configuration by installing pytest-xdist
- bump the addon package to 0.1.1
If callers violate the AddObjectFile/GetFunction contract, LLVM may
expose a newly added symbol and GetFunction may return its stable
allocated address before that object's context slots are refreshed. The
symbol remains visible, but context initialization is not guaranteed for
that unsupported overlap.
## Regression
One C object defines only __tvm_ffi__library_ctx and a probe.
Barrier-synchronized first lookups verify that every returned function
observes the injected pointer without adding another fixture.
## Validation
- GCC- and Clang-built addon suites: 139 passed, 3 platform skips each
- fresh CI-equivalent wheel environment with local root package, default
parallel pytest, and C/C++ quick starts
- 200 rounds with eight concurrent first GetFunction callers after
object addition
- focused context, invalid-object, constructor, and destructor tests
- fresh 0.1.1 wheel build, isolated install, focused regression, and
quick starts
- applicable formatting and lint hooks
0 commit comments