Skip to content

Report invalid SIMD splat/extract/insert/shuffle instantiations as unsupported - #4972

Merged
feliperodri merged 4 commits into
model-checking:mainfrom
srivatsansamraj:simd-invalid-instantiations
Nov 7, 2026
Merged

feliperodri merged 4 commits into
model-checking:mainfrom
srivatsansamraj:simd-invalid-instantiations

Conversation

@srivatsansamraj

@srivatsansamraj srivatsansamraj commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Kani's SIMD codegen stands in for rustc's E0511 checks, because rustc's own backend never runs under Kani. #4951 turned the comparison checks into unsupported-construct reports. Four checks still reported a compile error and called abort_if_errors(), so one invalid instantiation of simd_splat, simd_extract, simd_insert or simd_shuffle stopped codegen of the whole crate.

These five sites (the two shuffle checks included) now report the call as an unsupported construct, so only the harnesses that reach it fail. simd_shuffle_length returns None for an index vector that is not u32 lanes instead of erroring, and codegen_intrinsic_simd_insert loses a span parameter it no longer uses. The messages link the new-issue page rather than this issue, which the PR closes.

The new expected test simd-invalid-instantiation has a valid and an invalid harness for each of the four intrinsics in one crate; without this change the crate aborts at the first invalid one, with it four harnesses verify and four fail with their own message. The five existing tests that pinned the compile errors (simd-splat-wrong-type, simd-extract-wrong-type, simd-insert-wrong-type, the two simd-shuffle-result-type-* tests) now pin the unsupported checks, as #4951 did for its two.

Not included: rejecting these candidates in autoharness before codegen, which the issue also suggests.

Resolves #4952

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

@srivatsansamraj
srivatsansamraj requested review from a team as code owners October 5, 2026 21:06
@srivatsansamraj

Copy link
Copy Markdown
Contributor Author

@CYJ904 @Tianshu-Huang @wodex1nhaoIeng @acearyanarun for review. Same shape as #4922: Kani checks SIMD intrinsic calls itself, since rustc's backend does not run, and four of those checks still stopped the whole crate when a generic helper was instantiated with the wrong types (a simd_splat of the wrong element type, for example). They now report the call as unsupported, so only the harnesses that reach it fail. @feliperodri filed the issue as the follow-up to #4951; nothing in the standard library reaches these today, so no number moves; the run stays alive instead of dying.

@github-actions github-actions Bot added Z-EndToEndBenchCI Tag a PR to run benchmark CI Z-CompilerBenchCI Tag a PR to run benchmark CI labels Oct 5, 2026

@Tianshu-Huang Tianshu-Huang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ran the 19 expected/intrinsics/simd-* tests on this branch, all pass. The five sites return the unsupported statement before any codegen and abort_if_errors is gone from all four functions. LGTM.

@srivatsansamraj
srivatsansamraj force-pushed the simd-invalid-instantiations branch from b3fbf27 to e816660 Compare October 6, 2026 21:28
…supported

Kani's SIMD codegen stands in for rustc's E0511 checks, and an invalid
`simd_splat`, `simd_extract`, `simd_insert` or `simd_shuffle` instantiation
was a compile error that stopped codegen of the whole crate. These checks
now report an unsupported construct, as model-checking#4951 did for the comparisons, so
only the harnesses that reach the instantiation fail. The five tests that
pinned the compile errors now pin the unsupported checks, and a new test
runs invalid and valid instantiations of each intrinsic in one crate.
The comment saying why an invalid instantiation is reported as unsupported, rather than as an error that aborts the crate, appeared at five sites; it stays at the simd_splat arm.
@srivatsansamraj
srivatsansamraj force-pushed the simd-invalid-instantiations branch from e816660 to 5625087 Compare October 9, 2026 16:52
@feliperodri feliperodri self-assigned this Oct 22, 2026
@feliperodri feliperodri added Z-Autoharness Issue related to autoharness subcommand and removed Z-Autoharness Issue related to autoharness subcommand labels Nov 6, 2026

@feliperodri feliperodri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The change matches the approach in #4951, and the new harnesses show that only the invalid calls fail.

Before approving:

  1. This aborted the whole crate, so please add [C] Bug and [F] Crash.
  2. BuildBundle-MacOs-aarch64 fails. Please confirm it's the macOS runner issue seen elsewhere, or fix it.

@srivatsansamraj

Copy link
Copy Markdown
Contributor Author

@feliperodri we cannot set labels on this repository; could you add [C] Bug and [F] Crash? BuildBundle-MacOs-aarch64 failed in the macOS setup before the build, because the Z3 archive it downloaded was not a zip; the same job passes on main with the same script.

@feliperodri feliperodri added [C] Bug This is a bug. Something isn't working. [F] Crash Kani crashed labels Nov 7, 2026

@feliperodri feliperodri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. The SIMD instantiation checks now report as unsupported constructs, matching #4951, and the new harnesses show only the invalid calls fail. Labels are set. The two CI failures on this head are not from this change: BuildBundle-MacOs-aarch64 fails in setup because the Z3 download is not a zip, and compile-timer-short fails in the analyzer step with normal timings. Approving.

@feliperodri
feliperodri added this pull request to the merge queue Nov 7, 2026
Merged via the queue into model-checking:main with commit 5df43cc Nov 7, 2026
30 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[C] Bug This is a bug. Something isn't working. [F] Crash Kani crashed Z-CompilerBenchCI Tag a PR to run benchmark CI Z-EndToEndBenchCI Tag a PR to run benchmark CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SIMD codegen: invalid splat/extract/insert/shuffle instantiations abort the whole crate

3 participants