Skip to content

[stdlib][simd] Add test for simd construction checks - #6348

Closed
josiahls wants to merge 1 commit into
modular:mainfrom
josiahls:fix/simd-assertion-checks
Closed

josiahls wants to merge 1 commit into
modular:mainfrom
josiahls:fix/simd-assertion-checks

Conversation

@josiahls

@josiahls josiahls commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor

Note, currently @always_inline("builtin") basically strips the asserts out of the code.

Summary

SIMD _simd_construction_checks is noop due to @always_inline("builtin")

When you run the test, you will notice that _simd_construction_checks isn't the thing that fails.

def main() raises:
    ^
/home/mojo_user/momanim/third_party/modular/mojo/stdlib/test/builtin/test_simd_compile_fail.mojo:18:49: note: call expansion failed with parameter value(s): (..., "size": 3)
    _simd_construction_checks2[DType.float32, 3]()
                                                ^
mojo/stdlib/std/builtin/simd.mojo:255:5: note: function instantiation failed
mojo/stdlib/std/builtin/simd.mojo:265:5: note: constraint failed: simd width must be power of 2
/home/mojo_user/momanim/.pixi/envs/stdlib-dev/bin/mojo: error: failed to run the pass manager

Testing

I have a compile fail test that demos this.

Checklist

  • PR is small and focused — consider splitting larger changes into a
    sequence of smaller PRs
  • I ran ./bazelw run format to format my changes
  • I added or updated tests to cover my changes

@github-actions github-actions Bot added mojo-stdlib Tag for issues related to standard library waiting-on-review labels Apr 3, 2026
@josiahls
josiahls force-pushed the fix/simd-assertion-checks branch 2 times, most recently from c299114 to 658ae92 Compare April 3, 2026 22:58
@josiahls

josiahls commented Apr 3, 2026 •

Copy link
Copy Markdown
Contributor Author

cc @NathanSWard @always_inline("builtin") appears to strip any comptime assertions. _simd_construction_checks is noop as it stands. I can update the test to be smaller, just putting a demo copy of the function without the builtin line.

Basically this pr isn't going to be mergable until an API change or compiler fix.

@josiahls
josiahls force-pushed the fix/simd-assertion-checks branch 2 times, most recently from ce1d83c to 9cd34e3 Compare April 3, 2026 23:11
Note, currently @always_inline("builtin") basically strips the
asserts out of the code.

Issue: modular#6349
@josiahls
josiahls force-pushed the fix/simd-assertion-checks branch from 9cd34e3 to 7a0a9a0 Compare April 3, 2026 23:23
@josiahls
josiahls marked this pull request as ready for review April 3, 2026 23:23
@josiahls
josiahls requested a review from a team as a code owner April 3, 2026 23:23
@JoeLoser JoeLoser added the blocked Blocked by another issue that must be resolved first label Apr 8, 2026
@alisterburt

Copy link
Copy Markdown
Contributor

@josiahls sorry this has been sitting a while, the main bug is tracked separately in #6349 and we now reject non-power-of-two SIMD widths so this test no longer shows the no-op check

c.f. e46710e

We're working to better handle OSS contributions in this post 1.0 era and hope to receive many more PRs from you, thank you for your patience here!

@alisterburt alisterburt closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked Blocked by another issue that must be resolved first mojo-stdlib Tag for issues related to standard library waiting-on-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants