Skip to content

Vectorise the Winograd transforms and stop auto-routing aarch64 3×3 to indirect#11

Closed
enthropy7 wants to merge 2 commits into
winograd-basefrom
winograd-vectorize
Closed

Vectorise the Winograd transforms and stop auto-routing aarch64 3×3 to indirect#11
enthropy7 wants to merge 2 commits into
winograd-basefrom
winograd-vectorize

Conversation

@enthropy7

Copy link
Copy Markdown
Owner

on #9

Two changes from profiling the Winograd path on x86 (Zen4) and ARM (Cortex-A53):

  1. Vectorise + parallelise the transforms. The input/output transforms ran a
    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).
  • isolated 80×80×128→256: x86 10.0→3.9 ms, A53 327→139 ms (maxdiff vs direct 1.6e-7)
  • e2e YOLO on x86: yolo11n 1.20×, yolov8n 1.29×
  1. Stop auto-routing aarch64 3×3 to the indirect path. It round-trips the c_out
    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).
  • A53 yolo11n (4T): 3.0 s → 1.1 s; tracker unchanged

@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.

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.
@enthropy7 enthropy7 deleted the branch winograd-base July 1, 2026 12:00
@enthropy7 enthropy7 closed this Jul 1, 2026
@enthropy7 enthropy7 deleted the winograd-vectorize branch July 1, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant