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

Hint compiler to not specialize compile methods #144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions src/Compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ function run_pass_pipeline!(mod, pass_pipeline)
return mod
end

function compile_mlir(f, args; kwargs...)
function compile_mlir(@nospecialize(f), @nospecialize(args); kwargs...)
ctx = MLIR.IR.Context()
Base.append!(Reactant.registry[]; context=ctx)
@ccall MLIR.API.mlir_c.RegisterDialects(ctx::MLIR.API.MlirContext)::Cvoid
Expand All @@ -245,7 +245,7 @@ function compile_mlir(f, args; kwargs...)
end
end

function compile_mlir!(mod, f, args; optimize=true)
function compile_mlir!(mod, @nospecialize(f), @nospecialize(args); optimize=true)
fnwrapped,
func2, traced_result, result, seen_args, ret, linear_args, in_tys,
linear_results = MLIR.IR.mmodule!(mod) do
Expand Down Expand Up @@ -564,7 +564,7 @@ function codegen_xla_call(exec, flatten_names, donated_args_mask, nresults)
return concretized_res_names, xla_call_code
end

function compile_xla(f, args; client=nothing)
function compile_xla(@nospecialize(f), @nospecialize(args); client=nothing)
# register MLIR dialects
ctx = MLIR.IR.Context()
Base.append!(Reactant.registry[]; context=ctx)
Expand Down Expand Up @@ -596,7 +596,9 @@ function compile_xla(f, args; client=nothing)
end
end

function compile(f, args; client=nothing)
Base.@nospecializeinfer function compile(
@nospecialize(f), @nospecialize(args); client=nothing
)::Thunk
exec, linear_args, linear_results, preserved_args, seen_args, concrete_result, isclosure = compile_xla(
f, args
)
Expand Down
Loading