Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out methods that are unreachable from native AbsInt #54155

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vchuravy
Copy link
Member

While working on JuliaGPU/GPUCompiler.jl#557 I would sometimes get an error during package image creation

ERROR: The following 1 direct dependency failed to precompile:

GemmDenseCUDA 

Failed to precompile GemmDenseCUDA [77fe268f-d775-43f7-b4ca-0f4dd283d536] to "/home/vchuravy/.julia/compiled/v1.11/GemmDenseCUDA/jl_3sDnKv".
LLVM ERROR: Cannot select: intrinsic %llvm.nvvm.membar.sys

[26379] signal 6 (-6): Aborted
in expression starting at none:0
Allocations: 33542987 (Pool: 33542022; Big: 965); GC: 2

This confused me since we filter out compilation results for the foreign abstract interpreters.

The only method that creates this intrinsic is CUDA.threadfence_system and if I execute it locally
I get a similar error.

julia> CUDA.threadfence_system()
ERROR: LLVM error: Cannot select: intrinsic %llvm.nvvm.membar.sys
Stacktrace:
 [1] handle_error(reason::Cstring)
   @ LLVM ~/src/LLVM/src/core/context.jl:170
 [2] top-level scope
   @ REPL[2]:1
 [3] top-level scope
   @ ~/.julia/packages/CUDA/02Uw6/src/initialization.jl:206

Now there is an argument that CUDA should prevent the user from calling this function
(and indeed we have @device_function that errors at runtime)

Nonetheless I was still curious if we are by accident leaking. In the end we are not,
but if someone queues up a codeinstance through PrecompileTools and we will try and
lookup the method and re-infer it if necessary.

This PR filters out methodinstances that we only queue up because of a foreign abstract interpreter.

@maleadt maleadt force-pushed the vc/unreachable_methods branch from 1b485b7 to 900a283 Compare July 17, 2024 13:56
@vchuravy
Copy link
Member Author

Talking with @maleadt I was a bit confused why the mi was scheduled since static int precompile_enq_specialization_(jl_method_instance_t *mi, void *closure) should have filtered it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant