Skip to content

Commit 3f3c261

Browse files
maleadtclaude
andcommitted
Fix float-boxes test for 1.14.
The box call is inlined into the devirtualized InexactError ctor, so assert the underlying gpu_gc_pool_alloc via dump_module instead. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 48602fa commit 3f3c261

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

test/gcn.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,20 +458,19 @@ end
458458
@testset "float boxes" begin
459459
mod = @eval module $(gensym())
460460
function kernel(a,b)
461+
# Int32(a) may fail, boxing the Float32 for the @nospecialize ctor
461462
c = Int32(a)
462-
# the conversion to Int32 may fail, in which case the input Float32 is boxed in order to
463-
# pass it to the @nospecialize exception constructor. we should really avoid that (eg.
464-
# by avoiding @nospecialize, or optimize the unused arguments away), but for now the box
465-
# should just work.
466463
unsafe_store!(b, c)
467464
return
468465
end
469466
end
470467

471468
@test @filecheck begin
472469
@check_label "define void @{{(julia|j)_kernel_[0-9]+}}"
473-
@check "jl_box_float32"
474-
GCN.code_llvm(mod.kernel, Tuple{Float32,Ptr{Float32}})
470+
# box: a jl_box_float32 call <1.14; 1.14+ inlines it into the devirt'd ctor
471+
@check cond=(VERSION < v"1.14-") "jl_box_float32"
472+
@check cond=(VERSION >= v"1.14-") "gpu_gc_pool_alloc"
473+
GCN.code_llvm(mod.kernel, Tuple{Float32,Ptr{Float32}}; dump_module=true)
475474
end
476475
GCN.code_native(devnull, mod.kernel, Tuple{Float32,Ptr{Float32}})
477476
end

test/ptx.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -371,20 +371,19 @@ end
371371
@testset "float boxes" begin
372372
mod = @eval module $(gensym())
373373
function kernel(a,b)
374+
# Int32(a) may fail, boxing the Float32 for the @nospecialize ctor
374375
c = Int32(a)
375-
# the conversion to Int32 may fail, in which case the input Float32 is boxed in
376-
# order to pass it to the @nospecialize exception constructor. we should really
377-
# avoid that (eg. by avoiding @nospecialize, or optimize the unused arguments
378-
# away), but for now the box should just work.
379376
unsafe_store!(b, c)
380377
return
381378
end
382379
end
383380

384381
@test @filecheck begin
385382
@check_label "define void @{{(julia|j)_kernel_[0-9]+}}"
386-
@check "jl_box_float32"
387-
PTX.code_llvm(mod.kernel, Tuple{Float32,Ptr{Float32}})
383+
# box: a jl_box_float32 call <1.14; 1.14+ inlines it into the devirt'd ctor
384+
@check cond=(VERSION < v"1.14-") "jl_box_float32"
385+
@check cond=(VERSION >= v"1.14-") "gpu_gc_pool_alloc"
386+
PTX.code_llvm(mod.kernel, Tuple{Float32,Ptr{Float32}}; dump_module=true)
388387
end
389388
PTX.code_native(devnull, mod.kernel, Tuple{Float32,Ptr{Float32}})
390389
end

0 commit comments

Comments
 (0)