Skip to content

Commit 36d95ce

Browse files
committed
Test tweaks.
1 parent f1db3cd commit 36d95ce

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

test/native.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,10 @@ end
767767

768768
bytes = Vector{UInt8}(codeunits(obj))
769769
entry = LLVM.name(meta.entry)
770-
expected = GPUCompiler.resolve_relocation_target(only(values(relocs.sites)))
770+
probe_site = findfirst(ref -> ref isa GPUCompiler.JuliaValueRef &&
771+
ref.value === :relocation_probe, relocs.sites)
772+
@test probe_site !== nothing
773+
expected = GPUCompiler.resolve_relocation_target(relocs.sites[probe_site])
771774
fptr, keepalive = Native.load(bytes, entry, relocs, meta.ir)
772775
try
773776
GC.@preserve keepalive begin
@@ -825,6 +828,11 @@ end
825828
@test isempty(meta.relocations.sites)
826829
# nothing is left for a loader to patch or import
827830
@test !any(GPUCompiler.isextinit, globals(ir))
831+
832+
# back-ends like Metal.jl drive object emission themselves, without threading
833+
# relocation metadata through; that only works because of the baking above.
834+
code, _ = GPUCompiler.emit_asm(job, ir, LLVM.API.LLVMObjectFile)
835+
@test !isempty(code)
828836
end
829837
end
830838

@@ -853,7 +861,10 @@ end
853861

854862
bytes = Vector{UInt8}(codeunits(obj))
855863
entry = LLVM.name(meta.entry)
856-
expected = GPUCompiler.resolve_relocation_target(only(values(relocs.sites)))
864+
probe_site = findfirst(ref -> ref isa GPUCompiler.JuliaValueRef &&
865+
ref.value === :patch_probe, relocs.sites)
866+
@test probe_site !== nothing
867+
expected = GPUCompiler.resolve_relocation_target(relocs.sites[probe_site])
857868
fptr, keepalive = Native.load(bytes, entry, relocs, meta.ir)
858869
try
859870
GC.@preserve keepalive begin

0 commit comments

Comments
 (0)