Skip to content

bootstrap: add bootstrap step to run intrinsic-test in CI#156356

Open
xonx4l wants to merge 19 commits into
rust-lang:mainfrom
xonx4l:port-intrinsic-test
Open

bootstrap: add bootstrap step to run intrinsic-test in CI#156356
xonx4l wants to merge 19 commits into
rust-lang:mainfrom
xonx4l:port-intrinsic-test

Conversation

@xonx4l

@xonx4l xonx4l commented May 9, 2026

Copy link
Copy Markdown
Contributor

View all comments

This PR ports library/stdarch/crates/intrinsic-test crate into the bootstrap test runner as a step, so that we can run the intrinsic-test suite via x.py test.

Changes -:
Ports intrinsic-test from the stdarch crate into the bootstrap system as a new test step so it runs inside the existing
x86_64-gnu and aarch64-gnu CI jobs .
Added intrinsic-test in src/bootstrap/src/core/build_steps/test.rs .
Registers intrinsic-test as a bootstrap tool in tool.rs .
Installs clang, lld, and Intel SDE in the respective Dockerfiles.

r? @Kobzol

try-job: x86_64-gnu

@rustbot rustbot added A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 9, 2026
@rustbot

rustbot commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Kobzol is not on the review rotation at the moment.
They may take a while to respond.

@rustbot rustbot added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label May 9, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment on lines +916 to +918
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("library/stdarch/crates/intrinsic-test")
}

@folkertdev folkertdev May 10, 2026

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.

the intrinsic tests should also run when any of the source in core_arch changes (unless I'm misinterpreting what this function does).

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No you are not misinterpreting :) . You're so right I have added the core_arch path so it triggers . Thanks for the review.

Comment on lines +27 to +30
RUN curl -L http://ci-mirrors.rust-lang.org/sde-external-10.8.0-2026-03-15-lin.tar.xz -o /tmp/sde.tar.xz \
&& mkdir -p /intel-sde \
&& tar -xJf /tmp/sde.tar.xz --strip-components=1 -C /intel-sde \
&& rm /tmp/sde.tar.xz

@folkertdev folkertdev May 10, 2026

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.

this doesn't need an instant fix, but we bump the version of this tool occasionally, so ideally we'd sync that version between the repositories.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, noted.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Kobzol Kobzol 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.

Thank you!

I wonder what to do about the required dependencies. GCC/Clang is fine, but the SDE emulator seems problematic. We have a lot of CI jobs that will run the intrinsics test and I don't think it is great if we install it on all of them. Of course it is also not great if it is required when running tests locally.

I think that we should make this test be non-default for now, and run it explicitly on selected CI jobs.

View changes since this review

Comment thread src/bootstrap/src/core/build_steps/test.rs
Comment thread src/bootstrap/src/core/build_steps/test.rs Outdated
Comment thread src/bootstrap/src/core/build_steps/test.rs Outdated

