Skip to content

Commit 20544db

Browse files
committed
Fixed broadcast with unknown functions.
1 parent a6a926d commit 20544db

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

benchmarks/driver.jl

+25-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# const LOOPVECBENCHDIR = joinpath(pkgdir("LoopVectorization"), "benchmarks")
33
# includet(joinpath(LOOPVECBENCHDIR, "driver.jl"))
44

5+
pkgdir(pkg::String) = abspath(joinpath(dirname(Base.find_package(pkg)), ".."))
6+
const LOOPVECBENCHDIR = joinpath(pkgdir("LoopVectorization"), "benchmarks")
7+
include(joinpath(LOOPVECBENCHDIR, "benchmarkflops.jl"))
8+
include(joinpath(LOOPVECBENCHDIR, "plotbenchmarks.jl"))
9+
10+
511
using Distributed
612

713
addprocs(9);
@@ -33,5 +39,23 @@ exp_bench = fetch(exp_future)
3339
aplusBc_bench = fetch(aplusBc_future)
3440

3541

36-
include(joinpath(LOOPVECBENCHDIR, "plotbenchmarks.jl"))
42+
plot(gemm_bench)
43+
plot(AtmulB_bench)
44+
plot(dot_bench)
45+
plot(selfdot_bench)
46+
plot(gemv_bench)
47+
plot(dot3_bench)
48+
plot(sse_bench)
49+
plot(exp_bench)
50+
plot(aplusBc_bench)
51+
52+
save(joinpath("~/Pictures", "bench_gemm_v3.png"), plot(gemm_bench));
53+
save(joinpath("~/Pictures", "bench_AtmulB_v3.png"), plot(AtmulB_bench));
54+
save(joinpath("~/Pictures", "bench_dot_v3.png"), plot(dot_bench));
55+
save(joinpath("~/Pictures", "bench_selfdot_v3.png"), plot(selfdot_bench));
56+
save(joinpath("~/Pictures", "bench_gemv_v3.png"), plot(gemv_bench));
57+
save(joinpath("~/Pictures", "bench_dot3_v3.png"), plot(dot3_bench));
58+
save(joinpath("~/Pictures", "bench_sse_v3.png"), plot(sse_bench));
59+
save(joinpath("~/Pictures", "bench_exp_v3.png"), plot(exp_bench));
60+
save(joinpath("~/Pictures", "bench_aplusBc_v3.png"), plot(aplusBc_bench));
3761

src/broadcast.jl

+1-3
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ function add_broadcast!(
154154
elementbytes::Int = 8
155155
) where {N,S<:Base.Broadcast.AbstractArrayStyle{N},F,A}
156156
instr = get(FUNCTIONSYMBOLS, F) do
157-
f = gensym(:f)
158-
pushpreamble!(ls, Expr(:(=), f, Expr(:(.), bcname, QuoteNode(:f))))
159-
f
157+
Instruction(bcname, :f)
160158
end
161159
args = A.parameters
162160
Nargs = length(args)

test/runtests.jl

+5
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,11 @@ end
529529
three = 3; fill!(b1, -9999.999);
530530
@avx @. b1 = three*a + sin(a) + sqrt(a);
531531
@test b1 b2
532+
533+
C = rand(100,10,10);
534+
D1 = C .^ 0.3;
535+
D2 = @avx C .^ 0.3;
536+
@test D1 D2
532537
end
533538
end
534539

0 commit comments

Comments
 (0)