Skip to content

Commit 8a3c3eb

Browse files
committed
broadcast fill fix
1 parent fa589f2 commit 8a3c3eb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/broadcast.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,11 @@ end
436436
@generated function vmaterialize!(
437437
dest::AbstractArray{T,N}, bc::Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(identity),Tuple{T2}}, ::Val{Mod}, ::Val{UNROLL}
438438
) where {T <: NativeTypes, N, T2 <: Number, Mod, UNROLL}
439-
inline, u₁, u₂, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads = UNROLL
439+
inline, u₁, u₂, v, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads = UNROLL
440440
quote
441441
$(Expr(:meta,:inline))
442442
arg = T(first(bc.args))
443-
@turbo inline=$inline unroll=($u₁,$u₂) thread=$threads for i eachindex(dest)
443+
@turbo inline=$inline unroll=($u₁,$u₂) thread=$threads vectorize=$v for i eachindex(dest)
444444
dest[i] = arg
445445
end
446446
dest
@@ -449,12 +449,12 @@ end
449449
@generated function vmaterialize!(
450450
dest′::Union{Adjoint{T,A},Transpose{T,A}}, bc::Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(identity),Tuple{T2}}, ::Val{Mod}, ::Val{UNROLL}
451451
) where {T <: NativeTypes, N, A <: AbstractArray{T,N}, T2 <: Number, Mod, UNROLL}
452-
inline, u₁, u₂, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads = UNROLL
452+
inline, u₁, u₂, v, isbroadcast, W, rs, rc, cls, l1, l2, l3, threads = UNROLL
453453
quote
454454
$(Expr(:meta,:inline))
455455
arg = T(first(bc.args))
456456
dest = parent(dest′)
457-
@turbo inline=$inline unroll=($u₁,$u₂) thread=$threads for i eachindex(dest)
457+
@turbo inline=$inline unroll=($u₁,$u₂) thread=$threads vectorize=$v for i eachindex(dest)
458458
dest[i] = arg
459459
end
460460
dest′

test/broadcast.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ function test_broadcast(::Type{T}) where {T}
171171
@. D1 = C ^ 2;
172172
@outline @turbo @. D2 = C ^ 2;
173173
@test D1 D2
174+
@turbo view(C,1:100,1:10,1:10) .= 0;
175+
@test all(==(0), C)
176+
@turbo view(B, axes(B,1), axes(B,2))' .= 2
177+
@test all(==(2), B)
174178
end
175179
end
176180

0 commit comments

Comments
 (0)