JuliaSIMD / JuliaSIMD/LoopVectorization.jl
Multiply 2 16-bit integers and accumulate to 32-bit integer
- Lenguaje dominante
- Julia
- Estrellas
- 789
- Forks
- 73
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
How would I multiply 2 16-bit integers and accumulate to 32-bit integer? Something like `_mm_madd_epi16`
So far the result of the multiplication seems to be done in 16-bit:
```julia
a = Int16.([1 << 8, 1 << 9, 1 << 10, 1 << 10])
b = Int16.([1 << 7, 1 << 8, 1 << 11, 1 << 10])
function fma_avx(a, b)
res = Int32(0)
@avx for i = 1:4
res = res + a[i] * b[i]
end
res
end
```
```julia
julia> fma_avx(a, b)
-32768
julia> fma_avx(Int32.(a), Int32.(b))
3309568
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Start with the provided `fma_avx` reproducer and its `@avx` loop, comparing the `Int16` and `Int32` calls. Check how the loop handles `Int16` multiplication and accumulation, then verify the behavior against the requested 32-bit result; done means the intended result is supported or the limitation is clearly established with a regression test.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- julia
- Área
- performance
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100