Skip to content

Commit 2aa893d

Browse files
committed
Add option for backends to run vectorization passes
1 parent aa05fa3 commit 2aa893d

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/interface.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ end
222222
# Has the runtime available and does not require special handling
223223
uses_julia_runtime(@nospecialize(job::CompilerJob)) = false
224224

225+
# Is it legal to run vectorization passes on this target
226+
can_vectorize(@nospecialize(job::CompilerJob)) = false
227+
225228
# Should emit PTLS lookup that can be relocated
226229
dump_native(@nospecialize(job::CompilerJob)) = false
227230

src/optim.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function buildNewPMPipeline!(mpm, @nospecialize(job::CompilerJob), opt_level)
3131
add!(mpm, NewPMFunctionPassManager()) do fpm
3232
buildLoopOptimizerPipeline(fpm, job, opt_level)
3333
buildScalarOptimizerPipeline(fpm, job, opt_level)
34-
if uses_julia_runtime(job) && opt_level >= 2
34+
if (uses_julia_runtime(job) || can_vectorize(job)) && opt_level >= 2
3535
# XXX: we disable vectorization, as this generally isn't useful for GPU targets
3636
# and actually causes issues with some back-end compilers (like Metal).
3737
# TODO: Make this not dependent on `uses_julia_runtime` (likely CPU), but it's own control

0 commit comments

Comments
 (0)