修复了大量存在的问题,增加了假鸭子类型等等机制

This commit is contained in:
2026-06-25 14:49:46 +08:00
parent 19f2787db0
commit d88d11b646
827 changed files with 32617 additions and 18316 deletions

View File

@@ -6,6 +6,7 @@ import stdlib
from stdlib import calloc
import t, c
import mpool
import testcheck
# 全局内存池
@@ -17,28 +18,13 @@ 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")
testcheck.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)
@@ -55,27 +41,27 @@ def test_avx2_add_sub_mul_div():
# 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), "")
testcheck.check(out.data[0] == t.CDouble(6.0), "add[0]==6", "add[0]==6")
testcheck.check(out.data[1] == t.CDouble(8.0), "add[1]==8", "add[1]==8")
testcheck.check(out.data[2] == t.CDouble(10.0), "add[2]==10", "add[2]==10")
testcheck.check(out.data[3] == t.CDouble(12.0), "add[3]==12", "add[3]==12")
# 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), "")
testcheck.check(out.data[0] == t.CDouble(-4.0), "sub[0]==-4", "sub[0]==-4")
testcheck.check(out.data[3] == t.CDouble(-4.0), "sub[3]==-4", "sub[3]==-4")
# 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), "")
testcheck.check(out.data[0] == t.CDouble(5.0), "mul[0]==5", "mul[0]==5")
testcheck.check(out.data[1] == t.CDouble(12.0), "mul[1]==12", "mul[1]==12")
testcheck.check(out.data[2] == t.CDouble(21.0), "mul[2]==21", "mul[2]==21")
testcheck.check(out.data[3] == t.CDouble(32.0), "mul[3]==32", "mul[3]==32")
# 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), "")
testcheck.check(out.data[0] == t.CDouble(5.0), "div[0]==5", "div[0]==5")
testcheck.check(out.data[1] == t.CDouble(3.0), "div[1]==3", "div[1]==3")
a.delete()
b.delete()
@@ -83,7 +69,7 @@ def test_avx2_add_sub_mul_div():
def test_avx2_neg_abs_sqrt():
section("AVX2 neg/abs/sqrt 4d")
testcheck.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)
@@ -94,31 +80,31 @@ def test_avx2_neg_abs_sqrt():
# 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), "")
testcheck.check(out.data[0] == t.CDouble(-1.0), "neg[0]==-1", "neg[0]==-1")
testcheck.check(out.data[1] == t.CDouble(4.0), "neg[1]==4", "neg[1]==4")
testcheck.check(out.data[2] == t.CDouble(-9.0), "neg[2]==-9", "neg[2]==-9")
testcheck.check(out.data[3] == t.CDouble(16.0), "neg[3]==16", "neg[3]==16")
# 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), "")
testcheck.check(out.data[0] == t.CDouble(1.0), "abs[0]==1", "abs[0]==1")
testcheck.check(out.data[1] == t.CDouble(4.0), "abs[1]==4", "abs[1]==4")
testcheck.check(out.data[2] == t.CDouble(9.0), "abs[2]==9", "abs[2]==9")
testcheck.check(out.data[3] == t.CDouble(16.0), "abs[3]==16", "abs[3]==16")
# 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), "")
testcheck.check(out.data[0] == t.CDouble(1.0), "sqrt[0]==1", "sqrt[0]==1")
testcheck.check(out.data[1] == t.CDouble(2.0), "sqrt[1]==2", "sqrt[1]==2")
testcheck.check(out.data[2] == t.CDouble(3.0), "sqrt[2]==3", "sqrt[2]==3")
testcheck.check(out.data[3] == t.CDouble(4.0), "sqrt[3]==4", "sqrt[3]==4")
a.delete()
out.delete()
def test_avx2_min_max():
section("AVX2 min/max 4d")
testcheck.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)
@@ -134,16 +120,16 @@ def test_avx2_min_max():
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), "")
testcheck.check(out.data[0] == t.CDouble(1.0), "min[0]==1", "min[0]==1")
testcheck.check(out.data[1] == t.CDouble(2.0), "min[1]==2", "min[1]==2")
testcheck.check(out.data[2] == t.CDouble(3.0), "min[2]==3", "min[2]==3")
testcheck.check(out.data[3] == t.CDouble(4.0), "min[3]==4", "min[3]==4")
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), "")
testcheck.check(out.data[0] == t.CDouble(5.0), "max[0]==5", "max[0]==5")
testcheck.check(out.data[1] == t.CDouble(8.0), "max[1]==8", "max[1]==8")
testcheck.check(out.data[2] == t.CDouble(7.0), "max[2]==7", "max[2]==7")
testcheck.check(out.data[3] == t.CDouble(6.0), "max[3]==6", "max[3]==6")
a.delete()
b.delete()
@@ -151,7 +137,7 @@ def test_avx2_min_max():
def test_avx2_scalar_ops():
section("AVX2 scalar broadcast ops")
testcheck.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)
@@ -164,13 +150,13 @@ def test_avx2_scalar_ops():
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), "")
testcheck.check(out.data[0] == t.CDouble(10.0), "mul_scalar[0]==10", "mul_scalar[0]==10")
testcheck.check(out.data[1] == t.CDouble(20.0), "mul_scalar[1]==20", "mul_scalar[1]==20")
testcheck.check(out.data[3] == t.CDouble(40.0), "mul_scalar[3]==40", "mul_scalar[3]==40")
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), "")
testcheck.check(out.data[0] == t.CDouble(11.0), "add_scalar[0]==11", "add_scalar[0]==11")
testcheck.check(out.data[3] == t.CDouble(14.0), "add_scalar[3]==14", "add_scalar[3]==14")
a.delete()
s.delete()
@@ -178,7 +164,7 @@ def test_avx2_scalar_ops():
def test_avx2_hsum_dot():
section("AVX2 hsum/dot 4d")
testcheck.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)
@@ -194,10 +180,10 @@ def test_avx2_hsum_dot():
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), "")
testcheck.check(out.data[0] == t.CDouble(10.0), "hsum==10", "hsum==10")
vipersimd.simd_dot4d(a.data, b.data, out.data)
check("dot==70", out.data[0] == t.CDouble(70.0), "")
testcheck.check(out.data[0] == t.CDouble(70.0), "dot==70", "dot==70")
a.delete()
b.delete()
@@ -205,7 +191,7 @@ def test_avx2_hsum_dot():
def test_avx2_fma():
section("AVX2 FMA 4d")
testcheck.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)
@@ -223,10 +209,10 @@ def test_avx2_fma():
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), "")
testcheck.check(out.data[0] == t.CDouble(6.0), "fma[0]==6", "fma[0]==6")
testcheck.check(out.data[1] == t.CDouble(13.0), "fma[1]==13", "fma[1]==13")
testcheck.check(out.data[2] == t.CDouble(22.0), "fma[2]==22", "fma[2]==22")
testcheck.check(out.data[3] == t.CDouble(33.0), "fma[3]==33", "fma[3]==33")
a.delete()
b.delete()
@@ -239,7 +225,7 @@ def test_avx2_fma():
# ============================================================
def test_batch_array_ops():
section("Batch array operations")
testcheck.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))
@@ -247,13 +233,13 @@ def test_batch_array_ops():
# 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), "")
testcheck.check(out.data[0] == t.CDouble(3.0), "add_arr[0]==3", "add_arr[0]==3")
testcheck.check(out.data[15] == t.CDouble(18.0), "add_arr[15]==18", "add_arr[15]==18")
# 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), "")
testcheck.check(out.data[0] == t.CDouble(2.0), "mul_arr[0]==2", "mul_arr[0]==2")
testcheck.check(out.data[3] == t.CDouble(8.0), "mul_arr[3]==8", "mul_arr[3]==8")
# sqrt array
c: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
@@ -263,8 +249,8 @@ def test_batch_array_ops():
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), "")
testcheck.check(out4.data[0] == t.CDouble(2.0), "sqrt_arr[0]==2", "sqrt_arr[0]==2")
testcheck.check(out4.data[3] == t.CDouble(5.0), "sqrt_arr[3]==5", "sqrt_arr[3]==5")
# abs array
d: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
@@ -273,9 +259,9 @@ def test_batch_array_ops():
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), "")
testcheck.check(out4.data[0] == t.CDouble(1.0), "abs_arr[0]==1", "abs_arr[0]==1")
testcheck.check(out4.data[1] == t.CDouble(2.0), "abs_arr[1]==2", "abs_arr[1]==2")
testcheck.check(out4.data[3] == t.CDouble(4.0), "abs_arr[3]==4", "abs_arr[3]==4")
# dot array
e: numpy.ndarray | t.CPtr = numpy.zeros(pool, 4)
@@ -286,7 +272,7 @@ def test_batch_array_ops():
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), "")
testcheck.check(out1.data[0] == t.CDouble(10.0), "dot_arr==10", "dot_arr==10")
a.delete()
b.delete()
@@ -304,71 +290,71 @@ def test_batch_array_ops():
# ============================================================
def test_llvmir_scalar():
section("LLVMIR precise scalar ops")
testcheck.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), "")
testcheck.check(r == t.CDouble(2.0), "sqrt(4)==2", "sqrt(4)==2")
# fabs
r = vipersimd.simd_fabs(t.CDouble(-3.5))
check("fabs(-3.5)==3.5", r == t.CDouble(3.5), "")
testcheck.check(r == t.CDouble(3.5), "fabs(-3.5)==3.5", "fabs(-3.5)==3.5")
# floor
r = vipersimd.simd_floor(t.CDouble(3.7))
check("floor(3.7)==3", r == t.CDouble(3.0), "")
testcheck.check(r == t.CDouble(3.0), "floor(3.7)==3", "floor(3.7)==3")
# ceil
r = vipersimd.simd_ceil(t.CDouble(3.2))
check("ceil(3.2)==4", r == t.CDouble(4.0), "")
testcheck.check(r == t.CDouble(4.0), "ceil(3.2)==4", "ceil(3.2)==4")
# round
r = vipersimd.simd_round(t.CDouble(3.5))
check("round(3.5)==4", r == t.CDouble(4.0), "")
testcheck.check(r == t.CDouble(4.0), "round(3.5)==4", "round(3.5)==4")
# trunc
r = vipersimd.simd_trunc(t.CDouble(3.9))
check("trunc(3.9)==3", r == t.CDouble(3.0), "")
testcheck.check(r == t.CDouble(3.0), "trunc(3.9)==3", "trunc(3.9)==3")
# 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), "")
testcheck.check(r == t.CDouble(7.0), "fma(2,3,1)==7", "fma(2,3,1)==7")
# copysign
r = vipersimd.simd_copysign(t.CDouble(3.0), t.CDouble(-1.0))
check("copysign(3,-1)==-3", r == t.CDouble(-3.0), "")
testcheck.check(r == t.CDouble(-3.0), "copysign(3,-1)==-3", "copysign(3,-1)==-3")
# neg
r = vipersimd.simd_neg(t.CDouble(1.5))
check("neg(1.5)==-1.5", r == t.CDouble(-1.5), "")
testcheck.check(r == t.CDouble(-1.5), "neg(1.5)==-1.5", "neg(1.5)==-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), "")
testcheck.check(r == t.CDouble(2.0), "minnum(2,3)==2", "minnum(2,3)==2")
# maxnum
r = vipersimd.simd_maxnum(t.CDouble(2.0), t.CDouble(3.0))
check("maxnum(2,3)==3", r == t.CDouble(3.0), "")
testcheck.check(r == t.CDouble(3.0), "maxnum(2,3)==3", "maxnum(2,3)==3")
# 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), "")
testcheck.check(r > t.CDouble(2.71) and r < t.CDouble(2.72), "exp(1)~=2.718", "exp(1)~=2.718")
# log
r = vipersimd.simd_log(t.CDouble(2.718281828459045))
check("log(e)~=1", r > t.CDouble(0.999) and r < t.CDouble(1.001), "")
testcheck.check(r > t.CDouble(0.999) and r < t.CDouble(1.001), "log(e)~=1", "log(e)~=1")
# sin
r = vipersimd.simd_sin(t.CDouble(0.0))
check("sin(0)~=0", r > t.CDouble(-0.001) and r < t.CDouble(0.001), "")
testcheck.check(r > t.CDouble(-0.001) and r < t.CDouble(0.001), "sin(0)~=0", "sin(0)~=0")
# cos
r = vipersimd.simd_cos(t.CDouble(0.0))
check("cos(0)~=1", r > t.CDouble(0.999) and r < t.CDouble(1.001), "")
testcheck.check(r > t.CDouble(0.999) and r < t.CDouble(1.001), "cos(0)~=1", "cos(0)~=1")
# pow
r = vipersimd.simd_pow(t.CDouble(2.0), t.CDouble(10.0))
check("pow(2,10)==1024", r == t.CDouble(1024.0), "")
testcheck.check(r == t.CDouble(1024.0), "pow(2,10)==1024", "pow(2,10)==1024")
# ============================================================
@@ -405,7 +391,7 @@ def scalar_sqrt_array(a: t.CPtr, out: t.CPtr, n: t.CSizeT):
i += 1
def benchmark_simd_vs_scalar():
section("Benchmark: SIMD vs Scalar")
testcheck.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))
@@ -484,7 +470,7 @@ def benchmark_simd_vs_scalar():
printf(" speedup=N/A\n")
# 验证结果正确性
check("bench result[0] valid", out.data[0] > t.CDouble(0.0), "")
testcheck.check(out.data[0] > t.CDouble(0.0), "bench result[0] valid", "bench result[0] valid")
a.delete()
b.delete()
@@ -501,7 +487,7 @@ def main() -> t.CInt:
arena = calloc(4096 * 1024, 1) # 4MB arena
pool = mpool.MPool(arena, 4096 * 1024, 0) # bump allocator
printf("=== ViperSIMD Test Suite ===\n")
testcheck.begin("ViperSIMD Test Suite")
test_avx2_add_sub_mul_div()
test_avx2_neg_abs_sqrt()
@@ -513,5 +499,4 @@ def main() -> t.CInt:
test_llvmir_scalar()
benchmark_simd_vs_scalar()
printf("\n=== Results: %d passed, %d failed ===\n", test_passed, test_failed)
return 0
return testcheck.end()

