Skip to content

Commit

Permalink
Move vectorization test to boundscheck
Browse files Browse the repository at this point in the history
  • Loading branch information
mbauman committed Feb 14, 2019
1 parent a3c95a6 commit 2543c3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 8 additions & 0 deletions test/boundscheck_exec.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,13 @@ if bc_opt == bc_default || bc_opt == bc_off
@test occursin("vector.body", sprint(code_llvm, g27079, Tuple{Vector{Int}}))
end

# Ensure broadcasting can vectorize when bounds checks are off
if bc_opt != bc_on
function goo28126(u, uprev, k1, k2, k3, k4, k5, k6, k7)
@. u = uprev + 0.1*(0.1*k1 + 0.2*k2 + 0.3*k3 + 0.4*k4 + 0.5*k5 + 0.6*k6 + 0.7*k7)
nothing
end
@test occursin("vector.body", sprint(code_llvm, goo28126, NTuple{9, Vector{Float32}}))
end

end
2 changes: 0 additions & 2 deletions test/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -791,15 +791,13 @@ let
end

@testset "large fusions vectorize and don't allocate (#28126)" begin
using InteractiveUtils: code_llvm
u, uprev, k1, k2, k3, k4, k5, k6, k7 = (ones(1000) for i in 1:9)
function goo(u, uprev, k1, k2, k3, k4, k5, k6, k7)
@. u = uprev + 0.1*(0.1*k1 + 0.2*k2 + 0.3*k3 + 0.4*k4 + 0.5*k5 + 0.6*k6 + 0.7*k7)
nothing
end
@allocated goo(u, uprev, k1, k2, k3, k4, k5, k6, k7)
@test @allocated(goo(u, uprev, k1, k2, k3, k4, k5, k6, k7)) == 0
@test occursin("vector.body", sprint(code_llvm, goo, NTuple{9, Vector{Float32}}))
end

# Broadcasted iterable/indexable APIs
Expand Down

0 comments on commit 2543c3d

Please sign in to comment.