Update scan implementation comments

This commit is contained in:
Marshall Lochbaum 2025-02-25 20:32:03 -05:00
parent 422e63bc12
commit a775520927

View File

@ -6,11 +6,11 @@
// Boolean operand, rank 1: // Boolean operand, rank 1:
// + AVX2 expansion (SHOULD have better generic, add SSE, NEON) // + AVX2 expansion (SHOULD have better generic, add SSE, NEON)
// ∨⌈ ∧×⌊ search+copy, then memset (COULD vectorize search) // ∨⌈ ∧×⌊ search+copy, then memset (COULD vectorize search)
// ≠ SWAR shifts, CLMUL, VPCLMUL (SHOULD add SSE, NEON) // ≠ SWAR/SIMD shifts, CLMUL, VPCLMUL (SHOULD add NEON polynomial mul)
// < SWAR // < SWAR
// =≤≥>- in terms of ≠<∨∧+ with adjustments // =≤≥>- in terms of ≠<∨∧+ with adjustments
// Arithmetic operand, rank 1: // Arithmetic operand, rank 1:
// ⌈⌊ Scalar, SSE, AVX in log(vector width) steps (SHOULD add NEON) // ⌈⌊ Scalar, SIMD in log(vector width) steps
// Check in 6-vector blocks to quickly write result if constant // Check in 6-vector blocks to quickly write result if constant
// + Overflow-checked scalar or AVX2 // + Overflow-checked scalar or AVX2
// Ad-hoc boolean-valued handling for ≠∨ // Ad-hoc boolean-valued handling for ≠∨
@ -22,15 +22,19 @@
// SHOULD optimize dyadic scan with rank // SHOULD optimize dyadic scan with rank
// Empty 𝕩, length 1, ⊢: return 𝕩 // Empty 𝕩, length 1, ⊢: return 𝕩
// Boolean operand, cell size 1: // Boolean operand, cell size 1:
// ≠∨∧⊣ and synonyms, rows <64: SWAR, AVX2 (SHOULD add SSE, NEON) // ≠∨∧⊣ (and synonyms), rows <64: SWAR, SIMD
// Power of two row size: autovectorized // Power of two row size: autovectorized
// COULD have dedicated SIMD for CPU widths, little improvement // COULD have dedicated SIMD for CPU widths, little improvement
// ⊣ SWAR for <64, select for ≥ // COULD get unaligned row boundaries in 4x groups with &
// ∨⌈ ∧×⌊ SWAR with addition for small rows, search for large // ≠∨∧⊣ medium rows (upper bound varies, <320): SIMD
// Rows 64≤l<160: SWAR specialized for ≤1 boundary // Generate boundary masks with index tracking and shifts
// Large rows: word-at-a-time search // Scan within words, propagate carries stopping at masks
// ≠ power-of-two shifts for <64, rank-1 scans and boundary corrections if ≥ // ≠ small and medium rows uses power-of-two shifts
// SHOULD have a better intermediate-size (< ~256) SIMD method // COULD try CLMUL
// ≠∨∧⊣ large rows: per-row loops
// ∨∧: word-at-a-time search
// ≠: rank-1 scans and boundary corrections
// ⊣: branchless boundary plus fixed-size loop
// + scan in blocks, correct with mask, ⌊`, subtract // + scan in blocks, correct with mask, ⌊`, subtract
// = as ≠`⌾¬, - as (2×⊣`)-+` // = as ≠`⌾¬, - as (2×⊣`)-+`
// SHOULD optimize non-boolean scan with rank // SHOULD optimize non-boolean scan with rank