From 010e6a10d4d2b2312105ea9916f86bb573277629 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 3 Mar 2025 19:56:53 -0500 Subject: [PATCH] Implementation comments for new high-rank scans --- src/builtins/scan.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/builtins/scan.c b/src/builtins/scan.c index 471bd98d..3f1b2079 100644 --- a/src/builtins/scan.c +++ b/src/builtins/scan.c @@ -1,22 +1,31 @@ // Scan (`) // Empty 𝕩, and length 1 if no 𝕨: return 𝕩 -// Generic operand: +// Generic argument: // Constant: copy // ⊢ identity, ⊣ reshape 𝕨 or first cell -// Boolean operand, rank 1: +// Boolean argument, stride 1: // + AVX2 expansion (SHOULD have better generic, add SSE, NEON) // ∨⌈ ∧×⌊ search+copy, then memset (COULD vectorize search) // ≠ SWAR/SIMD shifts, CLMUL, VPCLMUL (SHOULD add NEON polynomial mul) // < SWAR // =≤≥>- in terms of ≠<∨∧+ with adjustments -// Arithmetic operand, rank 1: +// Numeric argument, stride 1: // ⌈⌊ Scalar, SIMD in log(vector width) steps // Check in 6-vector blocks to quickly write result if constant // + Overflow-checked scalar or AVX2 // Ad-hoc boolean-valued handling for ≠∨ -// SHOULD extend rank 1 special cases to cell bound 1 -// Higher-rank arithmetic, non-tiny cells: apply operand cell-wise -// SHOULD have dedicated high-rank scan optimizations +// Higher-rank arithmetic: +// Boolean ≠∨∧ and synonyms: SWAR; ⌊⌈+: SIMD with shuffle/permute +// Stride