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 <[email protected]>
if source_mode == SOURCE_MODE_ABI && ci isa CodeInstance &&!ci_has_invoke(ci)
1242
-
inspected =IdSet{CodeInstance}()
1243
-
tocompile =Vector{CodeInstance}()
1244
-
push!(tocompile, ci)
1245
-
while!isempty(tocompile)
1246
-
# 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
1245
+
codegen =codegen_cache(interp)
1246
+
codegen ===nothing&&return ci
1247
+
inspected =IdSet{CodeInstance}()
1248
+
tocompile =Vector{CodeInstance}()
1249
+
push!(tocompile, ci)
1250
+
while!isempty(tocompile)
1251
+
# 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