View File

@@ -0,0 +1 @@
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -0,0 +1 @@
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +0,0 @@
{"vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +1 @@
{"main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +0,0 @@
{"main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +0,0 @@
{"main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -0,0 +1 @@
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -0,0 +1 @@
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -0,0 +1 @@
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +0,0 @@
{"main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +1 @@
{"main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -1 +1 @@
{"main": "1b666d438f4d301e", "vipermath": "3f7c5e78d8652535", "stdint": "56cdd754a8a09347", "mpool": "68c4fe4b12c908e3", "string": "6aee24fdefa3cbc0", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "numpy.__init__": "c3eb91093118e1e1", "__init__": "c3eb91093118e1e1", "numpy": "c3eb91093118e1e1", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}
{"mpool": "0991af0d22263577", "numpy.__init__": "1787ce01c2ed0493", "__init__": "1787ce01c2ed0493", "numpy": "1787ce01c2ed0493", "vipermath": "3f7c5e78d8652535", "stdint": "49bd8cba55979f76", "stdlib": "6c2029b306556c00", "stdio": "73edbcf76e32d00b", "testcheck": "9dbecd0942a39782", "main": "b44ac2a895a4072d", "string": "b5f1dc665c52a1bd", "viperio": "c9f4be41ca1cc2b4", "vipersimd": "fe99c83946298690"}

View File

@@ -11,7 +11,7 @@ import string
MPOOL_ALIGN: t.CDefine = 8
MPOOL_TYPE_SLAB: t.CDefine = 0
MPOOL_TYPE_BUMP: t.CDefine = 2
MPOOL_TYPE_BUMP: t.CDefine = 1
def _align_up(val: t.CSizeT, align: t.CSizeT) -> t.CSizeT: pass

View File

@@ -24,8 +24,8 @@ 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]
shape: t.CArray[t.CSizeT, MAX_NDIM]
strides: t.CArray[t.CSizeT, MAX_NDIM]
ndim: t.CInt
size: t.CSizeT
owns_data: t.CInt

View File

@@ -64,4 +64,12 @@ 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
CHAR32PTR: t.CTypedef = t.CChar32T | t.CPtr
i8: t.CTypedef = t.CInt8T
i16: t.CTypedef = t.CInt16T
i32: t.CTypedef = t.CInt32T
i64: t.CTypedef = t.CInt64T
u8: t.CTypedef = t.CUInt8T
u16: t.CTypedef = t.CUInt16T
u32: t.CTypedef = t.CUInt32T
u64: t.CTypedef = t.CUInt64T

View File

@@ -0,0 +1,25 @@
"""
Auto-generated Python stub file from testcheck.py
Module: testcheck
"""
import t, c
import stdio
_pass_count: t.CExtern | t.CInt
_fail_count: t.CExtern | t.CInt
def begin(name: str) -> t.CInt: pass
def section(name: str) -> t.CInt: pass
def ok(msg: str) -> t.CInt: pass
def fail(msg: str) -> t.CInt: pass
def check(cond: t.CInt, ok_msg: str, fail_msg: str) -> t.CInt: pass
def info(msg: str) -> t.CInt: pass
def end() -> t.CInt: pass

View File

@@ -1,10 +1,11 @@
1b666d438f4d301e:main.py
0991af0d22263577:includes/mpool.py
1787ce01c2ed0493:includes/numpy\__init__.py
3f7c5e78d8652535:includes/vipermath.py
56cdd754a8a09347:includes/stdint.py
68c4fe4b12c908e3:includes/mpool.py
6aee24fdefa3cbc0:includes/string.py
49bd8cba55979f76:includes/stdint.py
6c2029b306556c00:includes/stdlib.py
73edbcf76e32d00b:includes/stdio.py
c3eb91093118e1e1:includes/numpy\__init__.py
9dbecd0942a39782:includes/testcheck.py
b44ac2a895a4072d:main.py
b5f1dc665c52a1bd:includes/string.py
c9f4be41ca1cc2b4:includes/viperio.py
fe99c83946298690:includes/vipersimd.py

View File

@@ -12,6 +12,7 @@ import stdlib
from stdlib import calloc
import t, c
import mpool
import testcheck
arena: t.CExtern | t.CUInt8T | t.CPtr
pool: t.CExtern | mpool.MPool | t.CPtr
@@ -20,12 +21,6 @@ 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

View File

@@ -41,4 +41,4 @@ def atoll(src: str) -> t.CInt64T: pass
def atof(src: str) -> t.CDouble: pass
def split(s: str, delim: str, result: list[str]) -> int: pass
def split(s: str, delim: str, result: t.CArray[str]) -> int: pass