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
Support adding CodeInstances to JIT for interpreters defining a codegen cache (#57272)
Implements a way to add `CodeInstance`s compiled by external
interpreters to JIT, such that they become legal targets for `invoke`
calls.
Based on a design proposed by @Keno, the `AbstractInterpreter` interface
is extended to support providing a codegen cache that is filled during
inference for future use with `add_codeinsts_to_jit!`.
This allows `invoke(f, ::CodeInstance, args...)` to work on external
interpreters, which is currently failing on `master` (see #57193).
---------
Co-authored-by: Cédric Belmant <cedric.belmant@juliahub.com>
(cherry picked from commit 9d2e9ed)
if source_mode == SOURCE_MODE_ABI && ci isa CodeInstance &&!ci_has_invoke(ci)
1269
-
inspected =IdSet{CodeInstance}()
1270
-
tocompile =Vector{CodeInstance}()
1271
-
push!(tocompile, ci)
1272
-
while!isempty(tocompile)
1273
-
# ci_has_real_invoke(ci) && return ci # optimization: cease looping if ci happens to get compiled (not just jl_fptr_wait_for_compiled, but fully jl_is_compiled_codeinst)
ci isa CodeInstance &&!ci_has_invoke(ci) ||return ci
1272
+
codegen =codegen_cache(interp)
1273
+
codegen ===nothing&&return ci
1274
+
inspected =IdSet{CodeInstance}()
1275
+
tocompile =Vector{CodeInstance}()
1276
+
push!(tocompile, ci)
1277
+
while!isempty(tocompile)
1278
+
# ci_has_real_invoke(ci) && return ci # optimization: cease looping if ci happens to get compiled (not just jl_fptr_wait_for_compiled, but fully jl_is_compiled_codeinst)
0 commit comments