Preserve inferred specializations in invokes - #908
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #908 +/- ##
==========================================
+ Coverage 85.41% 85.48% +0.07%
==========================================
Files 29 29
Lines 5582 5582
==========================================
+ Hits 4768 4772 +4
+ Misses 814 810 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| optimization_params(@nospecialize(job::CompilerJob)) = | ||
| CC.OptimizationParams(; compilesig_invokes=false) |
There was a problem hiding this comment.
We might have to make this configurable And how does this differ from Core.Compiler.infer_compilation_signature?
There was a problem hiding this comment.
optimization_params is already an overridable hook, no?
And I'm not familiar with the other flag. According to Astra:
Difference from
infer_compilation_signature: that flag asks inference to also infer the widened compilation signature.compilesig_invokes=falseinstead prevents the optimizer from redirecting invokes to that wider specialization. Inferring the wider signature can address a missing cache entry, but does not preserve the concrete argument types needed for static dispatch.
f898afd to
da96c50
Compare
compilesig_invokes=falseDisable compilesig_invokes so noinline vararg calls retain their inferred argument types instead of targeting widened compilation signatures that may not be cached. This is needed for the multidimensional bounds-error paths introduced in Julia 1.14. Keep the existing optimization_params hook for back-end overrides. Inferring compilation signatures is a different policy: it populates the wider specializations without preserving the precision of the original call.
Use an opaque allocator in the Bool conversion regression so LLVM retains the heap-reference stores that exposed #904. The constant-null test allocator otherwise removes those stores before AIR lowering.
da96c50 to
c447ad5
Compare
|
Why this causes oneAPI.jl failures:
So I think we need to wait until oneAPI.jl gets a device allocator. Metal.jl was already fixed in #904 and JuliaGPU/Metal.jl#928 |
Set
compilesig_invokes=falseso non-inlined calls retain their inferred specialization instead of targeting a widened compilation signature that may not be cached. This avoids unsupported dynamic invokes, including the multidimensional bounds-error paths introduced in Julia 1.14.For backends without a device heap, provide a null-returning allocator when their runtime module does not define
malloc. Valid inputs can then compile and execute even when an error path needs to box an exception; attempted allocations follow the existing out-of-memory path. Backend-provided allocators retain precedence. This addresses #906.The branch includes the Metal atomic-lowering fix from #904 through its base. Add a Bool-conversion regression with an opaque allocator so LLVM cannot erase the heap-reference stores before AIR lowering, as the usual constant-null test allocator does.
The existing
optimization_params(job)hook remains available for backend overrides. Unlikeinfer_compilation_signature, which also infers widened signatures, disablingcompilesig_invokespreserves the specialization selected by inference.