Skip to content

Add AVX-512 16-wide encoder backend with VBMI table gathers - #673

Open
madanm3 wants to merge 2 commits into
ARM-software:mainfrom
amd:isa-avx512-gather-table
Open

madanm3 wants to merge 2 commits into
ARM-software:mainfrom
amd:isa-avx512-gather-table

Conversation

@madanm3

@madanm3 madanm3 commented Sep 17, 2026

Copy link
Copy Markdown

Summary

  • Add astcenc-avx512: a compile-time 16-wide AVX-512 encoder, same idea as the existing AVX2 8-wide build.
  • Float-table gathers use AVX-512 VBMI permutes (load the table once, permute many times), not vgatherdps. Needs AVX-512F and AVX-512VBMI. Other ISAs, including NEON, are unchanged.

Build

cmake -DCMAKE_BUILD_TYPE=Release -DASTCENC_ISA_AVX512=ON -DASTCENC_INVARIANCE=ON ..

  • Needs AVX-512F + AVX-512VBMI in hardware and enabled in the OS (XCR0). Skylake-X / Cascade Lake (F without VBMI) will not run this binary.
  • The CLI checks that; the library does not. MSVC is not supported for this backend (Clang-CL only).
  • Universal macOS + AVX-512 is rejected.

Testing

  • ctest AVX-512 unit tests (SIMD width 16, gatherf_table 16/32/64/144)
  • Functional CLI (--encoder avx512)
  • Small image suite vs same-machine main AVX2: PSNR 0.000 dB; 6×6 -medium ASTC bit-identical (76559cfd…)

Performance

Speedup is main AVX2 coding time / this binary (>1 = this PR is faster). Small set, 3 repeats, encodes ≥2 ms. Invariance on.

Ryzen 7 9700F — Clang 18, -j 8

Quality Overall 4×4 6×6 8×8 12×12
fastest 1.20× 1.15× 1.20× 1.40× 1.05×
fast 1.21× 1.14× 1.23× 1.43× 1.06×
medium 1.27× 1.17× 1.32× 1.54× 1.09×
thorough 1.31× 1.18× 1.38× 1.62× 1.13×

Pinned 6×6 medium (taskset -c 4, -j 1): 0.0836 s → 0.0621 s (1.35×).

Ryzen 7 9700F — g++ 13.3, -j 8

Quality Overall 4×4 6×6 8×8 12×12
fastest 1.15× 1.03× 1.11× 1.34× 1.11×
fast 1.16× 1.03× 1.15× 1.37× 1.10×
medium 1.20× 1.06× 1.23× 1.46× 1.10×
thorough 1.25× 1.09× 1.29× 1.53× 1.14×

Pinned 6×6 medium: 0.0796 s → 0.0635 s (1.25×).

Xeon Platinum 8380 (Ice Lake) — g++ 14.3, encode-only 20 Small PNGs, -j 8

Quality Overall 4×4 6×6 8×8 12×12
fastest 0.94× 0.98× 1.00× 1.02× 0.71×
fast 0.95× 0.99× 1.00× 1.03× 0.73×
medium 0.95× 1.00× 1.02× 1.05× 0.70×
thorough 0.97× 1.00× 1.03× 1.07× 0.71×

Pinned 6×6 medium: 0.1239 s → 0.1214 s (1.02×). The 16-wide/VBMI win is a Zen 5 result; Ice Lake is flat at 6×6 and loses 12×12 (64-float table cap + 512-bit license).

Apple M5 — NEON vs main NEON, Apple Clang 17

Quality Overall 4×4 6×6 8×8 12×12
fastest 0.999× 1.000× 0.997× 0.994× 0.998×
fast 1.002× 1.001× 1.006× 1.001× 1.002×
medium 1.001× 1.000× 1.002× 1.001× 0.999×
thorough 1.000× 1.000× 0.997× 1.004× 1.001×

Pinned 6×6 medium: 0.0542 s vs 0.0541 s. Same ASTC hashes as x86 (76559cfd… / 6412a7ae…). ARM is unchanged.

Commits

  1. ISA / CMake / codec hoists / CLI CPU check
  2. README, changelog, Building.md, weekly CI avx512 package, test_simd, Python --encoder avx512

Introduce an astcenc-avx512 product binary (SIMD_WIDTH=16), implement
gatherf and vtable lookups with VBMI permutes, and hoist float-table
loads at the hot encode sites so the same table stays register-resident.
Describe astcenc-avx512 in the README, changelog, and build guide, cover
gatherf/vtable in test_simd (including VLA round tests that are multiples
of SIMD_WIDTH), and accept --encoder avx512 in the Python CLI and image
test runners.
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