[PR #32] [MERGED] Run on CPUs without AVX2 #289

Closed
opened 2026-10-29 21:23:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mw00/project-maya/pull/32
Author: @ksanislo
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @mw00

Base: main ← Head: no-avx2


📝 Commits (1)

  • 2e1f649 cpu: run on a CPU without AVX2 - no AVX2 static initializer, runtime AVX2 checks, a clear error instead of SIGILL

📊 Changes

6 files changed (+52 additions, -4 deletions)

View changed files

📝 README.md (+1 -1)
📝 include/strata/kernels/cpu/expert_layout.hpp (+2 -0)
📝 maya.py (+2 -1)
📝 src/kernels/cpu/expert_layout.cpp (+42 -0)
📝 src/kernels/cpu/iq_avx2.cpp (+4 -1)
📝 src/kernels/cpu/native_expert.cpp (+1 -1)

📄 Description

iq_avx2.cpp (built with -mavx2) has a static sign table whose constructor runs AVX2 code before main: SIGILL on Sandy/Ivy Bridge. The installer also refuses these CPUs.

  • The table is built on first use.
  • New cpu_avx2_ok() (cpuid + XCR0, MSVC-safe like cpu_avx512_ok()): the IQ AVX2 kernels run only when it is true, else ggml's vec_dot.
  • Q2_0 rows / Q8_1 quantizer without AVX2: a clear error naming STRATA_GLM_CPU_LANE=0 instead of SIGILL.
  • Installer warns instead of refusing; README: AVX2 recommended, not required.

Measured - 2x Xeon E5-2660 v2 + 4x T4: before, SIGILL at start; after, runs, and the CPU lane (ggml kernels) adds +15% decode vs STRATA_GLM_CPU_LANE=0. AVX2 CPUs take the same paths as before.

Not tested: an MSVC build.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mw00/project-maya/pull/32 **Author:** [@ksanislo](https://github.com/ksanislo) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@mw00](https://github.com/mw00) **Base:** `main` ← **Head:** `no-avx2` --- ### 📝 Commits (1) - [`2e1f649`](https://github.com/mw00/project-maya/commit/2e1f649bd4f5c15687377deb1bf47f232a557838) cpu: run on a CPU without AVX2 - no AVX2 static initializer, runtime AVX2 checks, a clear error instead of SIGILL ### 📊 Changes **6 files changed** (+52 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `include/strata/kernels/cpu/expert_layout.hpp` (+2 -0) 📝 `maya.py` (+2 -1) 📝 `src/kernels/cpu/expert_layout.cpp` (+42 -0) 📝 `src/kernels/cpu/iq_avx2.cpp` (+4 -1) 📝 `src/kernels/cpu/native_expert.cpp` (+1 -1) </details> ### 📄 Description `iq_avx2.cpp` (built with `-mavx2`) has a static sign table whose constructor runs AVX2 code before `main`: SIGILL on Sandy/Ivy Bridge. The installer also refuses these CPUs. - The table is built on first use. - New `cpu_avx2_ok()` (cpuid + XCR0, MSVC-safe like `cpu_avx512_ok()`): the IQ AVX2 kernels run only when it is true, else ggml's vec_dot. - Q2_0 rows / Q8_1 quantizer without AVX2: a clear error naming `STRATA_GLM_CPU_LANE=0` instead of SIGILL. - Installer warns instead of refusing; README: AVX2 recommended, not required. **Measured** - 2x Xeon E5-2660 v2 + 4x T4: before, SIGILL at start; after, runs, and the CPU lane (ggml kernels) adds +15% decode vs `STRATA_GLM_CPU_LANE=0`. AVX2 CPUs take the same paths as before. Not tested: an MSVC build. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:23:51 +07:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mw00/project-maya#289
No description provided.