补充
This commit is contained in:
517
Test/SimdTest/App/main.py
Normal file
517
Test/SimdTest/App/main.py
Normal file
@@ -0,0 +1,517 @@
|
||||
from stdint import *
|
||||
import vipersimd
|
||||
import numpy
|
||||
from stdio import printf
|
||||
import stdlib
|
||||
from stdlib import calloc
|
||||
import t, c
|
||||
import mpool
|
||||
|
||||
|
||||
# 全局内存池
|
||||
arena: t.CUInt8T | t.CPtr = None
|
||||
pool: mpool.MPool | t.CPtr = None
|
||||
|
||||
# 外部函数: clock() 用于性能计时
|
||||
def clock() -> t.CLong | t.CExtern: pass
|
||||
|
||||
CLOCK_PER_SEC: t.CDefine = 1000
|
||||
|
||||
test_passed: t.CInt = 0
|
||||
test_failed: t.CInt = 0
|
||||
|
||||
def check(name: str, condition: t.CInt, detail: str):
|
||||
global test_passed, test_failed
|
||||
if condition:
|
||||
test_passed += 1
|
||||
printf(" [PASS] %s\n", name)
|
||||
else:
|
||||
test_failed += 1
|
||||
printf(" [FAIL] %s -- %s\n", name, detail if detail else "")
|
||||
|
||||
def section(title: str):
|
||||
printf("\n=== %s ===\n", title)
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 1. AVX2 double4 正确性测试
|
||||
# ============================================================
|
||||
|
||||
def test_avx2_add_sub_mul_div():
|
||||
section("AVX2 add/sub/mul/div 4d")
|
||||
a: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
a.data[0] = t.CDouble(1.0)
|
||||
a.data[1] = t.CDouble(2.0)
|
||||
a.data[2] = t.CDouble(3.0)
|
||||
a.data[3] = t.CDouble(4.0)
|
||||
|
||||
b: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
b.data[0] = t.CDouble(5.0)
|
||||
b.data[1] = t.CDouble(6.0)
|
||||
b.data[2] = t.CDouble(7.0)
|
||||
b.data[3] = t.CDouble(8.0)
|
||||
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
|
||||
# add
|
||||
vipersimd.simd_add4d(a.data, b.data, out.data)
|
||||
check("add[0]==6", out.data[0] == t.CDouble(6.0), "")
|
||||
check("add[1]==8", out.data[1] == t.CDouble(8.0), "")
|
||||
check("add[2]==10", out.data[2] == t.CDouble(10.0), "")
|
||||
check("add[3]==12", out.data[3] == t.CDouble(12.0), "")
|
||||
|
||||
# sub
|
||||
vipersimd.simd_sub4d(a.data, b.data, out.data)
|
||||
check("sub[0]==-4", out.data[0] == t.CDouble(-4.0), "")
|
||||
check("sub[3]==-4", out.data[3] == t.CDouble(-4.0), "")
|
||||
|
||||
# mul
|
||||
vipersimd.simd_mul4d(a.data, b.data, out.data)
|
||||
check("mul[0]==5", out.data[0] == t.CDouble(5.0), "")
|
||||
check("mul[1]==12", out.data[1] == t.CDouble(12.0), "")
|
||||
check("mul[2]==21", out.data[2] == t.CDouble(21.0), "")
|
||||
check("mul[3]==32", out.data[3] == t.CDouble(32.0), "")
|
||||
|
||||
# div
|
||||
vipersimd.simd_div4d(b.data, a.data, out.data)
|
||||
check("div[0]==5", out.data[0] == t.CDouble(5.0), "")
|
||||
check("div[1]==3", out.data[1] == t.CDouble(3.0), "")
|
||||
|
||||
a.delete()
|
||||
b.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
def test_avx2_neg_abs_sqrt():
|
||||
section("AVX2 neg/abs/sqrt 4d")
|
||||
a: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
a.data[0] = t.CDouble(1.0)
|
||||
a.data[1] = t.CDouble(-4.0)
|
||||
a.data[2] = t.CDouble(9.0)
|
||||
a.data[3] = t.CDouble(-16.0)
|
||||
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
|
||||
# neg
|
||||
vipersimd.simd_neg4d(a.data, out.data)
|
||||
check("neg[0]==-1", out.data[0] == t.CDouble(-1.0), "")
|
||||
check("neg[1]==4", out.data[1] == t.CDouble(4.0), "")
|
||||
check("neg[2]==-9", out.data[2] == t.CDouble(-9.0), "")
|
||||
check("neg[3]==16", out.data[3] == t.CDouble(16.0), "")
|
||||
|
||||
# abs
|
||||
vipersimd.simd_abs4d(a.data, out.data)
|
||||
check("abs[0]==1", out.data[0] == t.CDouble(1.0), "")
|
||||
check("abs[1]==4", out.data[1] == t.CDouble(4.0), "")
|
||||
check("abs[2]==9", out.data[2] == t.CDouble(9.0), "")
|
||||
check("abs[3]==16", out.data[3] == t.CDouble(16.0), "")
|
||||
|
||||
# sqrt
|
||||
vipersimd.simd_sqrt4d(out.data, out.data)
|
||||
check("sqrt[0]==1", out.data[0] == t.CDouble(1.0), "")
|
||||
check("sqrt[1]==2", out.data[1] == t.CDouble(2.0), "")
|
||||
check("sqrt[2]==3", out.data[2] == t.CDouble(3.0), "")
|
||||
check("sqrt[3]==4", out.data[3] == t.CDouble(4.0), "")
|
||||
|
||||
a.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
def test_avx2_min_max():
|
||||
section("AVX2 min/max 4d")
|
||||
a: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
a.data[0] = t.CDouble(1.0)
|
||||
a.data[1] = t.CDouble(8.0)
|
||||
a.data[2] = t.CDouble(3.0)
|
||||
a.data[3] = t.CDouble(6.0)
|
||||
|
||||
b: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
b.data[0] = t.CDouble(5.0)
|
||||
b.data[1] = t.CDouble(2.0)
|
||||
b.data[2] = t.CDouble(7.0)
|
||||
b.data[3] = t.CDouble(4.0)
|
||||
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
|
||||
vipersimd.simd_min4d(a.data, b.data, out.data)
|
||||
check("min[0]==1", out.data[0] == t.CDouble(1.0), "")
|
||||
check("min[1]==2", out.data[1] == t.CDouble(2.0), "")
|
||||
check("min[2]==3", out.data[2] == t.CDouble(3.0), "")
|
||||
check("min[3]==4", out.data[3] == t.CDouble(4.0), "")
|
||||
|
||||
vipersimd.simd_max4d(a.data, b.data, out.data)
|
||||
check("max[0]==5", out.data[0] == t.CDouble(5.0), "")
|
||||
check("max[1]==8", out.data[1] == t.CDouble(8.0), "")
|
||||
check("max[2]==7", out.data[2] == t.CDouble(7.0), "")
|
||||
check("max[3]==6", out.data[3] == t.CDouble(6.0), "")
|
||||
|
||||
a.delete()
|
||||
b.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
def test_avx2_scalar_ops():
|
||||
section("AVX2 scalar broadcast ops")
|
||||
a: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
a.data[0] = t.CDouble(1.0)
|
||||
a.data[1] = t.CDouble(2.0)
|
||||
a.data[2] = t.CDouble(3.0)
|
||||
a.data[3] = t.CDouble(4.0)
|
||||
|
||||
s: numpy.ndarray | t.CPtr = numpy.zeros(pool, 1)
|
||||
s.data[0] = t.CDouble(10.0)
|
||||
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
|
||||
vipersimd.simd_mul_scalar4d(a.data, s.data, out.data)
|
||||
check("mul_scalar[0]==10", out.data[0] == t.CDouble(10.0), "")
|
||||
check("mul_scalar[1]==20", out.data[1] == t.CDouble(20.0), "")
|
||||
check("mul_scalar[3]==40", out.data[3] == t.CDouble(40.0), "")
|
||||
|
||||
vipersimd.simd_add_scalar4d(a.data, s.data, out.data)
|
||||
check("add_scalar[0]==11", out.data[0] == t.CDouble(11.0), "")
|
||||
check("add_scalar[3]==14", out.data[3] == t.CDouble(14.0), "")
|
||||
|
||||
a.delete()
|
||||
s.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
def test_avx2_hsum_dot():
|
||||
section("AVX2 hsum/dot 4d")
|
||||
a: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
a.data[0] = t.CDouble(1.0)
|
||||
a.data[1] = t.CDouble(2.0)
|
||||
a.data[2] = t.CDouble(3.0)
|
||||
a.data[3] = t.CDouble(4.0)
|
||||
|
||||
b: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
b.data[0] = t.CDouble(5.0)
|
||||
b.data[1] = t.CDouble(6.0)
|
||||
b.data[2] = t.CDouble(7.0)
|
||||
b.data[3] = t.CDouble(8.0)
|
||||
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 1)
|
||||
|
||||
vipersimd.simd_hsum4d(a.data, out.data)
|
||||
check("hsum==10", out.data[0] == t.CDouble(10.0), "")
|
||||
|
||||
vipersimd.simd_dot4d(a.data, b.data, out.data)
|
||||
check("dot==70", out.data[0] == t.CDouble(70.0), "")
|
||||
|
||||
a.delete()
|
||||
b.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
def test_avx2_fma():
|
||||
section("AVX2 FMA 4d")
|
||||
a: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
a.data[0] = t.CDouble(1.0)
|
||||
a.data[1] = t.CDouble(2.0)
|
||||
a.data[2] = t.CDouble(3.0)
|
||||
a.data[3] = t.CDouble(4.0)
|
||||
|
||||
b: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
b.data[0] = t.CDouble(5.0)
|
||||
b.data[1] = t.CDouble(6.0)
|
||||
b.data[2] = t.CDouble(7.0)
|
||||
b.data[3] = t.CDouble(8.0)
|
||||
|
||||
c_val: numpy.ndarray | t.CPtr = numpy.ones(pool, 4)
|
||||
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
|
||||
vipersimd.simd_fma4d(a.data, b.data, c_val.data, out.data)
|
||||
check("fma[0]==6", out.data[0] == t.CDouble(6.0), "")
|
||||
check("fma[1]==13", out.data[1] == t.CDouble(13.0), "")
|
||||
check("fma[2]==22", out.data[2] == t.CDouble(22.0), "")
|
||||
check("fma[3]==33", out.data[3] == t.CDouble(33.0), "")
|
||||
|
||||
a.delete()
|
||||
b.delete()
|
||||
c_val.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 2. 批量数组运算正确性测试
|
||||
# ============================================================
|
||||
|
||||
def test_batch_array_ops():
|
||||
section("Batch array operations")
|
||||
n: t.CSizeT = 16
|
||||
a: numpy.ndarray | t.CPtr = numpy.arange(pool, t.CDouble(1.0), t.CDouble(17.0), t.CDouble(1.0))
|
||||
b: numpy.ndarray | t.CPtr = numpy.full(pool, 16, t.CDouble(2.0))
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, 16)
|
||||
|
||||
# add array
|
||||
vipersimd.simd_add_array(a.data, b.data, out.data, n)
|
||||
check("add_arr[0]==3", out.data[0] == t.CDouble(3.0), "")
|
||||
check("add_arr[15]==18", out.data[15] == t.CDouble(18.0), "")
|
||||
|
||||
# mul array
|
||||
vipersimd.simd_mul_array(a.data, b.data, out.data, n)
|
||||
check("mul_arr[0]==2", out.data[0] == t.CDouble(2.0), "")
|
||||
check("mul_arr[3]==8", out.data[3] == t.CDouble(8.0), "")
|
||||
|
||||
# sqrt array
|
||||
c: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
c.data[0] = t.CDouble(4.0)
|
||||
c.data[1] = t.CDouble(9.0)
|
||||
c.data[2] = t.CDouble(16.0)
|
||||
c.data[3] = t.CDouble(25.0)
|
||||
out4: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
vipersimd.simd_sqrt_array(c.data, out4.data, t.CSizeT(4))
|
||||
check("sqrt_arr[0]==2", out4.data[0] == t.CDouble(2.0), "")
|
||||
check("sqrt_arr[3]==5", out4.data[3] == t.CDouble(5.0), "")
|
||||
|
||||
# abs array
|
||||
d: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
d.data[0] = t.CDouble(-1.0)
|
||||
d.data[1] = t.CDouble(-2.0)
|
||||
d.data[2] = t.CDouble(3.0)
|
||||
d.data[3] = t.CDouble(-4.0)
|
||||
vipersimd.simd_abs_array(d.data, out4.data, t.CSizeT(4))
|
||||
check("abs_arr[0]==1", out4.data[0] == t.CDouble(1.0), "")
|
||||
check("abs_arr[1]==2", out4.data[1] == t.CDouble(2.0), "")
|
||||
check("abs_arr[3]==4", out4.data[3] == t.CDouble(4.0), "")
|
||||
|
||||
# dot array
|
||||
e: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
|
||||
e.data[0] = t.CDouble(1.0)
|
||||
e.data[1] = t.CDouble(2.0)
|
||||
e.data[2] = t.CDouble(3.0)
|
||||
e.data[3] = t.CDouble(4.0)
|
||||
f: numpy.ndarray | t.CPtr = numpy.ones(pool, 4)
|
||||
out1: numpy.ndarray | t.CPtr = numpy.zeros(pool, 1)
|
||||
vipersimd.simd_dot_array(e.data, f.data, t.CSizeT(4), out1.data)
|
||||
check("dot_arr==10", out1.data[0] == t.CDouble(10.0), "")
|
||||
|
||||
a.delete()
|
||||
b.delete()
|
||||
out.delete()
|
||||
c.delete()
|
||||
out4.delete()
|
||||
d.delete()
|
||||
e.delete()
|
||||
f.delete()
|
||||
out1.delete()
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 3. LLVMIR 精确标量运算测试
|
||||
# ============================================================
|
||||
|
||||
def test_llvmir_scalar():
|
||||
section("LLVMIR precise scalar ops")
|
||||
|
||||
# sqrt
|
||||
r: t.CDouble = vipersimd.simd_sqrt(t.CDouble(4.0))
|
||||
check("sqrt(4)==2", r == t.CDouble(2.0), "")
|
||||
|
||||
# fabs
|
||||
r = vipersimd.simd_fabs(t.CDouble(-3.5))
|
||||
check("fabs(-3.5)==3.5", r == t.CDouble(3.5), "")
|
||||
|
||||
# floor
|
||||
r = vipersimd.simd_floor(t.CDouble(3.7))
|
||||
check("floor(3.7)==3", r == t.CDouble(3.0), "")
|
||||
|
||||
# ceil
|
||||
r = vipersimd.simd_ceil(t.CDouble(3.2))
|
||||
check("ceil(3.2)==4", r == t.CDouble(4.0), "")
|
||||
|
||||
# round
|
||||
r = vipersimd.simd_round(t.CDouble(3.5))
|
||||
check("round(3.5)==4", r == t.CDouble(4.0), "")
|
||||
|
||||
# trunc
|
||||
r = vipersimd.simd_trunc(t.CDouble(3.9))
|
||||
check("trunc(3.9)==3", r == t.CDouble(3.0), "")
|
||||
|
||||
# fma: 2*3+1 = 7
|
||||
r = vipersimd.simd_fma(t.CDouble(2.0), t.CDouble(3.0), t.CDouble(1.0))
|
||||
check("fma(2,3,1)==7", r == t.CDouble(7.0), "")
|
||||
|
||||
# copysign
|
||||
r = vipersimd.simd_copysign(t.CDouble(3.0), t.CDouble(-1.0))
|
||||
check("copysign(3,-1)==-3", r == t.CDouble(-3.0), "")
|
||||
|
||||
# neg
|
||||
r = vipersimd.simd_neg(t.CDouble(1.5))
|
||||
check("neg(1.5)==-1.5", r == t.CDouble(-1.5), "")
|
||||
|
||||
# minnum
|
||||
r = vipersimd.simd_minnum(t.CDouble(2.0), t.CDouble(3.0))
|
||||
check("minnum(2,3)==2", r == t.CDouble(2.0), "")
|
||||
|
||||
# maxnum
|
||||
r = vipersimd.simd_maxnum(t.CDouble(2.0), t.CDouble(3.0))
|
||||
check("maxnum(2,3)==3", r == t.CDouble(3.0), "")
|
||||
|
||||
# exp
|
||||
r = vipersimd.simd_exp(t.CDouble(1.0))
|
||||
check("exp(1)~=2.718", r > t.CDouble(2.71) and r < t.CDouble(2.72), "")
|
||||
|
||||
# log
|
||||
r = vipersimd.simd_log(t.CDouble(2.718281828459045))
|
||||
check("log(e)~=1", r > t.CDouble(0.999) and r < t.CDouble(1.001), "")
|
||||
|
||||
# sin
|
||||
r = vipersimd.simd_sin(t.CDouble(0.0))
|
||||
check("sin(0)~=0", r > t.CDouble(-0.001) and r < t.CDouble(0.001), "")
|
||||
|
||||
# cos
|
||||
r = vipersimd.simd_cos(t.CDouble(0.0))
|
||||
check("cos(0)~=1", r > t.CDouble(0.999) and r < t.CDouble(1.001), "")
|
||||
|
||||
# pow
|
||||
r = vipersimd.simd_pow(t.CDouble(2.0), t.CDouble(10.0))
|
||||
check("pow(2,10)==1024", r == t.CDouble(1024.0), "")
|
||||
|
||||
|
||||
# ============================================================
|
||||
# 4. 性能基准测试: SIMD vs 标量
|
||||
# ============================================================
|
||||
|
||||
N_ELEM: t.CDefine = 40000
|
||||
N_ITER: t.CDefine = 50000
|
||||
|
||||
def scalar_add_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT):
|
||||
i: t.CSizeT = 0
|
||||
da: t.CDouble | t.CPtr = a
|
||||
db: t.CDouble | t.CPtr = b
|
||||
dout: t.CDouble | t.CPtr = out
|
||||
while i < n:
|
||||
dout[i] = da[i] + db[i]
|
||||
i += 1
|
||||
|
||||
def scalar_mul_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT):
|
||||
i: t.CSizeT = 0
|
||||
da: t.CDouble | t.CPtr = a
|
||||
db: t.CDouble | t.CPtr = b
|
||||
dout: t.CDouble | t.CPtr = out
|
||||
while i < n:
|
||||
dout[i] = da[i] * db[i]
|
||||
i += 1
|
||||
|
||||
def scalar_sqrt_array(a: t.CPtr, out: t.CPtr, n: t.CSizeT):
|
||||
i: t.CSizeT = 0
|
||||
da: t.CDouble | t.CPtr = a
|
||||
dout: t.CDouble | t.CPtr = out
|
||||
while i < n:
|
||||
dout[i] = vipersimd.simd_sqrt(da[i])
|
||||
i += 1
|
||||
|
||||
def benchmark_simd_vs_scalar():
|
||||
section("Benchmark: SIMD vs Scalar")
|
||||
|
||||
a: numpy.ndarray | t.CPtr = numpy.full(pool, N_ELEM, t.CDouble(1.5))
|
||||
b: numpy.ndarray | t.CPtr = numpy.full(pool, N_ELEM, t.CDouble(2.5))
|
||||
out: numpy.ndarray | t.CPtr = numpy.zeros(pool, N_ELEM)
|
||||
|
||||
# --- SIMD add benchmark ---
|
||||
t0: t.CLong = clock()
|
||||
iter: t.CInt = 0
|
||||
while iter < N_ITER:
|
||||
vipersimd.simd_add_array(a.data, b.data, out.data, t.CSizeT(N_ELEM))
|
||||
iter += 1
|
||||
t1: t.CLong = clock()
|
||||
simd_add_ms: t.CLong = t1 - t0
|
||||
|
||||
# --- Scalar add benchmark ---
|
||||
t0 = clock()
|
||||
iter = 0
|
||||
while iter < N_ITER:
|
||||
scalar_add_array(a.data, b.data, out.data, t.CSizeT(N_ELEM))
|
||||
iter += 1
|
||||
t1 = clock()
|
||||
scalar_add_ms: t.CLong = t1 - t0
|
||||
|
||||
printf(" ADD: SIMD=%ldms Scalar=%ldms", simd_add_ms, scalar_add_ms)
|
||||
if scalar_add_ms > 0:
|
||||
printf(" speedup=%.1fx\n", t.CDouble(scalar_add_ms) / t.CDouble(simd_add_ms))
|
||||
else:
|
||||
printf(" speedup=N/A\n")
|
||||
|
||||
# --- SIMD mul benchmark ---
|
||||
t0 = clock()
|
||||
iter = 0
|
||||
while iter < N_ITER:
|
||||
vipersimd.simd_mul_array(a.data, b.data, out.data, t.CSizeT(N_ELEM))
|
||||
iter += 1
|
||||
t1 = clock()
|
||||
simd_mul_ms: t.CLong = t1 - t0
|
||||
|
||||
# --- Scalar mul benchmark ---
|
||||
t0 = clock()
|
||||
iter = 0
|
||||
while iter < N_ITER:
|
||||
scalar_mul_array(a.data, b.data, out.data, t.CSizeT(N_ELEM))
|
||||
iter += 1
|
||||
t1 = clock()
|
||||
scalar_mul_ms: t.CLong = t1 - t0
|
||||
|
||||
printf(" MUL: SIMD=%ldms Scalar=%ldms", simd_mul_ms, scalar_mul_ms)
|
||||
if scalar_mul_ms > 0:
|
||||
printf(" speedup=%.1fx\n", t.CDouble(scalar_mul_ms) / t.CDouble(simd_mul_ms))
|
||||
else:
|
||||
printf(" speedup=N/A\n")
|
||||
|
||||
# --- SIMD sqrt benchmark ---
|
||||
t0 = clock()
|
||||
iter = 0
|
||||
while iter < N_ITER:
|
||||
vipersimd.simd_sqrt_array(a.data, out.data, t.CSizeT(N_ELEM))
|
||||
iter += 1
|
||||
t1 = clock()
|
||||
simd_sqrt_ms: t.CLong = t1 - t0
|
||||
|
||||
# --- Scalar sqrt benchmark ---
|
||||
t0 = clock()
|
||||
iter = 0
|
||||
while iter < N_ITER:
|
||||
scalar_sqrt_array(a.data, out.data, t.CSizeT(N_ELEM))
|
||||
iter += 1
|
||||
t1 = clock()
|
||||
scalar_sqrt_ms: t.CLong = t1 - t0
|
||||
|
||||
printf(" SQRT: SIMD=%ldms Scalar=%ldms", simd_sqrt_ms, scalar_sqrt_ms)
|
||||
if scalar_sqrt_ms > 0:
|
||||
printf(" speedup=%.1fx\n", t.CDouble(scalar_sqrt_ms) / t.CDouble(simd_sqrt_ms))
|
||||
else:
|
||||
printf(" speedup=N/A\n")
|
||||
|
||||
# 验证结果正确性
|
||||
check("bench result[0] valid", out.data[0] > t.CDouble(0.0), "")
|
||||
|
||||
a.delete()
|
||||
b.delete()
|
||||
out.delete()
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Main
|
||||
# ============================================================
|
||||
|
||||
def main() -> t.CInt:
|
||||
global arena, pool
|
||||
|
||||
arena = calloc(4096 * 1024, 1) # 4MB arena
|
||||
pool = mpool.MPool(arena, 4096 * 1024, 0) # bump allocator
|
||||
|
||||
printf("=== ViperSIMD Test Suite ===\n")
|
||||
|
||||
test_avx2_add_sub_mul_div()
|
||||
test_avx2_neg_abs_sqrt()
|
||||
test_avx2_min_max()
|
||||
test_avx2_scalar_ops()
|
||||
test_avx2_hsum_dot()
|
||||
test_avx2_fma()
|
||||
test_batch_array_ops()
|
||||
test_llvmir_scalar()
|
||||
benchmark_simd_vs_scalar()
|
||||
|
||||
printf("\n=== Results: %d passed, %d failed ===\n", test_passed, test_failed)
|
||||
return 0
|
||||
1
Test/SimdTest/output/024a3459d0f585ae.deps.json
Normal file
1
Test/SimdTest/output/024a3459d0f585ae.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
1
Test/SimdTest/output/1b666d438f4d301e.deps.json
Normal file
1
Test/SimdTest/output/1b666d438f4d301e.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
1
Test/SimdTest/output/3f7c5e78d8652535.deps.json
Normal file
1
Test/SimdTest/output/3f7c5e78d8652535.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
1
Test/SimdTest/output/68c4fe4b12c908e3.deps.json
Normal file
1
Test/SimdTest/output/68c4fe4b12c908e3.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
1
Test/SimdTest/output/c3eb91093118e1e1.deps.json
Normal file
1
Test/SimdTest/output/c3eb91093118e1e1.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
1
Test/SimdTest/output/c9f4be41ca1cc2b4.deps.json
Normal file
1
Test/SimdTest/output/c9f4be41ca1cc2b4.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
1
Test/SimdTest/output/fe99c83946298690.deps.json
Normal file
1
Test/SimdTest/output/fe99c83946298690.deps.json
Normal file
@@ -0,0 +1 @@
|
||||
{"string": "024a3459d0f585ae", "main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "stdio": "73edbcf76e32d00b", "stdlib": "7538e542cab4c1d5", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
|
||||
29
Test/SimdTest/project.json
Normal file
29
Test/SimdTest/project.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/TermiNexus/TransPyC/main/schemas/project-schema.json",
|
||||
"name": "SimdTest",
|
||||
"version": "1.0.0",
|
||||
"source_dir": "./App",
|
||||
"temp_dir": "./temp",
|
||||
"output_dir": "./output",
|
||||
"compiler": {
|
||||
"cmd": "llc",
|
||||
"flags": ["-filetype=obj"]
|
||||
},
|
||||
"linker": {
|
||||
"cmd": "clang++",
|
||||
"flags": ["-Wl,--allow-multiple-definition", "-Wl,--unresolved-symbols=ignore-in-object-files", "-lmsvcrt", "-lucrt", "-lpthread", "-lmingwex", "-lkernel32", "-luser32", "-latomic"],
|
||||
"output": "SimdTest.exe"
|
||||
},
|
||||
"includes": [
|
||||
"../../includes"
|
||||
],
|
||||
"target": {
|
||||
"triple": "x86_64-pc-windows-gnu",
|
||||
"datalayout": "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
|
||||
},
|
||||
"options": {
|
||||
"slice_level": 3,
|
||||
"target": "llvm",
|
||||
"strict_mode": true
|
||||
}
|
||||
}
|
||||
40
Test/SimdTest/temp/024a3459d0f585ae.pyi
Normal file
40
Test/SimdTest/temp/024a3459d0f585ae.pyi
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
Auto-generated Python stub file from string.py
|
||||
Module: string
|
||||
"""
|
||||
|
||||
|
||||
from stdint import *
|
||||
import t, c
|
||||
|
||||
def strcpy(dest: str, src: str) -> str: pass
|
||||
|
||||
def strncpy(dest: str, src: str, n: t.CSizeT) -> str: pass
|
||||
|
||||
def strlen(src: str) -> t.CSizeT | t.CExport: pass
|
||||
|
||||
def strcmp(str1: str, str2: str) -> t.CInt: pass
|
||||
|
||||
def samestr(str1: str, str2: str) -> bool: pass
|
||||
|
||||
def strncmp(str1: str, str2: str, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def memcmp(ptr1: t.CVoid | t.CPtr, ptr2: t.CVoid | t.CPtr, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def strchr(s: str, cr: t.CInt) -> str: pass
|
||||
|
||||
def strrchr(s: str, cr: t.CInt) -> str: pass
|
||||
|
||||
def strspn(s: str, skip: str) -> int: pass
|
||||
|
||||
def memset(ptr: t.CVoid | t.CPtr, value: t.CInt, num: t.CSizeT) -> t.CVoid | t.CPtr | t.CExport: pass
|
||||
|
||||
def memset32(ptr: t.CVoid | t.CPtr, value: t.CUInt32T, count: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
|
||||
def memcpy(dest: t.CVoid | t.CPtr, src: t.CVoid | t.CPtr, num: t.CSizeT) -> t.CVoid | t.CPtr | t.CExport: pass
|
||||
|
||||
def memmove(dest: t.CVoid | t.CPtr, src: t.CVoid | t.CPtr, num: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
|
||||
def atoi(src: str) -> t.CInt: pass
|
||||
|
||||
def split(s: str, delim: str, result: list[str]) -> int: pass
|
||||
58
Test/SimdTest/temp/1b666d438f4d301e.pyi
Normal file
58
Test/SimdTest/temp/1b666d438f4d301e.pyi
Normal file
@@ -0,0 +1,58 @@
|
||||
"""
|
||||
Auto-generated Python stub file from main.py
|
||||
Module: main
|
||||
"""
|
||||
|
||||
|
||||
from stdint import *
|
||||
import vipersimd
|
||||
import numpy
|
||||
from stdio import printf
|
||||
import stdlib
|
||||
from stdlib import calloc
|
||||
import t, c
|
||||
import mpool
|
||||
|
||||
arena: t.CExtern | t.CUInt8T | t.CPtr
|
||||
pool: t.CExtern | mpool.MPool | t.CPtr
|
||||
|
||||
def clock() -> t.CLong | t.CExtern: pass
|
||||
|
||||
|
||||
CLOCK_PER_SEC: t.CDefine = 1000
|
||||
test_passed: t.CExtern | t.CInt
|
||||
test_failed: t.CExtern | t.CInt
|
||||
|
||||
def check(name: str, condition: t.CInt, detail: str) -> t.CInt: pass
|
||||
|
||||
def section(title: str) -> t.CInt: pass
|
||||
|
||||
def test_avx2_add_sub_mul_div() -> t.CInt: pass
|
||||
|
||||
def test_avx2_neg_abs_sqrt() -> t.CInt: pass
|
||||
|
||||
def test_avx2_min_max() -> t.CInt: pass
|
||||
|
||||
def test_avx2_scalar_ops() -> t.CInt: pass
|
||||
|
||||
def test_avx2_hsum_dot() -> t.CInt: pass
|
||||
|
||||
def test_avx2_fma() -> t.CInt: pass
|
||||
|
||||
def test_batch_array_ops() -> t.CInt: pass
|
||||
|
||||
def test_llvmir_scalar() -> t.CInt: pass
|
||||
|
||||
|
||||
N_ELEM: t.CDefine = 40000
|
||||
N_ITER: t.CDefine = 50000
|
||||
|
||||
def scalar_add_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def scalar_mul_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def scalar_sqrt_array(a: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CInt: pass
|
||||
|
||||
def benchmark_simd_vs_scalar() -> t.CInt: pass
|
||||
|
||||
def main() -> t.CInt: pass
|
||||
128
Test/SimdTest/temp/3f7c5e78d8652535.pyi
Normal file
128
Test/SimdTest/temp/3f7c5e78d8652535.pyi
Normal file
@@ -0,0 +1,128 @@
|
||||
"""
|
||||
Auto-generated Python stub file from vipermath.py
|
||||
Module: vipermath
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
U_M_PI: t.CDefine = 3.14159265358979323846
|
||||
U_M_E: t.CDefine = 2.71828182845904523536
|
||||
U_M_PI_2: t.CDefine = 1.57079632679489661923
|
||||
U_M_PI_4: t.CDefine = 0.78539816339744830962
|
||||
U_M_1_PI: t.CDefine = 0.31830988618379067154
|
||||
U_M_2_PI: t.CDefine = 0.63661977236758134308
|
||||
U_M_LN2: t.CDefine = 0.69314718055994530942
|
||||
U_M_LN10: t.CDefine = 2.30258509299404568402
|
||||
U_M_2_SQRT_PI: t.CDefine = 1.77245385090551602730
|
||||
|
||||
def radians(degrees: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def degrees(radians: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def sin(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def cos(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def tan(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def asin(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def acos(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def _atan_core(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def atan(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def atan2(y: t.CDouble, x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def sinh(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def cosh(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def tanh(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def exp(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def log(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def sqrt(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def abs(x: t.CInt) -> t.CInt: pass
|
||||
|
||||
def fabs(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def labs(x: t.CLong) -> t.CLong: pass
|
||||
|
||||
def factorial(n: t.CInt) -> t.CDouble: pass
|
||||
|
||||
def combination(n: t.CInt, k: t.CInt) -> t.CDouble: pass
|
||||
|
||||
def permutation(n: t.CInt, k: t.CInt) -> t.CDouble: pass
|
||||
|
||||
def pow(x: t.CDouble, y: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def powf(x: t.CDouble, y: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def cbrt(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def hypot(x: t.CDouble, y: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def floor(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def ceil(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def round(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def trunc(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def fmod(x: t.CDouble, y: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def fmodf(x: float, y: float) -> float: pass
|
||||
|
||||
def modf(x: t.CDouble, iptr: t.CDouble | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def log10(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def log2(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def exp2(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def expm1(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def log1p(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def asinh(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def acosh(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def atanh(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def gamma(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def erf(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def erfc(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def sqrtf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
def sinf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
def cosf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
def tanf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
def fabsf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
def floorf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
def ceilf(x: t.CFloat) -> t.CFloat: pass
|
||||
|
||||
|
||||
class _U(t.CUnion):
|
||||
d: t.CDouble
|
||||
u: t.CUInt64T
|
||||
|
||||
def isnan(x: t.CDouble) -> t.CStatic | t.CInt: pass
|
||||
|
||||
def isinf(x: t.CDouble) -> t.CStatic | t.CInt: pass
|
||||
67
Test/SimdTest/temp/56cdd754a8a09347.pyi
Normal file
67
Test/SimdTest/temp/56cdd754a8a09347.pyi
Normal file
@@ -0,0 +1,67 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdint.py
|
||||
Module: stdint
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
import t
|
||||
|
||||
INT: t.CTypedef = t.CInt
|
||||
INTPTR: t.CTypedef = t.CInt | t.CPtr
|
||||
BOOL: t.CTypedef = t.CInt
|
||||
UINT: t.CTypedef = t.CUnsignedInt
|
||||
UINTPTR: t.CTypedef = UINT | t.CPtr
|
||||
BYTE: t.CTypedef = t.CUnsignedChar
|
||||
BYTEPTR: t.CTypedef = BYTE | t.CPtr
|
||||
WORD: t.CTypedef = t.CUInt16T
|
||||
DWORD: t.CTypedef = t.CUInt32T
|
||||
QWORD: t.CTypedef = t.CUInt64T
|
||||
TCHAR: t.CTypedef = t.CChar
|
||||
CHARLIST: t.CTypedef = str | t.CPtr
|
||||
VOID: t.CTypedef = t.CVoid
|
||||
SHORT: t.CTypedef = t.CShort
|
||||
SHORTPTR: t.CTypedef = t.CShort | t.CPtr
|
||||
USHORT: t.CTypedef = t.CUnsignedShort
|
||||
USHORTPTR: t.CTypedef = t.CUnsignedShort | t.CPtr
|
||||
LONGLONG: t.CTypedef = t.CLong | t.CLong
|
||||
ULONGLONG: t.CTypedef = t.CUnsignedLong | t.CLong
|
||||
LONG: t.CTypedef = t.CLong
|
||||
ULONG: t.CTypedef = t.CUnsignedLong
|
||||
WCHAR: t.CTypedef = WORD
|
||||
WCHARPTR: t.CTypedef = WORD | t.CPtr
|
||||
CHARPTR: t.CTypedef = t.CChar | t.CPtr
|
||||
FSIZE_t: t.CTypedef = DWORD
|
||||
LBA_t: t.CTypedef = DWORD
|
||||
UINTPTR: t.CTypedef = t.CUnsignedInt | t.CPtr
|
||||
VOIDPTR: t.CTypedef = t.CVoid | t.CPtr
|
||||
FLOAT: t.CTypedef = t.CFloat
|
||||
DOUBLE: t.CTypedef = t.CDouble
|
||||
FLOAT8: t.CTypedef = t.CFloat8T
|
||||
FLOAT16: t.CTypedef = t.CFloat16T
|
||||
FLOAT32: t.CTypedef = t.CFloat32T
|
||||
FLOAT64: t.CTypedef = t.CFloat64T
|
||||
FLOAT128: t.CTypedef = t.CFloat128T
|
||||
INT8: t.CTypedef = t.CInt8T
|
||||
INT16: t.CTypedef = t.CInt16T
|
||||
INT32: t.CTypedef = t.CInt32T
|
||||
INT64: t.CTypedef = t.CInt64T
|
||||
UINT8: t.CTypedef = t.CUInt8T
|
||||
UINT16: t.CTypedef = t.CUInt16T
|
||||
UINT32: t.CTypedef = t.CUInt32T
|
||||
UINT64: t.CTypedef = t.CUInt64T
|
||||
INT8PTR: t.CTypedef = t.CInt8T | t.CPtr
|
||||
INT16PTR: t.CTypedef = t.CInt16T | t.CPtr
|
||||
INT32PTR: t.CTypedef = t.CInt32T | t.CPtr
|
||||
INT64PTR: t.CTypedef = t.CInt64T | t.CPtr
|
||||
UINT8PTR: t.CTypedef = t.CUInt8T | t.CPtr
|
||||
UINT16PTR: t.CTypedef = t.CUInt16T | t.CPtr
|
||||
UINT32PTR: t.CTypedef = t.CUInt32T | t.CPtr
|
||||
UINT64PTR: t.CTypedef = t.CUInt64T | t.CPtr
|
||||
CHAR8: t.CTypedef = t.CChar8T
|
||||
CHAR16: t.CTypedef = t.CChar16T
|
||||
CHAR32: t.CTypedef = t.CChar32T
|
||||
CHAR8PTR: t.CTypedef = t.CChar8T | t.CPtr
|
||||
CHAR16PTR: t.CTypedef = t.CChar16T | t.CPtr
|
||||
CHAR32PTR: t.CTypedef = t.CChar32T | t.CPtr
|
||||
50
Test/SimdTest/temp/68c4fe4b12c908e3.pyi
Normal file
50
Test/SimdTest/temp/68c4fe4b12c908e3.pyi
Normal file
@@ -0,0 +1,50 @@
|
||||
"""
|
||||
Auto-generated Python stub file from mpool.py
|
||||
Module: mpool
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
import viperio
|
||||
import string
|
||||
|
||||
MPOOL_ALIGN: t.CDefine = 8
|
||||
MPOOL_TYPE_SLAB: t.CDefine = 0
|
||||
MPOOL_TYPE_BUMP: t.CDefine = 2
|
||||
|
||||
def _align_up(val: t.CSizeT, align: t.CSizeT) -> t.CSizeT: pass
|
||||
|
||||
|
||||
class MPool:
|
||||
mtype: t.CInt
|
||||
mem: t.CVoid | t.CPtr
|
||||
mem_size: t.CSizeT
|
||||
offset: t.CSizeT
|
||||
high_water: t.CSizeT
|
||||
block_size: t.CSizeT
|
||||
block_count: t.CSizeT
|
||||
used_count: t.CSizeT
|
||||
free_list: t.CVoid | t.CPtr
|
||||
alloc_map: t.CUInt8T | t.CPtr
|
||||
alloc_map_size: t.CSizeT
|
||||
def __init__(self: MPool, mem: t.CVoid | t.CPtr, mem_size: t.CSizeT, block_size: t.CSizeT) -> t.CInt: pass
|
||||
def _init_bump(self: MPool, mem: t.CVoid | t.CPtr, mem_size: t.CSizeT) -> t.CInt: pass
|
||||
def _init_slab(self: MPool, mem: t.CVoid | t.CPtr, mem_size: t.CSizeT, block_size: t.CSizeT) -> t.CInt: pass
|
||||
def __enter__(self: MPool) -> 'MPool' | t.CPtr: pass
|
||||
def __exit__(self: MPool) -> t.CInt: pass
|
||||
def _slab_reset(self: MPool) -> t.CInt: pass
|
||||
def alloc(self: MPool, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def alloc_buf(self: MPool, capacity: t.CSizeT) -> viperio.Buf | t.CPtr: pass
|
||||
def free(self: MPool, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
def realloc(self: MPool, ptr: t.CVoid | t.CPtr, old_size: t.CSizeT, new_size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def reset(self: MPool) -> t.CInt: pass
|
||||
def _bump_alloc(self: MPool, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
def _slab_alloc(self: MPool) -> t.CVoid | t.CPtr: pass
|
||||
def _slab_free(self: MPool, ptr: t.CVoid | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def bump_create(mem: t.CVoid | t.CPtr, mem_size: t.CSizeT) -> MPool | t.CPtr: pass
|
||||
|
||||
def alloc(pool: MPool | t.CPtr, size: t.CSizeT) -> t.CVoid | t.CPtr: pass
|
||||
|
||||
def reset(pool: MPool | t.CPtr) -> t.CInt: pass
|
||||
28
Test/SimdTest/temp/73edbcf76e32d00b.pyi
Normal file
28
Test/SimdTest/temp/73edbcf76e32d00b.pyi
Normal file
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdio.py
|
||||
Module: stdio
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
def printf(fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
def fprintf(stream: t.CVoid | t.CPtr, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
def sprintf(buf: t.CChar | t.CPtr, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
def snprintf(buf: t.CChar | t.CPtr, size: t.CSizeT, fmt: t.CChar | t.CConst | t.CPtr, *args) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
def puts(s: t.CChar | t.CConst | t.CPtr) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
def fputs(s: t.CChar | t.CConst | t.CPtr, stream: t.CVoid | t.CPtr) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
def fgets(buf: t.CChar | t.CPtr, size: t.CInt, stream: t.CVoid | t.CPtr) -> t.CChar | t.CPtr | t.CExtern | t.CExport: pass
|
||||
|
||||
def fflush(stream: t.CVoid | t.CPtr) -> t.CInt | t.CExtern | t.CExport: pass
|
||||
|
||||
|
||||
stdin: t.CExtern | t.CVoid | t.CPtr
|
||||
stdout: t.CExtern | t.CVoid | t.CPtr
|
||||
stderr: t.CExtern | t.CVoid | t.CPtr
|
||||
18
Test/SimdTest/temp/7538e542cab4c1d5.pyi
Normal file
18
Test/SimdTest/temp/7538e542cab4c1d5.pyi
Normal file
@@ -0,0 +1,18 @@
|
||||
"""
|
||||
Auto-generated Python stub file from stdlib.py
|
||||
Module: stdlib
|
||||
"""
|
||||
|
||||
import c
|
||||
|
||||
|
||||
from stdint import *
|
||||
import t
|
||||
|
||||
def malloc(size: UINT) -> t.CVoid | t.CPtr | t.State | t.CExtern | t.CExport: pass
|
||||
|
||||
def calloc(nmemb: UINT, size: UINT) -> t.CVoid | t.CPtr | t.State | t.CExtern | t.CExport: pass
|
||||
|
||||
def realloc(p: str, p2: t.CLong | t.CLong) -> t.CVoid | t.CPtr | t.State | t.CExtern | t.CExport: pass
|
||||
|
||||
def free(p: t.CVoid | t.CPtr) -> None | t.State | t.CExtern | t.CExport: pass
|
||||
10
Test/SimdTest/temp/_sha1_map.txt
Normal file
10
Test/SimdTest/temp/_sha1_map.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
024a3459d0f585ae:includes/string.py
|
||||
1b666d438f4d301e:main.py
|
||||
3f7c5e78d8652535:includes/vipermath.py
|
||||
56cdd754a8a09347:includes/stdint.py
|
||||
68c4fe4b12c908e3:includes/mpool.py
|
||||
73edbcf76e32d00b:includes/stdio.py
|
||||
7538e542cab4c1d5:includes/stdlib.py
|
||||
c3eb91093118e1e1:includes/numpy\__init__.py
|
||||
c9f4be41ca1cc2b4:includes/viperio.py
|
||||
fe99c83946298690:includes/vipersimd.py
|
||||
234
Test/SimdTest/temp/c3eb91093118e1e1.pyi
Normal file
234
Test/SimdTest/temp/c3eb91093118e1e1.pyi
Normal file
@@ -0,0 +1,234 @@
|
||||
"""
|
||||
Auto-generated Python stub file from numpy.__init__.py
|
||||
Module: numpy.__init__
|
||||
"""
|
||||
|
||||
|
||||
from stdint import *
|
||||
import stdlib
|
||||
import string
|
||||
import vipermath
|
||||
import stdio
|
||||
import t, c
|
||||
import mpool
|
||||
|
||||
MAX_NDIM: t.CDefine = 4
|
||||
float64: t.CTypedef = t.CDouble
|
||||
float32: t.CTypedef = t.CFloat
|
||||
int64: t.CTypedef = t.CLong
|
||||
int32: t.CTypedef = t.CInt
|
||||
uint8: t.CTypedef = t.CUnsignedChar
|
||||
pi: t.CDefine = 3.14159265358979323846
|
||||
e: t.CDefine = 2.71828182845904523536
|
||||
|
||||
@t.Object
|
||||
class ndarray:
|
||||
data: t.CDouble | t.CPtr
|
||||
shape: list[t.CSizeT, MAX_NDIM]
|
||||
strides: list[t.CSizeT, MAX_NDIM]
|
||||
ndim: t.CInt
|
||||
size: t.CSizeT
|
||||
owns_data: t.CInt
|
||||
pool: mpool.MPool | t.CPtr
|
||||
def __new__(self: ndarray, pool: mpool.MPool | t.CPtr, n: t.CSizeT) -> t.CInt: pass
|
||||
def __add__(self: ndarray, other: 'ndarray' | t.CPtr) -> 'ndarray' | t.CPtr: pass
|
||||
def __sub__(self: ndarray, other: 'ndarray' | t.CPtr) -> 'ndarray' | t.CPtr: pass
|
||||
def __mul__(self: ndarray, other: 'ndarray' | t.CPtr) -> 'ndarray' | t.CPtr: pass
|
||||
def __truediv__(self: ndarray, other: 'ndarray' | t.CPtr) -> 'ndarray' | t.CPtr: pass
|
||||
def __floordiv__(self: ndarray, other: 'ndarray' | t.CPtr) -> 'ndarray' | t.CPtr: pass
|
||||
def __mod__(self: ndarray, other: 'ndarray' | t.CPtr) -> 'ndarray' | t.CPtr: pass
|
||||
def __neg__(self: ndarray) -> 'ndarray' | t.CPtr: pass
|
||||
def __len__(self: ndarray) -> t.CInt: pass
|
||||
def at2d(self: ndarray, row: t.CSizeT, col: t.CSizeT) -> t.CDouble: pass
|
||||
def set2d(self: ndarray, row: t.CSizeT, col: t.CSizeT, val: t.CDouble) -> t.CInt: pass
|
||||
def delete(self: ndarray) -> t.CInt: pass
|
||||
def fill(self: ndarray, val: t.CDouble) -> t.CInt: pass
|
||||
def copy(self: ndarray) -> 'ndarray' | t.CPtr: pass
|
||||
def reshape(self: ndarray, new_shape: INTPTR, new_ndim: t.CInt) -> 'ndarray' | t.CPtr: pass
|
||||
def sum(self: ndarray) -> t.CDouble: pass
|
||||
def mean(self: ndarray) -> t.CDouble: pass
|
||||
def min(self: ndarray) -> t.CDouble: pass
|
||||
def max(self: ndarray) -> t.CDouble: pass
|
||||
def argmax(self: ndarray) -> t.CInt: pass
|
||||
def argmin(self: ndarray) -> t.CInt: pass
|
||||
def dot(self: ndarray, other: 'ndarray' | t.CPtr) -> t.CDouble: pass
|
||||
def T(self: ndarray) -> 'ndarray' | t.CPtr: pass
|
||||
def print_arr(self: ndarray) -> t.CInt: pass
|
||||
|
||||
def _alloc_ndarray(pool: mpool.MPool | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def _compute_strides(a: ndarray | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def _empty_like(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def array(pool: mpool.MPool | t.CPtr, data: t.CDouble | t.CPtr, n: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def zeros(pool: mpool.MPool | t.CPtr, n: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def ones(pool: mpool.MPool | t.CPtr, n: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def full(pool: mpool.MPool | t.CPtr, n: t.CSizeT, val: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def arange(pool: mpool.MPool | t.CPtr, start: t.CDouble, stop: t.CDouble, step: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def linspace(pool: mpool.MPool | t.CPtr, start: t.CDouble, stop: t.CDouble, num: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def empty2d(pool: mpool.MPool | t.CPtr, rows: t.CSizeT, cols: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def zeros2d(pool: mpool.MPool | t.CPtr, rows: t.CSizeT, cols: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def ones2d(pool: mpool.MPool | t.CPtr, rows: t.CSizeT, cols: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def eye(pool: mpool.MPool | t.CPtr, n: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def diag(pool: mpool.MPool | t.CPtr, vals: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_abs(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_sqrt(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_exp(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_log(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_sin(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_cos(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_tan(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_pow(a: ndarray | t.CPtr, p: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def add_scalar(a: ndarray | t.CPtr, s: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def mul_scalar(a: ndarray | t.CPtr, s: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def sub_scalar(a: ndarray | t.CPtr, s: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def div_scalar(a: ndarray | t.CPtr, s: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def matmul(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def dot_product(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def np_sum(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def np_mean(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def np_min(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def np_max(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def np_argmax(a: ndarray | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def np_argmin(a: ndarray | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def var(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def std(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def norm(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def clip(a: ndarray | t.CPtr, lo: t.CDouble, hi: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def concatenate(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def sort_arr(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def reverse(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_log10(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_log2(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_floor(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_ceil(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_round(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_sign(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_tanh(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_sinh(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_cosh(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_arcsin(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_arccos(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_arctan(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_arctan2(y: ndarray | t.CPtr, x: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_degrees(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_radians(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_isnan(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_isinf(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_maximum(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_minimum(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def cumsum(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def diff(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def flatten(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def trace(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def outer(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_where(condition: ndarray | t.CPtr, x: ndarray | t.CPtr, y: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_count_nonzero(a: ndarray | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def np_all(a: ndarray | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def np_any(a: ndarray | t.CPtr) -> t.CInt: pass
|
||||
|
||||
def np_equal(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_not_equal(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_less(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_greater(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_less_equal(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_greater_equal(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def empty(pool: mpool.MPool | t.CPtr, n: t.CSizeT) -> ndarray | t.CPtr: pass
|
||||
|
||||
def full2d(pool: mpool.MPool | t.CPtr, rows: t.CSizeT, cols: t.CSizeT, val: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def zeros_like(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def ones_like(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def arange1(pool: mpool.MPool | t.CPtr, stop: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def linspace2(pool: mpool.MPool | t.CPtr, start: t.CDouble, stop: t.CDouble) -> ndarray | t.CPtr: pass
|
||||
|
||||
def meshgrid(x: ndarray | t.CPtr, y: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def det2x2(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def inv2x2(a: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def cross3(a: ndarray | t.CPtr, b: ndarray | t.CPtr) -> ndarray | t.CPtr: pass
|
||||
|
||||
def np_interp(x: t.CDouble, xp: ndarray | t.CPtr, fp: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def prod(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def median(a: ndarray | t.CPtr) -> t.CDouble: pass
|
||||
|
||||
def percentile(a: ndarray | t.CPtr, q: t.CDouble) -> t.CDouble: pass
|
||||
22
Test/SimdTest/temp/c9f4be41ca1cc2b4.pyi
Normal file
22
Test/SimdTest/temp/c9f4be41ca1cc2b4.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
Auto-generated Python stub file from viperio.py
|
||||
Module: viperio
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
from stdint import *
|
||||
|
||||
class Buf:
|
||||
data: t.CChar | t.CPtr
|
||||
length: t.CSizeT
|
||||
capacity: t.CSizeT
|
||||
owned: bool
|
||||
def __init__(self: Buf, data: t.CChar | t.CPtr, capacity: t.CSizeT, length: t.CSizeT, owned: bool) -> t.CInt: pass
|
||||
def clear(self: Buf) -> t.CInt: pass
|
||||
def write(self: Buf, src: t.CChar | t.CPtr, count: t.CSizeT) -> t.CSizeT: pass
|
||||
def cstr(self: Buf) -> t.CChar | t.CPtr: pass
|
||||
def reset(self: Buf) -> t.CInt: pass
|
||||
def __enter__(self: Buf) -> 'Buf' | t.CPtr: pass
|
||||
def __exit__(self: Buf) -> t.CInt: pass
|
||||
def free(self: Buf) -> t.CInt: pass
|
||||
89
Test/SimdTest/temp/fe99c83946298690.pyi
Normal file
89
Test/SimdTest/temp/fe99c83946298690.pyi
Normal file
@@ -0,0 +1,89 @@
|
||||
"""
|
||||
Auto-generated Python stub file from vipersimd.py
|
||||
Module: vipersimd
|
||||
"""
|
||||
|
||||
|
||||
import t, c
|
||||
|
||||
def simd_add4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_sub4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_mul4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_div4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_sqrt4d(a: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_neg4d(a: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_abs4d(a: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_max4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_min4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_mul_scalar4d(a: t.CPtr, scalar: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_add_scalar4d(a: t.CPtr, scalar: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_hsum4d(a: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_dot4d(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_fma4d(a: t.CPtr, b: t.CPtr, c_val: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_add4f(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_sub4f(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_mul4f(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_div4f(a: t.CPtr, b: t.CPtr, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_add_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CVoid: pass
|
||||
|
||||
def simd_sub_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CVoid: pass
|
||||
|
||||
def simd_mul_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CVoid: pass
|
||||
|
||||
def simd_div_array(a: t.CPtr, b: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CVoid: pass
|
||||
|
||||
def simd_sqrt_array(a: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CVoid: pass
|
||||
|
||||
def simd_abs_array(a: t.CPtr, out: t.CPtr, n: t.CSizeT) -> t.CVoid: pass
|
||||
|
||||
def simd_dot_array(a: t.CPtr, b: t.CPtr, n: t.CSizeT, out: t.CPtr) -> t.CVoid: pass
|
||||
|
||||
def simd_sqrt(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_fabs(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_floor(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_ceil(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_round(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_trunc(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_fma(a: t.CDouble, b: t.CDouble, c_val: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_copysign(mag: t.CDouble, sign: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_neg(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_minnum(a: t.CDouble, b: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_maxnum(a: t.CDouble, b: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_exp(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_log(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_sin(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_cos(x: t.CDouble) -> t.CDouble: pass
|
||||
|
||||
def simd_pow(x: t.CDouble, y: t.CDouble) -> t.CDouble: pass
|
||||
Reference in New Issue
Block a user