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

Allow injecting a profiler runtime into #![no_core] crates #133369

Merged
merged 6 commits into from
Nov 27, 2024

Conversation

Zalathar
Copy link
Contributor

An alternative to #133300, allowing -Cinstrument-coverage to be used with -Zbuild-std.

The incompatibility between profiler_builtins and #![no_core] crates appears to have been caused by profiler_builtins depending on core, and therefore conflicting with core (or minicore).

But that's a false dependency, because the profiler doesn't contain any actual Rust code. So we can just mark the profiler itself as #![no_core], and remove the incompatibility error.


For context, the error was originally added by #79958.

@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 23, 2024
@Zalathar
Copy link
Contributor Author

cc @Enselic @jieyouxu

@jieyouxu
Copy link
Member

jieyouxu commented Nov 23, 2024

I can't say I'm too familiar with profiler_builtins injection either, but cutting off the unnecessary dependency to core seems like a less fragile option than only skipping the profiler_builtins injection when building an .rlib.

@Zalathar Zalathar force-pushed the profiler-builtins-no-core branch from 89e2ad0 to bd7aa4b Compare November 24, 2024 00:35
@Zalathar Zalathar marked this pull request as ready for review November 24, 2024 03:59
@rustbot
Copy link
Collaborator

rustbot commented Nov 24, 2024

These commits modify the library/Cargo.lock file. Unintentional changes to library/Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@Zalathar
Copy link
Contributor Author

r? compiler

It's possible to write a run-make test that actually runs cargo with -Zbuild-std and RUSTFLAGS="-Cinstrument-coverage", but it's a bit fiddly and takes 20+ seconds to run (since it builds its own libraries), so I'm not sure whether it's worth adding.

@jieyouxu
Copy link
Member

r? jieyouxu

@rustbot rustbot assigned jieyouxu and unassigned fmease Nov 24, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, this seems reasonable to me, just one nit. You can r=me with the nit.

compiler/rustc_metadata/src/creader.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Nov 24, 2024

@bors rollup=never (profiler runtime setup modifications)

Now that the profiler runtime is itself `#![no_core]`, it can be a dependency
of other no_core crates, including core.
@Zalathar Zalathar force-pushed the profiler-builtins-no-core branch from bd7aa4b to 6798eca Compare November 24, 2024 10:20
@Zalathar
Copy link
Contributor Author

Addressed review feedback (diff).

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented Nov 24, 2024

📌 Commit 6798eca has been approved by jieyouxu

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 24, 2024
…r=jieyouxu

Allow injecting a profiler runtime into `#![no_core]` crates

An alternative to rust-lang#133300, allowing `-Cinstrument-coverage` to be used with `-Zbuild-std`.

The incompatibility between `profiler_builtins` and `#![no_core]` crates appears to have been caused by profiler_builtins depending on core, and therefore conflicting with core (or minicore).

But that's a false dependency, because the profiler doesn't contain any actual Rust code. So we can just mark the profiler itself as `#![no_core]`, and remove the incompatibility error.

---

For context, the error was originally added by rust-lang#79958.
@bors
Copy link
Contributor

bors commented Nov 24, 2024

⌛ Testing commit 6798eca with merge c1ad384...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-msvc-ext failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Nov 24, 2024

💔 Test failed - checks-actions

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

@bors retry (failed to pay msvc taxes)

@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 Nov 24, 2024
@bors
Copy link
Contributor

bors commented Nov 27, 2024

⌛ Testing commit 6798eca with merge 39cb338...

@bors
Copy link
Contributor

bors commented Nov 27, 2024

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing 39cb338 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 27, 2024
@bors bors merged commit 39cb338 into rust-lang:master Nov 27, 2024
7 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Nov 27, 2024
@Zalathar Zalathar deleted the profiler-builtins-no-core branch November 27, 2024 13:10
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (39cb338): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

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

Max RSS (memory usage)

Results (primary 3.6%, secondary -0.0%)

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)
3.6% [3.6%, 3.6%] 1
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) 3.6% [3.6%, 3.6%] 1

Cycles

Results (primary 4.2%)

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)
4.2% [4.2%, 4.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 4.2% [4.2%, 4.2%] 1

Binary size

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

Bootstrap: 794.092s -> 793.948s (-0.02%)
Artifact size: 336.11 MiB -> 336.16 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants