Closed iSunfield closed 5 months ago
Although I was testing whether AVX-512 instructions could be directly executed from codon, I have managed to execute the _mm512_set1_epi8 instruction following the steps below, so I am reporting this as a self-response.
Add the following code to the simd.codon file located in .codon/lib/codon/stdlib/experimental
@llvm
def _mm512_set1_epi8(val:i8) -> Vec[i8, 64]:
;The inline assembly coding is in GNU style, so the operand is flipped compared to the Intel coding style.
%m512_val = call <64 x i8> asm sideeffect "vpbroadcastb $1, $0", "=v,m"(i8 %val)
ret <64 x i8> %m512_val
Test code for _mm512_set1_epi8 function
from experimental.simd import *
A:Vec[i8,64]
A=Vec[i8,64]._mm512_set1_epi8(Int8)
PtrA = ptr(A).as_byte() for i in range(16): print(int(PtrA[i]))
- Execution by codon command, need --mattr=+avx512bw option for AVX-512
codon run --mattr=+avx512bw -release TestCode.codon
10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Thank you for the fix! Our SIMD support is still indeed in the early-stage development.
I'm looking to run SIMD code on CODON, and I've successfully used the simd.codon file from the stdlib/experimental directory by importing it. Now, I want to extend the functionalities of simd.codon and have tried copying it to my local directory, but I'm encountering compilation errors as below.
When I tried importing the simd.codon file from my local directory, I encountered the following result:
Is there any special processing in the standard library code to treat LLVM's <16 x i8> type as equivalent to CODON's Vec[u8, 16] type?