Skip to content

Commit 7f2f49a

Browse files
authored
Have the native target default to not using the Julia runtime. (#380)
1 parent 55c702c commit 7f2f49a

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

src/driver.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ const __llvm_initialized = Ref(false)
321321
@compiler_assert isempty(uses(dyn_marker)) job
322322
unsafe_delete!(ir, dyn_marker)
323323
end
324-
324+
325325
@timeit_debug to "IR post-processing" begin
326326
# mark the kernel entry-point functions (optimization may need it)
327327
if job.source.kernel
@@ -334,7 +334,7 @@ const __llvm_initialized = Ref(false)
334334
if optimize
335335
@timeit_debug to "optimization" begin
336336
optimize!(job, ir)
337-
337+
338338
# deferred codegen has some special optimization requirements,
339339
# which also need to happen _after_ regular optimization.
340340
# XXX: make these part of the optimizer pipeline?
@@ -376,7 +376,7 @@ const __llvm_initialized = Ref(false)
376376
end
377377
end
378378
end
379-
379+
380380
# finish the module
381381
#
382382
# we want to finish the module after optimization, so we cannot do so during

src/native.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Base.@kwdef struct NativeCompilerTarget <: AbstractCompilerTarget
88
cpu::String=(LLVM.version() < v"8") ? "" : unsafe_string(LLVM.API.LLVMGetHostCPUName())
99
features::String=(LLVM.version() < v"8") ? "" : unsafe_string(LLVM.API.LLVMGetHostCPUFeatures())
1010
llvm_always_inline::Bool=false # will mark the job function as always inline
11-
jlruntime::Bool=true # Use Julia runtime for throwing errors, instead of the GPUCompiler support
11+
jlruntime::Bool=false # Use Julia runtime for throwing errors, instead of the GPUCompiler support
1212
end
1313
llvm_triple(::NativeCompilerTarget) = Sys.MACHINE
1414

test/definitions/native.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ GPUCompiler.can_safepoint(@nospecialize(job::NativeCompilerJob)) = job.params.en
2121

2222
function native_job(@nospecialize(f_type), @nospecialize(types);
2323
kernel::Bool=false, entry_abi=:specfunc, entry_safepoint::Bool=false,
24-
always_inline=false, llvm_always_inline=true, kwargs...)
24+
always_inline=false, llvm_always_inline=true, jlruntime::Bool=false,
25+
kwargs...)
2526
source = FunctionSpec(f_type, Base.to_tuple_type(types), kernel)
26-
target = NativeCompilerTarget(;llvm_always_inline)
27+
target = NativeCompilerTarget(; llvm_always_inline, jlruntime)
2728
params = TestCompilerParams(entry_safepoint)
2829
CompilerJob(target, source, params, entry_abi, always_inline), kwargs
2930
end
@@ -253,7 +254,9 @@ module LazyCodegen
253254

254255
import GPUCompiler: deferred_codegen_jobs
255256
@generated function deferred_codegen(f::F, ::Val{tt}) where {F,tt}
256-
job, _ = native_job(F, tt)
257+
# XXX: do we actually require the Julia runtime?
258+
# with jlruntime=false, we reach an unreachable.
259+
job, _ = native_job(F, tt; jlruntime=true)
257260

258261
addr = get_trampoline(job)
259262
trampoline = pointer(addr)

test/gcn.jl

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,18 @@ end
155155
gcn_code_native(devnull, kernel, Tuple{Float64})
156156
end
157157

158-
@test_broken "exception arguments"
159-
#= FIXME: _ZNK4llvm14TargetLowering20scalarizeVectorStoreEPNS_11StoreSDNodeERNS_12SelectionDAGE
160-
@testset "exception arguments" begin
158+
# FIXME: _ZNK4llvm14TargetLowering20scalarizeVectorStoreEPNS_11StoreSDNodeERNS_12SelectionDAGE
159+
false && @testset "exception arguments" begin
161160
function kernel(a)
162161
unsafe_store!(a, trunc(Int, unsafe_load(a)))
163162
return
164163
end
165164

166165
gcn_code_native(devnull, kernel, Tuple{Ptr{Float64}})
167166
end
168-
=#
169167

170-
@test_broken "GC and TLS lowering"
171-
#= FIXME: in function julia_inner_18528 void (%jl_value_t addrspace(10)*): invalid addrspacecast
172-
@testset "GC and TLS lowering" begin
168+
# FIXME: in function julia_inner_18528 void (%jl_value_t addrspace(10)*): invalid addrspacecast
169+
false && @testset "GC and TLS lowering" begin
173170
@eval mutable struct PleaseAllocate
174171
y::Csize_t
175172
end
@@ -206,7 +203,6 @@ end
206203

207204
@test !occursin("gpu_gc_pool_alloc", asm)
208205
end
209-
=#
210206

211207
@testset "float boxes" begin
212208
function kernel(a,b)

0 commit comments

Comments
 (0)