@@ -89,6 +89,7 @@ Several keyword arguments can be used to customize the compilation process:
89
89
struct CompilerConfig{T,P}
90
90
target:: T
91
91
params:: P
92
+ meta
92
93
93
94
kernel:: Bool
94
95
name:: Union{Nothing,String}
@@ -98,6 +99,7 @@ struct CompilerConfig{T,P}
98
99
99
100
function CompilerConfig (target:: AbstractCompilerTarget ,
100
101
params:: AbstractCompilerParams ;
102
+ meta = nothing ,
101
103
kernel= true ,
102
104
name= nothing ,
103
105
entry_abi= :specfunc ,
@@ -106,16 +108,16 @@ struct CompilerConfig{T,P}
106
108
if entry_abi ∉ (:specfunc , :func )
107
109
error (" Unknown entry_abi=$entry_abi " )
108
110
end
109
- new {typeof(target), typeof(params)} (target, params, kernel, name, entry_abi,
111
+ new {typeof(target), typeof(params)} (target, params, meta, kernel, name, entry_abi,
110
112
always_inline, opt_level)
111
113
end
112
114
end
113
115
114
116
# copy constructor
115
- CompilerConfig (cfg:: CompilerConfig ; target= cfg. target, params= cfg. params,
117
+ CompilerConfig (cfg:: CompilerConfig ; target= cfg. target, params= cfg. params, meta = cfg . meta,
116
118
kernel= cfg. kernel, name= cfg. name, entry_abi= cfg. entry_abi,
117
119
always_inline= cfg. always_inline, opt_level= cfg. opt_level) =
118
- CompilerConfig (target, params; kernel, entry_abi, name, always_inline, opt_level)
120
+ CompilerConfig (target, params; meta, kernel, entry_abi, name, always_inline, opt_level)
119
121
120
122
function Base. show (io:: IO , @nospecialize (cfg:: CompilerConfig{T} )) where {T}
121
123
print (io, " CompilerConfig for " , T)
124
126
function Base. hash (cfg:: CompilerConfig , h:: UInt )
125
127
h = hash (cfg. target, h)
126
128
h = hash (cfg. params, h)
129
+ h = hash (cfg. meta, h):: UInt
127
130
128
131
h = hash (cfg. kernel, h)
129
132
h = hash (cfg. name, h)
@@ -178,15 +181,17 @@ runtime_module(@nospecialize(job::CompilerJob)) = error("Not implemented")
178
181
# check if a function is an intrinsic that can assumed to be always available
179
182
isintrinsic (@nospecialize (job:: CompilerJob ), fn:: String ) = false
180
183
184
+ inference_metadata (@nospecialize (job:: CompilerJob )) = job. config. meta
185
+
181
186
# provide a specific interpreter to use.
182
187
if VERSION >= v " 1.11.0-DEV.1552"
183
188
get_interpreter (@nospecialize (job:: CompilerJob )) =
184
- GPUInterpreter (job. world; method_table= method_table (job),
189
+ GPUInterpreter (job. world; meta = inference_metadata (job), method_table= method_table (job),
185
190
token= ci_cache_token (job), inf_params= inference_params (job),
186
191
opt_params= optimization_params (job))
187
192
else
188
193
get_interpreter (@nospecialize (job:: CompilerJob )) =
189
- GPUInterpreter (job. world; method_table= method_table (job),
194
+ GPUInterpreter (job. world; meta = inference_metadata (job), method_table= method_table (job),
190
195
code_cache= ci_cache (job), inf_params= inference_params (job),
191
196
opt_params= optimization_params (job))
192
197
end
@@ -227,10 +232,11 @@ struct GPUCompilerCacheToken
227
232
target_type:: Type
228
233
always_inline:: Bool
229
234
method_table:: Core.MethodTable
235
+ metadata
230
236
end
231
237
232
238
ci_cache_token (@nospecialize (job:: CompilerJob )) =
233
- GPUCompilerCacheToken (typeof (job. config. target), job. config. always_inline, method_table (job))
239
+ GPUCompilerCacheToken (typeof (job. config. target), job. config. always_inline, method_table (job), inference_metadata (job) )
234
240
235
241
# the codeinstance cache to use -- should only be used for the constructor
236
242
if VERSION >= v " 1.11.0-DEV.1552"
0 commit comments