@@ -29,13 +29,14 @@ mutable struct StaticTarget
29
29
platform:: Union{Platform,Nothing}
30
30
tm:: LLVM.TargetMachine
31
31
compiler:: Union{String,Nothing}
32
+ julia_runtime:: Bool
32
33
end
33
34
34
35
clean_triple (platform:: Platform ) = arch (platform) * os_str (platform) * libc_str (platform)
35
36
StaticTarget () = StaticTarget (HostPlatform (), unsafe_string (LLVM. API. LLVMGetHostCPUName ()), unsafe_string (LLVM. API. LLVMGetHostCPUFeatures ()))
36
- StaticTarget (platform:: Platform ) = StaticTarget (platform, LLVM. TargetMachine (LLVM. Target (triple = clean_triple (platform)), clean_triple (platform)), nothing )
37
- StaticTarget (platform:: Platform , cpu:: String ) = StaticTarget (platform, LLVM. TargetMachine (LLVM. Target (triple = clean_triple (platform)), clean_triple (platform), cpu), nothing )
38
- StaticTarget (platform:: Platform , cpu:: String , features:: String ) = StaticTarget (platform, LLVM. TargetMachine (LLVM. Target (triple = clean_triple (platform)), clean_triple (platform), cpu, features), nothing )
37
+ StaticTarget (platform:: Platform ) = StaticTarget (platform, LLVM. TargetMachine (LLVM. Target (triple = clean_triple (platform)), clean_triple (platform)), nothing , false )
38
+ StaticTarget (platform:: Platform , cpu:: String ) = StaticTarget (platform, LLVM. TargetMachine (LLVM. Target (triple = clean_triple (platform)), clean_triple (platform), cpu), nothing , false )
39
+ StaticTarget (platform:: Platform , cpu:: String , features:: String ) = StaticTarget (platform, LLVM. TargetMachine (LLVM. Target (triple = clean_triple (platform)), clean_triple (platform), cpu, features), nothing , false )
39
40
40
41
function StaticTarget (triple:: String , cpu:: String , features:: String )
41
42
platform = tryparse (Platform, triple)
@@ -50,6 +51,9 @@ Set the compiler for cross compilation
50
51
"""
51
52
set_compiler! (target:: StaticTarget , compiler:: String ) = (target. compiler = compiler)
52
53
54
+
55
+ set_runtime! (target:: StaticTarget , julia_runtime:: Bool ) = (target. julia_runtime = julia_runtime)
56
+
53
57
"""
54
58
```julia
55
59
@device_override old_bad_method(arg1::Type1, arg2::Type2) = new_good_method(arg1, arg2)
@@ -79,6 +83,7 @@ struct StaticCompilerTarget{MT} <: GPUCompiler.AbstractCompilerTarget
79
83
triple:: String
80
84
cpu:: String
81
85
features:: String
86
+ julia_runtime:: Bool
82
87
method_table:: MT
83
88
end
84
89
@@ -115,6 +120,7 @@ GPUCompiler.runtime_module(::GPUCompiler.CompilerJob{<:StaticCompilerTarget, Sta
115
120
GPUCompiler. can_throw (job:: GPUCompiler.CompilerJob{<:StaticCompilerTarget, StaticCompilerParams} ) = true
116
121
GPUCompiler. can_throw (job:: GPUCompiler.CompilerJob{<:StaticCompilerTarget} ) = true
117
122
123
+ GPUCompiler. uses_julia_runtime (job:: GPUCompiler.CompilerJob{<:StaticCompilerTarget} ) = job. config. target. julia_runtime
118
124
GPUCompiler. get_interpreter (job:: GPUCompiler.CompilerJob{<:StaticCompilerTarget, StaticCompilerParams} ) =
119
125
StaticInterpreter (job. config. params. cache, GPUCompiler. method_table (job), job. world,
120
126
GPUCompiler. inference_params (job), GPUCompiler. optimization_params (job))
@@ -131,7 +137,7 @@ function static_job(@nospecialize(func::Function), @nospecialize(types::Type);
131
137
)
132
138
source = methodinstance (typeof (func), Base. to_tuple_type (types))
133
139
tm = target. tm
134
- gputarget = StaticCompilerTarget (LLVM. triple (tm), LLVM. cpu (tm), LLVM. features (tm), method_table)
140
+ gputarget = StaticCompilerTarget (LLVM. triple (tm), LLVM. cpu (tm), LLVM. features (tm), target . julia_runtime, method_table)
135
141
params = StaticCompilerParams ()
136
142
config = GPUCompiler. CompilerConfig (gputarget, params, name = name, kernel = kernel)
137
143
StaticCompiler. CompilerJob (source, config), kwargs
@@ -145,7 +151,7 @@ function static_job(@nospecialize(func), @nospecialize(types);
145
151
)
146
152
source = methodinstance (typeof (func), Base. to_tuple_type (types))
147
153
tm = target. tm
148
- gputarget = StaticCompilerTarget (LLVM. triple (tm), LLVM. cpu (tm), LLVM. features (tm), method_table)
154
+ gputarget = StaticCompilerTarget (LLVM. triple (tm), LLVM. cpu (tm), LLVM. features (tm), target . julia_runtime, method_table)
149
155
params = StaticCompilerParams ()
150
156
config = GPUCompiler. CompilerConfig (gputarget, params, name = name, kernel = kernel)
151
157
StaticCompiler. CompilerJob (source, config), kwargs
0 commit comments