runtimeverification / runtimeverification/stable-mir-json

Intrinsics require investigation

Open
#13 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Future Work Notes
Dominant language
Rust
Stars
11
Forks
6
PR merge metrics
No merged PRs in 30d

Description

Goal
  • Find the definitive set of intrinics as we will see them in the MIR / SMIR
  • Strip the instrinsics that we care about
  • Find appropriate tests to examine intrinsics
  • Observe that instrinsics are working as we expect and we are handling correctly
Sources
  • ui/compiletest
  • cargo build -Z build-std --target <TARGET> e.g. cargo build -Z build-std --target x86_64-unknown-linux-gnu more info can be found in Stephen's hack.md and cargo reference
    NOTE: This is a cargo flag not rustc flag.
    This will throw attempting to add the flags with smir_pretty with
error: "/home/daniel/Applications/mir-semantics/deps/smir_pretty/deps/rust/src/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/src/rust/library/Cargo.lock" does not exist, unable to build with the standard library, try:
        rustup component add rust-src --toolchain smir_serde_derive_intern_scripts

meaning that the the rust-src component is required for the toolchain. However it will not be able to do this for smir_serde_derive_intern_scripts as it is our own fork branch (If there is a way let me know).
But the compiler can be set to the same version the that is the base of the smir_serde_derive_intern_scripts fork with rustup defaulting to the day subsequent to the last rustc commit:

rustup default nightly-2024-07-27
rustup component add rust-src --toolchain nightly-2024-07-27-x86_64-unknown-linux-gnu

Then the artefacts of the std-lib can be found in <PROJECT ROOT>/target/<TARGET> e.g. hello-world/target/x86_64-unknown-linux-gnu.

Questions for the investigation:
  • What are the names of all the intrinsics
    • Rv rust fork: get_instrincs.sh gets the names at source level
    • Need to find the mangled names
Noticed Behaviour
  • Sometimes the compiler generates a mir body for the intrinsic?
    • Suspect: If LLVM knows the intrinsic then it doesn't generate a mir body
  • Sometimes intrinsics are generic?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with ui/compiletest and the Rv Rust fork's get_instrincs.sh, then use the documented cargo build -Z build-std flow with the required rust-src component to inspect generated MIR/SMIR. Done means documenting the definitive source-level and mangled intrinsic names, identifying appropriate tests, and explaining when intrinsics receive MIR bodies and when generic intrinsics are handled correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.