JuliaSIMD / JuliaSIMD/LoopVectorization.jl

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

Offen
#182 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
789
Forks
73
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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`?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.