Skip to content

ENH: Optimize LUT with transposed loads and 4-way row unrolling#7

Merged
Mousius merged 1 commit intonumpy:mainfrom
seiko2plus:enhance-lut
Jan 5, 2026
Merged

ENH: Optimize LUT with transposed loads and 4-way row unrolling#7
Mousius merged 1 commit intonumpy:mainfrom
seiko2plus:enhance-lut

Conversation

@seiko2plus
Copy link
Member

This patch add several improvements to the Lookup Table (LUT) for non-scalable architectures.

  • Transposed loads: Introduced a pre-calculated transposed storage (trans_) and loading strategy. This allows using optimized interleaved loads (X2 and X4) when vector lanes match the blocking factor, reducing the need for expensive gather operations.
  • FourTablesLookup: Handle case where the vector length is exactly one-quarter of the table width using 4-way table lookups.

Maintenance:

  • Removed runtime specializations for scalable extensions. These now explicitly fallback to Highway's GatherIndex (no performance gain on SVE).

This patch add several improvements to the Lookup Table (LUT) for non-scalable architectures.

- **Transposed loads:** Introduced a pre-calculated transposed storage (`trans_`) and loading strategy.
   This allows using optimized interleaved loads (X2 and X4) when vector lanes match the blocking factor,
   reducing the need for expensive gather operations.
- **FourTablesLookup:** Handle case where the vector length is exactly one-quarter
   of the table width using 4-way table lookups.

Maintenance:
- Removed runtime specializations for scalable extensions.
  These now explicitly fallback to Highway's `GatherIndex` (no
  performance gain on SVE).
@seiko2plus seiko2plus marked this pull request as ready for review December 22, 2025 17:21
@Mousius Mousius merged commit 7c40f72 into numpy:main Jan 5, 2026
1 check failed
@Mousius
Copy link
Member

Mousius commented Jan 5, 2026

Looks good to me @seiko2plus!

One future thought is likely to stop using HWY_HAVE_SCALABLE to enable compilation that switches to fixed width 128-bit vectors within an scalable kernel. Though not important for now 😸

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.

2 participants