Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

force specialization on arguments to core wrapper #124

Merged
merged 1 commit into from
Oct 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core,
id = Expr(:quote, gensym("benchmark"))
corefunc = gensym("core")
samplefunc = gensym("sample")
type_vars = [gensym() for i in 1:length(setup_vars)]
signature = Expr(:call, corefunc, setup_vars...)
signature_def = Expr(:where, Expr(:call, corefunc,
[Expr(:(::), setup_var, type_var) for (setup_var, type_var) in zip(setup_vars, type_vars)]...)
, type_vars...)
if length(out_vars) == 0
invocation = signature
core_body = core
Expand All @@ -290,7 +294,7 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core,
core_body = :($(core); $(returns))
end
return Core.eval(eval_module, quote
@noinline $(signature) = begin $(core_body) end
@noinline $(signature_def) = begin $(core_body) end
@noinline function $(samplefunc)(__params::$BenchmarkTools.Parameters)
$(setup)
__evals = __params.evals
Expand Down