let crates_link = out_dir.join("crates");
if !crates_link.exists() {
std::os::unix::fs::symlink(builder.src.join("library/stdarch/crates"), &crates_link)

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.

This won't work on non-Linux OSes. Why do we need this symlink?

There are existing functions in bootstrap to create symlinks, see symlink_dir.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we need symlink because the generated Cargo.toml files depend on core_arch via a relative path. We generate into the build directory to avoid writing into the submodule so that path doesn't exist there. The symlink points back at the real stdarch crates so it resolves.

Comment thread src/bootstrap/src/core/build_steps/test.rs Outdated
Comment thread src/bootstrap/src/core/build_steps/test.rs Outdated
Comment thread src/bootstrap/src/core/build_steps/tool.rs Outdated
@xonx4l

xonx4l commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

I wonder what to do about the required dependencies. GCC/Clang is fine, but the SDE emulator seems problematic. We have a lot of CI jobs that will run the intrinsics test and I don't think it is great if we install it on all of them. Of course it is also not great if it is required when running tests locally.

I think that we should make this test be non-default for now, and run it explicitly on selected CI jobs.

View changes since this review

Yes , non-default and run it explicitly on selected CI jobs is better way to handle instead on every CI jobs .

@rust-log-analyzer

This comment has been minimized.

@xonx4l xonx4l force-pushed the port-intrinsic-test branch from 9383a8f to f10bf02 Compare May 29, 2026 13:22
@Kobzol

Kobzol commented May 30, 2026

Copy link
Copy Markdown
Member

Let's run this test explicitly in the ‎x86_64-gnu CI job, as a start. The Dockerfile will need to run something like x test intrinsic-test.

@xonx4l

xonx4l commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Let's run this test explicitly in the ‎x86_64-gnu CI job, as a start. The Dockerfile will need to run something like x test intrinsic-test.

@Kobzol As I added the x86_64-gnu Dockerfile invocation you suggested and ran ./x test library/stdarch/crates/intrinsic-test locally . It failed giving this error.

warning: hidden lifetime parameters in types are deprecated
--> library/stdarch/crates/intrinsic-test/src/common/indentation.rs:20:37
|
20 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
| ----------^^^^^^^^^
| |
| expected lifetime parameter
|
= note: -W elided-lifetimes-in-paths implied by -W rust-2018-idioms
= help: to override -W rust-2018-idioms add #[allow(elided_lifetimes_in_paths)]
help: indicate the anonymous lifetime
|
20 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
| ++++

error: intrinsic-test (bin "intrinsic-test") generated 1 warning
error: warnings are denied by build.warnings configuration
Build completed unsuccessfully in 0:00:07

@Kobzol

Kobzol commented Jun 1, 2026

Copy link
Copy Markdown
Member

You can just fix the warning, the change will be later synced back to stdarch.

@rust-bors

This comment has been minimized.

@xonx4l

xonx4l commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

@Kobzol Tried 24.04. and got this .

cc: error: unrecognized command-line option '-msha512'
cc: error: unrecognized command-line option '-msm3'
cc: error: unrecognized command-line option '-msm4'
cc: error: unrecognized command-line option '-mavxvnniint16'

I think it's because failing command is cc and on 24.04 cc is gcc-13.3 and those flags aren't recognized by it. Thanks!

@Kobzol

Kobzol commented Jun 6, 2026

Copy link
Copy Markdown
Member

I see. Okay, in that case let's bump to 26.04 please, to use an LTS. That should have the same or newer GCC than 25.10, so hopefully it will work.

@xonx4l

xonx4l commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

@Kobzol Tried 26.04 and it ran successfully without breaking any flags . Thank you!

@Kobzol

Kobzol commented Jun 6, 2026

Copy link
Copy Markdown
Member

Okay, then could you please send a separate PR to update the corresponding CI job to 26.04? Thanks!

@xonx4l

xonx4l commented Jun 6, 2026

Copy link
Copy Markdown
Contributor Author

Opened the PR here -: #157531 . Thanks!

@xonx4l xonx4l force-pushed the port-intrinsic-test branch from 7d15b28 to 30c4c29 Compare June 10, 2026 03:32
@rustbot

rustbot commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@xonx4l

xonx4l commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@Kobzol With the bump previous error are gone but I ran ./x test library/stdarch/crates/intrinsic-test locally and it failed giving GCC error like GCC failed with implicit declaration of function '_mm256_dpwsud_epi32' and few more similar errors . Which occurred because GCC and stdarch name the AVX-VNNI-INT16 dot-product intrinsics differently GCC names these with an _avx_ infix (e.g. _mm256_dpwsud_avx_epi32) while stdarch generates them without it (e.g. _mm256_dpwsud_epi32) . So CC @folkertdev to have a look as it's a stdarch issue . Thank you!

@xonx4l

xonx4l commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

@Kobzol also got this error too.
Building stage1 intrinsic-test (stage0 -> stage1, x86_64-unknown-linux-gnu)
Finished release profile [optimized] target(s) in 0.06s
Compiling core_arch v0.1.5 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/crates/core_arch)
Compiling mod_4 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_4)
Compiling mod_7 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_7)
Compiling mod_5 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_5)
Compiling mod_1 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_1)
Compiling mod_2 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_2)
Compiling mod_3 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_3)
Compiling mod_0 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_0)
Compiling mod_6 v0.1.0 (/workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/mod_6)
error[E0635]: unknown feature clflushopt_target_feature
--> /workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/crates/core_arch/src/lib.rs:43:5
|
43 | clflushopt_target_feature,
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: there is a feature with a similar name: csky_target_feature
|
43 - clflushopt_target_feature,
43 + csky_target_feature,
|

error: the feature named clflushopt is not valid for this target
--> /workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/crates/core_arch/src/x86/clflushopt.rs:34:18
|
34 | #[target_feature(enable = "clflushopt")]
| ^^^^^^^^^^^^^^^^^^^^^ clflushopt is not valid for this target
|
= help: valid names are: adx, aes, amx-avx512, amx-bf16, and amx-complex and 75 more

For more information about this error, try rustc --explain E0635.
error: could not compile core_arch (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
Command /workspaces/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo test --tests --manifest-path /workspaces/rust/build/x86_64-unknown-linux-gnu/intrinsic-test/rust_programs/Cargo.toml --target x86_64-unknown-linux-gnu --profile release failed with exit code 101
Created at: src/bootstrap/src/core/build_steps/test.rs:1109:25
Executed at: src/bootstrap/src/core/build_steps/test.rs:1122:15

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:00:09

@Kobzol

Kobzol commented Jun 10, 2026

Copy link
Copy Markdown
Member

I tried the branch of this PR and it ended with:

error: the following required arguments were not provided:
  --cc-arg-style <CC_ARG_STYLE>

Usage: intrinsic-test --target <TARGET> --cc-arg-style <CC_ARG_STYLE> --skip <SKIP> --sample-percentage <SAMPLE_PERCENTAGE> <INPUT>

Could you please push your latest version here?

@xonx4l

xonx4l commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@Kobzol pushed the latest version which address previous requested review changes . I think now you will able to reproduce the similar errors . Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants