Skip to content

fix(clay): unblock iOS-simulator build (bump zclay to Zig 0.16 + scalar hash guard) - #581

Merged
apotema merged 1 commit into
mainfrom
fix/4-clay-ios-neon
Jul 10, 2026
Merged

fix(clay): unblock iOS-simulator build (bump zclay to Zig 0.16 + scalar hash guard)#581
apotema merged 1 commit into
mainfrom
fix/4-clay-ios-neon

Conversation

@apotema

@apotema apotema commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What

Unblocks the Clay UI half of labelle-toolkit/labelle-cli#4 (iOS Simulator: Clay UI fails to compile due to ARM NEON intrinsics).

1. Bump the zclay pin (the load-bearing fix)

gui/clay/build.zig.zon pinned zclay v0.2.2+0.14, which uses the Zig 0.14 build API (Compile.addIncludePath) and fails to build on the toolkit's Zig 0.16 for any target — so the Clay iOS path couldn't even be exercised. Repinned to johan0A/clay-zig-bindings main @ e0286c488a303b93501944ccde10730cc74ecd58 (commit d54ee9dd "update to zig 0.16"), which ports zclay's build.zig to Zig 0.16.

  • new hash: zclay-0.2.2-Ej1rkP3RAACYZGzQB5NGPaqfySgKfO26NYk5Ja6Z15gC
  • The Clay bridge (gui/clay/src/adapter.zig) needed no source changes — zclay's public API is unchanged across the bump.

2. iOS-simulator NEON guard (the actual #4)

Clay's Clay__HashData uses aarch64 NEON intrinsics (vdupq_n_u64, ...). Under Zig 0.15.2 this tripped always_inline function 'vdupq_n_u64' requires target feature 'altnzcv' for the aarch64-ios-simulator triple. gui/clay/build.zig now detects that triple (os.tag == .ios and abi == .simulator) and defines CLAY_DISABLE_SIMD on the Clay C library compile, selecting Clay's fully-supported scalar hash path.

Because zclay compiles Clay internally (static lib clay, not exposed as an artifact), the macro is applied by reaching that Compile step through the zclay module's link objects. Gated strictly on the simulator triple; device/desktop keep native SIMD. Mirrors labelle-box2d's BOX2D_DISABLE_SIMD pattern.

Verification

  • Host zig build (gui/clay) — green.
  • zig build -Dtarget=aarch64-ios-simulator — green.
  • Forced a compile-only test of the gui module for aarch64-ios-simulator: Clay's C library compiles and links for the simulator triple with no NEON error.
  • Configure-time probe confirmed the guard reaches the real clay compile step for the simulator target only (not host).

Key finding

On Zig 0.16 the original NEON error no longer reproduces through the build graph even without the guard — the intrinsic-feature mismatch was a Zig-0.15.2-era problem, so the zclay bump alone restores the simulator compile. The CLAY_DISABLE_SIMD guard is retained as correctly-targeted, low-risk hardening (scalar path only ever affects the simulator, where hashing perf is irrelevant) that pins Clay to the scalar path on the exact triple that failed, guarding against future CPU-baseline/Zig regressions.

Closes labelle-toolkit/labelle-cli#4

https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw

… scalar hash)

Bumps the zclay pin from `v0.2.2+0.14` (Zig 0.14 build API, fails to build
on Zig 0.16 for ANY target — `Compile.addIncludePath` no longer exists) to
johan0A/clay-zig-bindings `main` @ e0286c48, which ports zclay's build.zig to
the Zig 0.16 API. This is the load-bearing half of the fix: it lets the Clay
UI path compile again on the toolkit's Zig 0.16.

Also hardens the actual iOS-simulator concern (labelle-cli#4): Clay's
`Clay__HashData` uses aarch64 NEON intrinsics (`vdupq_n_u64`, ...) that under
Zig 0.15.2 tripped `always_inline ... requires target feature 'altnzcv'` for
the `aarch64-ios-simulator` triple. gui/clay/build.zig now detects that triple
(`os.tag == .ios and abi == .simulator`) and defines `CLAY_DISABLE_SIMD` on the
Clay C library compile (reached through the zclay module's link objects, since
zclay compiles Clay internally), selecting Clay's fully-supported scalar hash
path. Gated strictly on the simulator; device/desktop keep native SIMD.
Mirrors labelle-box2d's `BOX2D_DISABLE_SIMD` pattern.

Verified: host `zig build` green; `zig build -Dtarget=aarch64-ios-simulator`
green; forcing a compile-only test of the gui module for the simulator triple
compiles+links Clay's C for aarch64-ios-simulator without the NEON error
(both with and without the guard on Zig 0.16 — the guard is defensive/
belt-and-suspenders), and a configure-time probe confirms the guard reaches
the real "clay" compile step for the simulator target only.

Closes labelle-toolkit/labelle-cli#4

Claude-Session: https://claude.ai/code/session_017pW3ifKf9wgxNg4viy6okw
@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@apotema, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 83f5e011-b250-4a30-a8c1-625e3be66654

📥 Commits

Reviewing files that changed from the base of the PR and between a6410c8 and ec077ea.

📒 Files selected for processing (2)
  • gui/clay/build.zig
  • gui/clay/build.zig.zon
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/4-clay-ios-neon

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the zclay dependency in gui/clay/build.zig.zon and adds a workaround in gui/clay/build.zig to disable SIMD (using the CLAY_DISABLE_SIMD macro) when targeting the iOS simulator to prevent compilation failures. The feedback recommends updating the .minimum_zig_version in build.zig.zon to "0.16.0" to align with the requirements of the updated zclay dependency and avoid compatibility issues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread gui/clay/build.zig.zon
@@ -5,8 +5,8 @@
.minimum_zig_version = "0.15.2",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since the zclay dependency has been bumped to a version that specifically targets and requires Zig 0.16, and the toolkit itself is running on Zig 0.16, the .minimum_zig_version should be updated to "0.16.0" to prevent compatibility issues and accurately reflect the toolchain requirements.

    .minimum_zig_version = "0.16.0",

@apotema
apotema merged commit 431e3cd into main Jul 10, 2026
3 checks passed
@apotema
apotema deleted the fix/4-clay-ios-neon branch July 10, 2026 17:21
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.

iOS Simulator: Clay UI fails to compile due to ARM NEON intrinsics

1 participant