[PR #4349] [CLOSED] [Engine] isa guard: the iq512 exact rows are wide on purpose (#4213) #5020

Closed
opened 2026-11-07 16:32:04 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4349
Author: @rwkeyes
Created: 10/27/2026
Status: ❌ Closed

Base: main ← Head: isa-guard-iq512-rows


📝 Commits (1)

  • 746b5f5 ISA guard: the iq512 exact rows are wide on purpose (#4213)

📊 Changes

3 files changed (+17 additions, -0 deletions)

View changed files

📝 src/kernels/cpu/native_expert.cpp (+3 -0)
📝 tools/check_isa_guard.py (+3 -0)
📝 tools/test_check_isa_guard.py (+11 -0)

📄 Description

Problem and result

isa_guard_check fails on any build whose iq_avx512.cpp is compiled with the wide flags — including a stock -DSTRATA_ISA_FLOOR=avx build — because two of its row entry points are not in WIDE_PUBLIC. On v0.2.7 (5e8a4cc), HIP gfx1100, -DSTRATA_ISA_FLOOR=avx:

check_isa_guard: libstrata_kernels_cpu.a: 761 functions, 137 hold wide-ISA instructions, 2 not allowed
  VIOLATION ...::iq512x_rows(int, ...) (12437 wide instructions, first vmovdqu64)
  VIOLATION ...::iq512_reference_gu_rows(int, ...) (123 wide instructions, first vxorps)

After this change the same archive reads 0 not allowed and isa_guard_check passes in ctest.

#4213 reports iq512x_rows on a CUDA build of 0.1.51; iq512_reference_gu_rows is not named in any open issue I could find. This is the same class as #3409 / #3358, which were closed by a WIDE_PUBLIC entry (f9e1fff98), so this follows that shape instead of adding a mechanism.

Approach

  • Add both names to WIDE_PUBLIC, with the guarding call site in the comment.
  • A unit test pins both: allowed from iq_avx512.cpp.o, still a violation from iq_avx1.cpp.o.
  • One line in iq512_reference_ok(): if (!cpu_avx512_ok()) return false;. That probe was the only one of the pair without an internal check, and it calls the wide rows itself, so its safety otherwise rests on the caller's && ordering. Say the word and I will drop this hunk to keep the PR to the list alone.

No behaviour change on any CPU: the guard only refuses where the callers already refuse.

Validation

Passed:

  • AVX1-only Xeon, HIP gfx1100, -DSTRATA_ISA_FLOOR=avx, v0.2.7 tree, rebuilt from this branch: ctest -R isa_guard_check Failed -> Passed (3.28 s); full battery 175 tests, 168 -> 169 passed, with the six pre-existing failures unchanged (vmm_test, ple_parity, conversation_copy_streams_test, pool_tasks_test, hip_prefill_mmq_parity, pool_cores_test).
  • Ryzen 7 7700X + Arc Pro B70, SYCL bmg-g31, v0.2.7 tree, rebuilt from this branch: 579 functions, 89 wide, 0 not allowed; battery 48/51 unchanged (gr_parity, ple_parity, s2_expert_grouped_parity); ctest total 72.51 s -> 72.39 s.
  • python3 tools/test_check_isa_guard.py: 11 tests, OK.

Failed: none observed.

Not run: CUDA and Metal builds — no such host here. The change is host-side only, but the checker scans each backend's libstrata_kernels_cpu.a, so a CUDA build's list is unverified by me.

Limits

The two entries assume those call sites stay guarded. The new unit test pins the policy, not the callers; the added line in iq512_reference_ok() covers the one probe that had no internal check.


🔄 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/Niko1221/Strata/pull/4349 **Author:** [@rwkeyes](https://github.com/rwkeyes) **Created:** 10/27/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `isa-guard-iq512-rows` --- ### 📝 Commits (1) - [`746b5f5`](https://github.com/Niko1221/Strata/commit/746b5f5aec8fcb8f196126afc39d54ff071d63b4) ISA guard: the iq512 exact rows are wide on purpose (#4213) ### 📊 Changes **3 files changed** (+17 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cpu/native_expert.cpp` (+3 -0) 📝 `tools/check_isa_guard.py` (+3 -0) 📝 `tools/test_check_isa_guard.py` (+11 -0) </details> ### 📄 Description ## Problem and result `isa_guard_check` fails on any build whose `iq_avx512.cpp` is compiled with the wide flags — including a stock `-DSTRATA_ISA_FLOOR=avx` build — because two of its row entry points are not in `WIDE_PUBLIC`. On v0.2.7 (5e8a4cc), HIP gfx1100, `-DSTRATA_ISA_FLOOR=avx`: ``` check_isa_guard: libstrata_kernels_cpu.a: 761 functions, 137 hold wide-ISA instructions, 2 not allowed VIOLATION ...::iq512x_rows(int, ...) (12437 wide instructions, first vmovdqu64) VIOLATION ...::iq512_reference_gu_rows(int, ...) (123 wide instructions, first vxorps) ``` After this change the same archive reads `0 not allowed` and `isa_guard_check` passes in ctest. ## Related discussion #4213 reports `iq512x_rows` on a CUDA build of 0.1.51; `iq512_reference_gu_rows` is not named in any open issue I could find. This is the same class as #3409 / #3358, which were closed by a `WIDE_PUBLIC` entry (f9e1fff98), so this follows that shape instead of adding a mechanism. ## Approach - Add both names to `WIDE_PUBLIC`, with the guarding call site in the comment. - A unit test pins both: allowed from `iq_avx512.cpp.o`, still a violation from `iq_avx1.cpp.o`. - One line in `iq512_reference_ok()`: `if (!cpu_avx512_ok()) return false;`. That probe was the only one of the pair without an internal check, and it calls the wide rows itself, so its safety otherwise rests on the caller's `&&` ordering. Say the word and I will drop this hunk to keep the PR to the list alone. No behaviour change on any CPU: the guard only refuses where the callers already refuse. ## Validation **Passed:** - AVX1-only Xeon, HIP gfx1100, `-DSTRATA_ISA_FLOOR=avx`, v0.2.7 tree, rebuilt from this branch: `ctest -R isa_guard_check` Failed -> **Passed** (3.28 s); full battery 175 tests, 168 -> **169** passed, with the six pre-existing failures unchanged (`vmm_test`, `ple_parity`, `conversation_copy_streams_test`, `pool_tasks_test`, `hip_prefill_mmq_parity`, `pool_cores_test`). - Ryzen 7 7700X + Arc Pro B70, SYCL bmg-g31, v0.2.7 tree, rebuilt from this branch: 579 functions, 89 wide, **0 not allowed**; battery 48/51 unchanged (`gr_parity`, `ple_parity`, `s2_expert_grouped_parity`); ctest total 72.51 s -> 72.39 s. - `python3 tools/test_check_isa_guard.py`: 11 tests, OK. **Failed:** none observed. **Not run:** CUDA and Metal builds — no such host here. The change is host-side only, but the checker scans each backend's `libstrata_kernels_cpu.a`, so a CUDA build's list is unverified by me. ## Limits The two entries assume those call sites stay guarded. The new unit test pins the policy, not the callers; the added line in `iq512_reference_ok()` covers the one probe that had no internal check. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:04 +07:00
Sign in to join this conversation.
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
Niko1221/Strata#5020
No description provided.