Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configuring the set of codegen backends to build per host triple #120348

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Jan 25, 2024

This allows building the compiler itself with one backend while using another backend at runtime. For example this allows compiling rustc to wasm using LLVM, while using Cranelift at runtime to produce actual code. Cranelift can't compile to wasm, but is perfectly capable of running on wasm. LLVM can compile to wasm, but can't run on wasm. 1

Footnotes

  1. The prototype of this still requires a couple of other patches.

This allows building the compiler itself with one backend while using
another backend at runtime. For example this allows compiling rustc to
wasm using LLVM, while using Cranelift at runtime to produce actual
code. Cranelift can't compile to wasm, but is perfectly capable of
running on wasm. LLVM can compile to wasm, but can't run on wasm. [^1]

[^1]: The prototype of this still requires a couple of other patches.
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2024

r? @albertlarsan68

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added 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 Jan 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2024

This PR modifies config.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@@ -581,6 +581,7 @@ pub struct Target {
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
pub codegen_backends: Option<Vec<Interned<String>>>,
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a change info for this field? Similar to

ChangeInfo {
change_id: 117435,
severity: ChangeSeverity::Info,
summary: "New option `rust.parallel-compiler` added to config.toml.",
},

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@rust-log-analyzer

This comment has been minimized.

@bjorn3 bjorn3 force-pushed the per_target_backend_selection branch from 4f107e6 to f4e279f Compare January 27, 2024 10:42
@albertlarsan68
Copy link
Member

How does this interact with stages ?

@bjorn3
Copy link
Member Author

bjorn3 commented Jan 27, 2024

If the host triple matches the build triple, then setting it in target.<triple>.codegen-backends will apply to all stages. If they don't match, it will apply to rustc compiled for the respective target.

@albertlarsan68
Copy link
Member

Thanks for the PR!
@bors r+

@bors
Copy link
Contributor

bors commented Feb 16, 2024

📌 Commit f4e279f has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2024
@bors
Copy link
Contributor

bors commented Feb 16, 2024

⌛ Testing commit f4e279f with merge 93a65c6...

@bors
Copy link
Contributor

bors commented Feb 16, 2024

☀️ Test successful - checks-actions
Approved by: albertlarsan68
Pushing 93a65c6 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 16, 2024
@bors bors merged commit 93a65c6 into rust-lang:master Feb 16, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 16, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (93a65c6): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.3% [-4.3%, -4.3%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.1% [2.1%, 2.1%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.1% [2.1%, 2.1%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 639.468s -> 638.862s (-0.09%)
Artifact size: 306.35 MiB -> 306.32 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants