GPUCompiler.jl icon indicating copy to clipboard operation
GPUCompiler.jl copied to clipboard

Some compilation failures result in nasty errors

Open maleadt opened this issue 4 years ago • 3 comments

e.g. with LLVM.jl on the breaking changes PR but GPUCompiler/CUDA.jl not, CUDA.jl gives:

ERROR: LoadError: LoadError: AssertionError: Core.Compiler.haskey(wvc, mi)
Stacktrace:
  [1] ci_cache_populate(interp::GPUCompiler.GPUInterpreter, cache::GPUCompiler.CodeCache, mt::Nothing, mi::Core.MethodInstance, min_world::UInt64, max_world::Int32)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/jlgen.jl:284
  [2] compile_method_instance(job::GPUCompiler.CompilerJob, method_instance::Core.MethodInstance)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/jlgen.jl:327
  [3] macro expansion
    @ ~/Julia/depot/packages/TimerOutputs/PZq45/src/TimerOutput.jl:226 [inlined]
  [4] irgen(job::GPUCompiler.CompilerJob, method_instance::Core.MethodInstance)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/irgen.jl:4
  [5] macro expansion
    @ ~/Julia/pkg/GPUCompiler/src/driver.jl:149 [inlined]
  [6] macro expansion
    @ ~/Julia/depot/packages/TimerOutputs/PZq45/src/TimerOutput.jl:226 [inlined]
  [7] macro expansion
    @ ~/Julia/pkg/GPUCompiler/src/driver.jl:148 [inlined]
  [8] emit_llvm(job::GPUCompiler.CompilerJob, method_instance::Any; libraries::Bool, deferred_codegen::Bool, optimize::Bool, only_entry::Bool)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/utils.jl:62
  [9] codegen(output::Symbol, job::GPUCompiler.CompilerJob; libraries::Bool, deferred_codegen::Bool, optimize::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/driver.jl:58
 [10] emit_function!(mod::LLVM.Module, job::GPUCompiler.CompilerJob, f::Function, method::GPUCompiler.Runtime.RuntimeMethodInstance)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/rtlib.jl:68
 [11] build_runtime(job::GPUCompiler.CompilerJob, ctx::LLVM.Context)
    @ GPUCompiler ~/Julia/pkg/GPUCompiler/src/rtlib.jl:114

maleadt avatar Jul 01 '21 06:07 maleadt

FWIW, I'm getting this error now even just using the official latest release of all packages:

julia> using CUDA

julia> x=cu([1.0]);2x
WARNING: both ExprTools and LLVM export "parameters"; uses of it in module CUDA must be qualified
ERROR: AssertionError: Core.Compiler.haskey(wvc, mi)

malmaud avatar Jul 02 '21 17:07 malmaud

This is https://github.com/JuliaGPU/GPUCompiler.jl/issues/214; a sad consequence of Julia's namespacing (ExprTools started exporting a method that was exported by LLVM.jl). I'm working on a backports release, see https://github.com/JuliaGPU/CUDA.jl/pull/1027.

maleadt avatar Jul 02 '21 18:07 maleadt

Can you provide a MWE + Manifest recording the exact versions of packages in use? Make sure you're not using versions from master, or other incompatible combinations.

maleadt avatar Jul 19 '21 18:07 maleadt