|
767 | 767 |
|
768 | 768 | bytes = Vector{UInt8}(codeunits(obj)) |
769 | 769 | 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]) |
771 | 774 | fptr, keepalive = Native.load(bytes, entry, relocs, meta.ir) |
772 | 775 | try |
773 | 776 | GC.@preserve keepalive begin |
|
825 | 828 | @test isempty(meta.relocations.sites) |
826 | 829 | # nothing is left for a loader to patch or import |
827 | 830 | @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) |
828 | 836 | end |
829 | 837 | end |
830 | 838 |
|
|
853 | 861 |
|
854 | 862 | bytes = Vector{UInt8}(codeunits(obj)) |
855 | 863 | 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]) |
857 | 868 | fptr, keepalive = Native.load(bytes, entry, relocs, meta.ir) |
858 | 869 | try |
859 | 870 | GC.@preserve keepalive begin |
|
0 commit comments