Skip to content

Commit

Permalink
Fixed broadcast with unknown functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Jan 10, 2020
1 parent a6a926d commit 20544db
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
26 changes: 25 additions & 1 deletion benchmarks/driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
# const LOOPVECBENCHDIR = joinpath(pkgdir("LoopVectorization"), "benchmarks")
# includet(joinpath(LOOPVECBENCHDIR, "driver.jl"))

pkgdir(pkg::String) = abspath(joinpath(dirname(Base.find_package(pkg)), ".."))
const LOOPVECBENCHDIR = joinpath(pkgdir("LoopVectorization"), "benchmarks")
include(joinpath(LOOPVECBENCHDIR, "benchmarkflops.jl"))
include(joinpath(LOOPVECBENCHDIR, "plotbenchmarks.jl"))


using Distributed

addprocs(9);
Expand Down Expand Up @@ -33,5 +39,23 @@ exp_bench = fetch(exp_future)
aplusBc_bench = fetch(aplusBc_future)


include(joinpath(LOOPVECBENCHDIR, "plotbenchmarks.jl"))
plot(gemm_bench)
plot(AtmulB_bench)
plot(dot_bench)
plot(selfdot_bench)
plot(gemv_bench)
plot(dot3_bench)
plot(sse_bench)
plot(exp_bench)
plot(aplusBc_bench)

save(joinpath("~/Pictures", "bench_gemm_v3.png"), plot(gemm_bench));
save(joinpath("~/Pictures", "bench_AtmulB_v3.png"), plot(AtmulB_bench));
save(joinpath("~/Pictures", "bench_dot_v3.png"), plot(dot_bench));
save(joinpath("~/Pictures", "bench_selfdot_v3.png"), plot(selfdot_bench));
save(joinpath("~/Pictures", "bench_gemv_v3.png"), plot(gemv_bench));
save(joinpath("~/Pictures", "bench_dot3_v3.png"), plot(dot3_bench));
save(joinpath("~/Pictures", "bench_sse_v3.png"), plot(sse_bench));
save(joinpath("~/Pictures", "bench_exp_v3.png"), plot(exp_bench));
save(joinpath("~/Pictures", "bench_aplusBc_v3.png"), plot(aplusBc_bench));

4 changes: 1 addition & 3 deletions src/broadcast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ function add_broadcast!(
elementbytes::Int = 8
) where {N,S<:Base.Broadcast.AbstractArrayStyle{N},F,A}
instr = get(FUNCTIONSYMBOLS, F) do
f = gensym(:f)
pushpreamble!(ls, Expr(:(=), f, Expr(:(.), bcname, QuoteNode(:f))))
f
Instruction(bcname, :f)
end
args = A.parameters
Nargs = length(args)
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ end
three = 3; fill!(b1, -9999.999);
@avx @. b1 = three*a + sin(a) + sqrt(a);
@test b1 b2

C = rand(100,10,10);
D1 = C .^ 0.3;
D2 = @avx C .^ 0.3;
@test D1 D2
end
end

Expand Down

2 comments on commit 20544db

@chriselrod
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/7730

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v0.3.3 -m "<description of version>" 20544dbf4779e0e702e695a1083b91d9231adeb9
git push origin v0.3.3

Please sign in to comment.