Skip to content

Experimental Arm: opt-in SVE targets, target reporting and Arm CI - #28

Merged
yohanchatelain merged 5 commits into
verificarlo:mainfrom
yohanchatelain:arm-target-policy-ci
Oct 7, 2026
Merged

yohanchatelain merged 5 commits into
verificarlo:mainfrom
yohanchatelain:arm-target-policy-ci

Conversation

@yohanchatelain

Copy link
Copy Markdown
Collaborator

Depends on #26. This branch is stacked on it, so the first two commits are #26's. Only the last two commits belong to this PR:

  • 8aeb17b Make Arm SVE targets opt-in and report built targets
  • 542599f CI: add experimental Arm jobs

I'll rebase once #26 is merged. Merging #27 first keeps the flaky scalar:sr-accuracy out of the CI results.

Phases 3 and 4 of experimental Arm support. NEON is built by default on aarch64; SVE is opt-in. Both remain labelled experimental.

Target selection (8aeb17b)

  • ./configure --enable-experimental-sve (default: off). When off, PRISM is compiled with -DHWY_DISABLED_TARGETS=HWY_ALL_SVE, so aarch64 builds are NEON-only. This is a no-op on other architectures. Why off by default:
    • On 128-bit SVE hardware (Cortex-X925, Neoverse N2/V2), UD measured ~1.8× slower than NEON and SR showed no gain.
    • Highway generates no SVE code with clang < 21; clang 21 supports only SVE2_128.
  • configure warnings on aarch64:
    • Arm support is experimental.
    • -march=native targets a generic armv8 CPU because clang doesn't know the host. This is detected by comparing the predefined macros with -march=armv8-a. Checking target-cpu alone isn't enough: clang 20 on Neoverse N2 reports generic but still enables the detected features.
    • The --with-arch flag enables SVE while SVE targets are disabled.
    • clang < 22 won't generate SVE code.
  • make target-info (also run by make): prints the static library's Highway target and the dynamic library's compiled and selected targets. For example, on clang 18 / Cortex-X925, -march=native gives a NEON_WITHOUT_AES static library.
  • Version cap: configure now accepts LLVM up to 23.x, since SVE needs clang ≥ 22.
  • Bug fix, the LLVM_PATH → --with-llvm bridge: it only applied with an explicit --with-llvm=yes. Otherwise llvm-config and llvm-link came from PATH rather than LLVM_PATH, which could mix toolchains (e.g. clang 22 with LLVM 18's llvm-config). The x86 CI works today only because the install action also prepends its LLVM to PATH.
  • README: documents the experimental Arm status.

CI (542599f): .github/workflows/arm-ci.yml on ubuntu-24.04-arm (128-bit SVE)

Job Configuration
neon LLVM 18 and 20, default configuration
sve (continue-on-error) LLVM 22, --enable-experimental-sve --with-arch=armv9-a+sve2
sve-qemu (continue-on-error) same build; the 21 functional tests run under qemu-aarch64 with 256- and 512-bit vectors. The statistical accuracy suites are too slow to emulate

Dependencies are installed by .github/actions/arm-setup. It prefers Ubuntu's LLVM packages, because mixing them with apt.llvm.org's for the same version breaks on the runner image. apt.llvm.org is the fallback for versions Ubuntu doesn't ship.

Validation

Run on my fork (with #27 merged in), all green:

Job Targets Result
neon, LLVM 18 / 20 NEON_BF16 40/40
sve, LLVM 22 static SVE2, dynamic SVE2_128 40/40
sve 256-bit (QEMU) SVE_256 selected 21/21
sve 512-bit (QEMU) SVE2 (scalable) selected 21/21

Locally, on a Cortex-X925 (clang 18, clang 22, GCC 13):

  • Every configure option combination behaves as described.
  • With SVE disabled, HWY_DISABLED_TARGETS holds even when -march enables SVE.

Not tested: x86 with these configure changes beyond what this PR's CI runs.

🤖 Generated with Claude Code

yohanchatelain and others added 5 commits October 6, 2026 17:08
- sr_vector-inl.h: skip the thread_local exponent cache on SVE/RVV targets;
  sizeless vector types cannot have thread-local storage. HWY_TARGET_IS_SVE
  is needed since SVE2_128/SVE_256 have HWY_HAVE_SCALABLE == 0.
- generic_vector-inl.h: define and export every fixed width (up to 512 bits)
  on every target. HWY_EXPORT needs the function in all compiled targets, but
  the guards used the static target's HWY_MAX_BYTES, which broke with
  HWY_SCALAR (GCC fallback) and with SVE (HWY_MAX_BYTES = 256). _<op>xN
  already loops when N exceeds the target's lanes.
- Remove the 1024-bit fixed-size block, whose functions were never defined
  (only reached when HWY_MAX_BYTES >= 128, i.e. SVE).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SVE vectors cannot be tuple members or array elements, so:
- test drivers pass scalar inputs as std::tuple<T...> and checkers broadcast
  them with hn::Set (all inputs were already broadcasts);
- assert_equal_inputs uses a fold instead of iterating over {args...}
  (also fixes the reported index, which was always 1).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- configure: add --enable-experimental-sve (default: off). When off,
  HWY_DISABLED_TARGETS=HWY_ALL_SVE restricts aarch64 builds to NEON (no-op
  elsewhere). On aarch64, warn that Arm support is experimental, that
  -march=native targets a generic armv8 CPU when clang does not know the
  host, that the --with-arch flag enables SVE while SVE is disabled, and
  that clang < 22 generates no SVE code (< 21: none, 21: SVE2_128 only).
- configure: accept LLVM up to 23.x (SVE needs clang >= 22), and fix the
  LLVM_PATH bridge, which only applied with --with-llvm=yes, so that
  llvm-config and llvm-link came from PATH instead of LLVM_PATH.
- Add prism-target-info (make target-info, run by make): prints the static
  library's Highway target and the dynamic library's compiled and selected
  targets.
- README: document the experimental Arm status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On ubuntu-24.04-arm runners (128-bit SVE):
- neon: LLVM 18 and 20, default configuration.
- sve: LLVM 22 with --enable-experimental-sve --with-arch=armv9-a+sve2.
- sve-qemu: same build, functional tests run under qemu-aarch64 with
  256- and 512-bit vectors (the statistical accuracy tests are too slow to
  emulate).
SVE jobs are continue-on-error while SVE support is experimental.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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