Skip to content

Commit 1719184

Browse files
authored
Fix optimize string (#1160)
1 parent 9a0f5d2 commit 1719184

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

deps/build_local.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ push!(build_cmd_list, "--repo_env=CC=$(cc)")
137137
push!(build_cmd_list, "--check_visibility=false")
138138
push!(build_cmd_list, "--verbose_failures")
139139
push!(build_cmd_list, "--jobs=$(parsed_args["jobs"])")
140+
if Sys.isapple()
141+
push!(build_cmd_list, "--define")
142+
push!(build_cmd_list, "using_clang=true")
143+
end
140144
for opt in parsed_args["copt"]
141145
push!(build_cmd_list, "--copt=$(opt)")
142146
end

src/Compiler.jl

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,23 +1292,25 @@ function compile_mlir!(
12921292
end
12931293

12941294
# HACK: remove with next JLL
1295-
if transpose_propagate === :up
1296-
run_pass_pipeline!(
1297-
mod,
1298-
"enzyme-hlo-generate-td{patterns=transpose_while},transform-interpreter,enzyme-hlo-remove-transform",
1299-
"transpose_while",
1300-
)
1301-
end
1295+
if !(optimize isa String)
1296+
if transpose_propagate === :up
1297+
run_pass_pipeline!(
1298+
mod,
1299+
"enzyme-hlo-generate-td{patterns=transpose_while},transform-interpreter,enzyme-hlo-remove-transform",
1300+
"transpose_while",
1301+
)
1302+
end
13021303

1303-
if optimize (:none, :just_batch, :canonicalize) &&
1304-
(transpose_propagate === :up || reshape_propagate === :up)
1305-
# We tried propagating reshapes and transposes up. If at this point we are left with
1306-
# them, we propagate them down to minimize the number of Ops in the IR.
1307-
run_pass_pipeline!(
1308-
mod,
1309-
optimization_passes(; transpose_propagate=:down, reshape_propagate=:down),
1310-
"post_op_transpose_reshape",
1311-
)
1304+
if optimize (:none, :just_batch, :canonicalize) &&
1305+
(transpose_propagate === :up || reshape_propagate === :up)
1306+
# We tried propagating reshapes and transposes up. If at this point we are left with
1307+
# them, we propagate them down to minimize the number of Ops in the IR.
1308+
run_pass_pipeline!(
1309+
mod,
1310+
optimization_passes(; transpose_propagate=:down, reshape_propagate=:down),
1311+
"post_op_transpose_reshape",
1312+
)
1313+
end
13121314
end
13131315

13141316
# Now we resolve paddings if `optimize_then_pad`

0 commit comments

Comments
 (0)