@@ -89,6 +89,7 @@ Several keyword arguments can be used to customize the compilation process:
8989struct CompilerConfig{T,P}
9090 target:: T
9191 params:: P
92+ meta
9293
9394 kernel:: Bool
9495 name:: Union{Nothing,String}
@@ -98,6 +99,7 @@ struct CompilerConfig{T,P}
9899
99100 function CompilerConfig (target:: AbstractCompilerTarget ,
100101 params:: AbstractCompilerParams ;
102+ meta = nothing ,
101103 kernel= true ,
102104 name= nothing ,
103105 entry_abi= :specfunc ,
@@ -106,16 +108,16 @@ struct CompilerConfig{T,P}
106108 if entry_abi ∉ (:specfunc , :func )
107109 error (" Unknown entry_abi=$entry_abi " )
108110 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,
110112 always_inline, opt_level)
111113 end
112114end
113115
114116# 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,
116118 kernel= cfg. kernel, name= cfg. name, entry_abi= cfg. entry_abi,
117119 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)
119121
120122function Base. show (io:: IO , @nospecialize (cfg:: CompilerConfig{T} )) where {T}
121123 print (io, " CompilerConfig for " , T)
124126function Base. hash (cfg:: CompilerConfig , h:: UInt )
125127 h = hash (cfg. target, h)
126128 h = hash (cfg. params, h)
129+ h = hash (cfg. meta, h):: UInt
127130
128131 h = hash (cfg. kernel, h)
129132 h = hash (cfg. name, h)
@@ -178,15 +181,17 @@ runtime_module(@nospecialize(job::CompilerJob)) = error("Not implemented")
178181# check if a function is an intrinsic that can assumed to be always available
179182isintrinsic (@nospecialize (job:: CompilerJob ), fn:: String ) = false
180183
184+ inference_metadata (@nospecialize (job:: CompilerJob )) = job. config. meta
185+
181186# provide a specific interpreter to use.
182187if VERSION >= v " 1.11.0-DEV.1552"
183188get_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),
185190 token= ci_cache_token (job), inf_params= inference_params (job),
186191 opt_params= optimization_params (job))
187192else
188193get_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),
190195 code_cache= ci_cache (job), inf_params= inference_params (job),
191196 opt_params= optimization_params (job))
192197end
@@ -227,10 +232,11 @@ struct GPUCompilerCacheToken
227232 target_type:: Type
228233 always_inline:: Bool
229234 method_table:: Core.MethodTable
235+ metadata
230236end
231237
232238ci_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) )
234240
235241# the codeinstance cache to use -- should only be used for the constructor
236242if VERSION >= v " 1.11.0-DEV.1552"
0 commit comments