From c954cde6d667b0d652dd87348a79d08e83f00d5b Mon Sep 17 00:00:00 2001 From: "William S. Moses" Date: Mon, 10 Nov 2025 13:39:51 -0600 Subject: [PATCH 1/3] More robust error message on method compilation failure --- src/jlgen.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/jlgen.jl b/src/jlgen.jl index f9cf153c..1755794d 100644 --- a/src/jlgen.jl +++ b/src/jlgen.jl @@ -614,7 +614,9 @@ function ci_cache_populate(interp, cache, mi, min_world, max_world) # inference should have populated our cache wvc = WorldView(cache, min_world, max_world) - @assert CC.haskey(wvc, mi) + if !CC.haskey(wvc, mi) + throw(AssertionError("GPUCompiler: Failed to compile method for $mi, between worlds $min_world and $max_world")) + end ci = CC.getindex(wvc, mi) # if ci is rettype_const, the inference result won't have been cached @@ -629,7 +631,10 @@ function ci_cache_populate(interp, cache, mi, min_world, max_world) # inference should have populated our cache wvc = WorldView(cache, min_world, max_world) - @assert CC.haskey(wvc, mi) + + if !CC.haskey(wvc, mi) + throw(AssertionError("GPUCompiler: Failed to compile method for $mi, between worlds $min_world and $max_world")) + end ci = CC.getindex(wvc, mi) # if ci is rettype_const, the inference result won't have been cached From b4ac3d0209f94378f8acddf66a2cf64eb04da7f4 Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 19 Nov 2025 13:13:49 -0600 Subject: [PATCH 2/3] Replace conditional throw with assertion for key check --- src/jlgen.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/jlgen.jl b/src/jlgen.jl index 1755794d..2ec8ffa5 100644 --- a/src/jlgen.jl +++ b/src/jlgen.jl @@ -614,9 +614,7 @@ function ci_cache_populate(interp, cache, mi, min_world, max_world) # inference should have populated our cache wvc = WorldView(cache, min_world, max_world) - if !CC.haskey(wvc, mi) - throw(AssertionError("GPUCompiler: Failed to compile method for $mi, between worlds $min_world and $max_world")) - end + @assert CC.haskey(wvc, mi) "GPUCompiler: Failed to compile method for $mi, between worlds $min_world and $max_world" ci = CC.getindex(wvc, mi) # if ci is rettype_const, the inference result won't have been cached From 228aaa4127dfe740fb6187ed9e22c35ab2460bee Mon Sep 17 00:00:00 2001 From: William Moses Date: Wed, 19 Nov 2025 13:14:25 -0600 Subject: [PATCH 3/3] Replace if statement with assert for key check --- src/jlgen.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/jlgen.jl b/src/jlgen.jl index 2ec8ffa5..d2e11451 100644 --- a/src/jlgen.jl +++ b/src/jlgen.jl @@ -630,9 +630,7 @@ function ci_cache_populate(interp, cache, mi, min_world, max_world) # inference should have populated our cache wvc = WorldView(cache, min_world, max_world) - if !CC.haskey(wvc, mi) - throw(AssertionError("GPUCompiler: Failed to compile method for $mi, between worlds $min_world and $max_world")) - end + @assert CC.haskey(wvc, mi) "GPUCompiler: Failed to compile method for $mi, between worlds $min_world and $max_world" ci = CC.getindex(wvc, mi) # if ci is rettype_const, the inference result won't have been cached