JuliaSIMD / JuliaSIMD/LoopVectorization.jl

Fallback path: annotate `for` loops with `@simd`?

Open
#182 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
789
Forks
73
PR merge metrics
No merged PRs in 30d

Description

Here's the fallback path for the basic matmul kernel:
```julia
$(Expr(:inbounds, true))
local var"#1#val" = for n = 1:size(A, 1), m = 1:size(B, 2)
#= REPL[2]:2 =#
Cₙₘ = zero(eltype(C))
#= REPL[2]:3 =#
for k = 1:size(A, 2)
#= REPL[2]:4 =#
Cₙₘ = Base.FastMath.add_fast(Cₙₘ, Base.FastMath.mul_fast(A[n, k], B[k, m]))
end
#= REPL[2]:6 =#
C[n, m] = Cₙₘ
end
$(Expr(:inbounds, :pop))
var"#1#val"
```

In the fallback path, `@inbounds` and `@fastmath` have both been applied.

Would it also make sense to annotate the `for` loop in the fallback path with `@simd`?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.