IntroductionΒΆ
SIMDy is JIT compiler that transforms python code to native machine code. A number of Python features can be used inside of a kernel.
They include expressions, functions, structures, conditionals and loops. Inside of kernel only SIMDy data types are allowed to be used.
Currently supported basic data types are 32/64-bit integers and 32/64-bit floats. Main advantage of SIMDy is
support for vector data types which are later directly translated to SIMD instructions. In addition to
these basic types SIMDy also arrays and simple structures are supported. Here is list of basic data types and vector types:
int32
, int64
, float32
, float64
, int32x2
, int32x3
,
int32x4
, int32x8
, int32x16
, int64x2
, int64x3
,
int64x4
, int64x8
, float32x2
, float32x3
, float32x4
, float32x8
, float32x16
, float64x2
,
float64x3
, float64x4
, float64x8
.
Kernel code is strongly typed and all conversions between types must be done explicitly. SIMDy support SSE, AVX, AVX2 and
AVX512 SIMD instruction sets. Selection of SIMD instruction set is done automatically or user can specified desired SIMD
instruction set. Compilation can be invoked automatically when calling a function that uses the @simdy_kernel
decorator or using Kernel
class. Below you can see trivial example how to use SIMDy.
from simdy import simdy_kernel, int32x2
@simdy_kernel
def add(a: int32x2, b: int32x2) -> int32x2:
return a + b
result = add(int32(33, 11), int32(-5, 55))
print(result)