Vectorise the Winograd transforms and stop auto-routing aarch64 3×3 to indirect#11
Closed
enthropy7 wants to merge 2 commits into
Closed
Vectorise the Winograd transforms and stop auto-routing aarch64 3×3 to indirect#11enthropy7 wants to merge 2 commits into
enthropy7 wants to merge 2 commits into
Conversation
The input and output transforms ran a scalar 4x4 transform per channel on a single thread, dominating runtime over the GEMM they feed. Process all channels of a tile together so the inner loops vectorise over the contiguous NHWC channel dimension, spread the tiles across the rayon pool, memoise the transformed and packed weights by kernel pointer, and leave the scratch buffers uninitialised since they are fully written. Route 3x3 stride-1 convs to Winograd only above a per-arch channel floor (YSCV_WINO_MIN_CH): x86 wins broadly, aarch64 still prefers the blocked-GEMM im2col end to end. Replaces the per-tile SIMD transforms. Isolated 80x80x128->256: x86 10.0->3.9ms, A53 327->139ms; e2e YOLO x86 ~1.2x.
The indirect convolution round-trips the c_out accumulator through memory once per (tap, in-channel), so it loses to the blocked-GEMM im2col path for any non-trivial channel count. Gate it on output channels, off by default; YSCV_INDIRECT_MAX_COUT re-enables it for narrow convs. A53 yolo11n (4 threads): 3.0s -> 1.1s, tracker unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
on #9
Two changes from profiling the Winograd path on x86 (Zen4) and ARM (Cortex-A53):
scalar 4×4 transform per channel on one thread — ~80% of Winograd's runtime.
Now all channels of a tile are transformed together (autovectorised over the
contiguous NHWC channel dim → AVX/SSE/NEON), tiles run across the rayon pool,
transformed+packed weights are memoised by kernel pointer, scratch buffers skip
zero-init. 3×3 s1 routes to Winograd above a per-arch channel floor
(YSCV_WINO_MIN_CH).
accumulator through memory per (tap, in-channel), losing to the blocked-GEMM
im2col for any non-trivial channel count. Off by default (YSCV_INDIRECT_MAX_COUT).
@Human9000-bit take a look , this replaces the per-tile SIMD transforms from #9 with channel-vectorised ones, and gates the indirect path you parallelised in 9cd97c4.