-
Notifications
You must be signed in to change notification settings - Fork 12
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
JLL related fixups #706
JLL related fixups #706
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -202,7 +202,7 @@ function create_result( | |||||||||
end | ||||||||||
|
||||||||||
# Optimization passes via transform dialect | ||||||||||
function optimization_passes(; no_nan::Bool=false, sroa::Bool=false) | ||||||||||
function optimization_passes(; no_nan::Bool=false, sroa::Bool=false, inline::Bool=true) | ||||||||||
transform_passes_list = [ | ||||||||||
"patterns=compare_op_canon<16>", | ||||||||||
"transpose_transpose<16>", | ||||||||||
|
@@ -389,6 +389,8 @@ function optimization_passes(; no_nan::Bool=false, sroa::Bool=false) | |||||||||
"common_compare_expression_rewrite", | ||||||||||
"compare_select_simplify", | ||||||||||
"while_simplify<1>", | ||||||||||
"scatter_update_computation_const_prop", | ||||||||||
"if_remove_unused", | ||||||||||
] | ||||||||||
if no_nan | ||||||||||
append!( | ||||||||||
|
@@ -407,7 +409,10 @@ function optimization_passes(; no_nan::Bool=false, sroa::Bool=false) | |||||||||
",", | ||||||||||
) | ||||||||||
func_passes = join(["canonicalize", "cse", "canonicalize", transform_passes], ",") | ||||||||||
passes = ["inline{default-pipeline=canonicalize max-iterations=4}"] | ||||||||||
passes = String[] | ||||||||||
if inline | ||||||||||
push!(passes, "inline{default-pipeline=canonicalize max-iterations=4}") | ||||||||||
end | ||||||||||
if sroa | ||||||||||
push!(passes, "propagate-constant-bounds") | ||||||||||
if DUMP_LLVMIR[] | ||||||||||
|
@@ -703,6 +708,14 @@ function compile_mlir!( | |||||||||
run_pass_pipeline!( | ||||||||||
mod, "canonicalize,remove-unnecessary-enzyme-ops,enzyme-simplify-math," * kern | ||||||||||
) | ||||||||||
elseif optimize === :canonicalize | ||||||||||
run_pass_pipeline!( | ||||||||||
mod, "canonicalize" | ||||||||||
) | ||||||||||
elseif optimize === :just_batch | ||||||||||
run_pass_pipeline!( | ||||||||||
mod, "enzyme-batch" | ||||||||||
) | ||||||||||
Comment on lines
+716
to
+718
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||
elseif optimize !== :none | ||||||||||
error("Invalid optimize option: $(Meta.quot(optimize))") | ||||||||||
end | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -153,18 +153,23 @@ export ConcreteRArray, ConcreteRNumber, @compile, @code_hlo, @jit, @trace, withi | |||||||||||||||||
|
||||||||||||||||||
const registry = Ref{Union{Nothing,MLIR.IR.DialectRegistry}}() | ||||||||||||||||||
|
||||||||||||||||||
const initialize_dialect_first_run = Ref{Bool}(true) | ||||||||||||||||||
|
||||||||||||||||||
const passes_initialized = Ref(false) | ||||||||||||||||||
function initialize_dialect() | ||||||||||||||||||
registry[] = MLIR.IR.DialectRegistry() | ||||||||||||||||||
@ccall MLIR.API.mlir_c.InitializeRegistryAndPasses( | ||||||||||||||||||
@ccall MLIR.API.mlir_c.InitializeRegistry( | ||||||||||||||||||
registry[]::MLIR.API.MlirDialectRegistry | ||||||||||||||||||
)::Cvoid | ||||||||||||||||||
initialize_dialect_first_run[] = false | ||||||||||||||||||
if !passes_initialized[] | ||||||||||||||||||
@ccall MLIR.API.mlir_c.InitializePasses( | ||||||||||||||||||
registry[]::MLIR.API.MlirDialectRegistry | ||||||||||||||||||
)::Cvoid | ||||||||||||||||||
passes_initialized[] = true | ||||||||||||||||||
Comment on lines
+163
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||
end | ||||||||||||||||||
return nothing | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
function deinitialize_dialect() | ||||||||||||||||||
passes_initialized[] = false | ||||||||||||||||||
return registry[] = nothing | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -217,13 +217,15 @@ function __init__() | |||||||||||||||||||||||||||||||||
println(stdout, e) | ||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
else | ||||||||||||||||||||||||||||||||||
if !Reactant.precompiling() | ||||||||||||||||||||||||||||||||||
try | ||||||||||||||||||||||||||||||||||
gpu = GPUClient() | ||||||||||||||||||||||||||||||||||
backends["gpu"] = gpu | ||||||||||||||||||||||||||||||||||
default_backend[] = gpu | ||||||||||||||||||||||||||||||||||
catch e | ||||||||||||||||||||||||||||||||||
println(stdout, e) | ||||||||||||||||||||||||||||||||||
println(stdout, e) | ||||||||||||||||||||||||||||||||||
Comment on lines
+220
to
+226
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
end | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JuliaFormatter] reported by reviewdog 🐶