diff options
| author | 2026-10-14 20:23:37 +0330 | |
|---|---|---|
| committer | 2026-10-14 21:33:32 +0330 | |
| commit | 5e5677e9caf3df24a476c414d604538c81ed0f2a (patch) | |
| tree | 47fc14641c527c994a7551e036b805b62072b21f /tests/bench/arrays.zc | |
| parent | bench: baseline with arrays rows (checks column pending work/checks) (diff) | |
bench: a nonzero zy exit (1 compile error, 2 trap) or a wrong checksum fails the row with the stderr tail, in suite.py and bench.sh; selftest cases for exit 1, exit 2 and a wrong checksum. arrays rows scaled to ~3 ms a repetition (matmul 40x40, gather 98304 words); the baseline's arrays rows are stale until a re-save
Diffstat (limited to 'tests/bench/arrays.zc')
| -rw-r--r-- | tests/bench/arrays.zc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/bench/arrays.zc b/tests/bench/arrays.zc index f83cebe..bbe0f01 100644 --- a/tests/bench/arrays.zc +++ b/tests/bench/arrays.zc @@ -4,19 +4,19 @@ include rt; // two array kernels where the bounds checks are the point, one whose hot loop the // compiler proves safe and one that keeps its check on purpose. zy --explain-checks // shows which checks stay (suite.py puts the count in the checks column). -// m matmul: c = a * b, 24x24, flat row-major. each row of a and column of b is +// m matmul: c = a * b, 40x40, flat row-major. each row of a and column of b is // copied into a local int[N], and the inner k loop runs k < N over those only, // so its checks are proved. the copies index the flat matrices with i * N + k, // which keeps their checks, but they run N^2 times, not N^3 -// g gather: s += data[idx[i]] over 4096 words. idx[i] is proved by i < len(idx); +// g gather: s += data[idx[i]] over 98304 words. idx[i] is proved by i < len(idx); // data[idx[i]] is indexed by a loaded value, so its check stays in the hot loop // input: a letter (m, g, or z for neither) and how many times to run it. prints a checksum. -const int N = 24; -const int G = 4096; +const int N = 40; +const int G = 98304; int matmul(fixed int[?] a, fixed int[?] b, fixed int[?] c) { - int[24] ra; - int[24] cb; + int[40] ra; + int[40] cb; int s = 0; for (int i = 0; i < N; i++) { for (int k = 0; k < N; k++) ra[k] = a[i * N + k]; @@ -44,7 +44,7 @@ fn main() { for (int i = 0; i < N * N; i++) { a[i] = i % 7 - 3; b[i] = i % 5 - 2; } fixed int[?] data = rt.new(fixed int[?], G); fixed int[?] idx = rt.new(fixed int[?], G); - // 7919 is odd, so i * 7919 mod 4096 visits every slot once, in a scattered order + // 7919 is prime and not 2 or 3, so i * 7919 mod 98304 (2^15 * 3) visits every slot once, in a scattered order for (int i = 0; i < G; i++) { data[i] = i; idx[i] = i * 7919 % G; } while (reps > 0) { if (which == 'm') r = matmul(a, b, c); |
