Skip to content

Wave8 opt: u32-friendly bit transpose (avoid RV32 u64 penalty) #2530

Closed

Description

@zackees

Option from #2524.

The u64 SWAR transpose regressed 2.4x on RV32 (#2524). A 32-bit SWAR / byte-shuffle that never crosses the 32-bit word boundary MIGHT avoid the penalty. LOW CONFIDENCE: the x86 host also lost (0.90x) with native u64, suggesting delta-swap is latency-bound vs the naive independent bit-ops. Benchmark before adopting.

Parent: #2524 · Investigation/data: #2522

Activity

  1. zackees commented on May 29, 2026

    @zackees
    MemberAuthor

    Tried and rejected: a u32 two-pass 8×8 transpose (16-lane = two 8×8 via u32 halves) was implemented + bit-verified, but on ESP32-P4 (RV32) it ran 10524 µs/frame vs the unrolled naive's 6595 µs (1.6× slower); the HD u32 8×8 also lost for the 8-lane (4680 vs 3336 µs). The unrolled naive is fastest. See #2524. Closing as not worthwhile unless a fundamentally different u32 scheme is proposed.

  2. zackees commented on May 29, 2026

    @zackees
    MemberAuthor

    Resolved by #2534. The shipped spread-LUT transpose (src/fl/channels/detail/bit_spread_lut.hpp) is exactly the u32-native transpose this issue asked for — it avoids the RV32 u64 penalty entirely and measured 1.98×/1.90× (16/8-lane), bit-exact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions