From 15df6afc7db9be31a9a59c8f7229ab6dfef89492 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Tue, 5 Nov 2024 22:04:23 -0500 Subject: [PATCH] Implementation comments for transpose with short height/width --- src/builtins/transpose.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/builtins/transpose.c b/src/builtins/transpose.c index 08c419ea..e3f02c1b 100644 --- a/src/builtins/transpose.c +++ b/src/builtins/transpose.c @@ -1,18 +1,22 @@ // Transpose and Reorder Axes (⍉) // Transpose -// One length-2 axis: dedicated code -// Boolean: pdep or emulation for height 2; pext for width 2 -// SHOULD use a generic implementation if BMI2 not present -// SHOULD optimize other short lengths with pdep/pext and shuffles // Boolean 𝕩: convert to integer +// pdep or emulation for height 2; pext for width 2 +// SHOULD switch to shuffles and modular permutation // SHOULD have bit matrix transpose kernel // CPU sizes: native or SIMD code // Large SIMD kernels used when they fit, overlapping for odd sizes // SSE, NEON i8: 8×8 ; i16: 8×8; i32: 4×4; f64: scalar -// AVX i8: 16×16; i16: 16×8; i32: 8×8; f64: 4×4 -// COULD use half-width or smaller kernels to improve odd sizes -// Scalar transpose or loop used for overhang of 1 +// AVX2 i8: 16×16; i16: 16×8; i32: 8×8; f64: 4×4 +// COULD use half-width or smaller kernels to improve odd sizes +// Scalar transpose or loop used for overhang of 1 +// Partial kernels for at least half-kernel height/width +// Short width: over-read, then skip some writes +// Short height, i8 AVX2 only: overlap input rows and output words +// Smaller heights and widths: dedicated kernels +// Zipping, unzipping, shuffling for powers of 2 +// Modular permutation for odd numbers, possibly times 2 // Reorder Axes // If 𝕨 indicates the identity permutation, return 𝕩