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

Add -Z instrument-xray flag #102963

Merged
merged 8 commits into from
Feb 10, 2023
Merged

Add -Z instrument-xray flag #102963

merged 8 commits into from
Feb 10, 2023

Conversation

ilammy
Copy link
Contributor

@ilammy ilammy commented Oct 12, 2022

Implement MCP rust-lang/compiler-team#561, adding -Z instrument-xray flag which enables XRay instrumentation in LLVM.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 12, 2022
@rust-highfive
Copy link
Collaborator

⚠️ Warning ⚠️

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 12, 2022
@rust-log-analyzer

This comment has been minimized.

@compiler-errors
Copy link
Member

I'm not exactly qualified to review this, re-rolling!

r? compiler

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@ilammy
Copy link
Contributor Author

ilammy commented Oct 14, 2022

Whew, that's surely a bunch of test that I was not aware of. Now should be all green. I gotta read more about x.py

@ilammy ilammy marked this pull request as ready for review October 14, 2022 09:48
@rustbot
Copy link
Collaborator

rustbot commented Oct 14, 2022

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@petrochenkov
Copy link
Contributor

I did a preliminary review, this looks fine, but I'll mark this as waiting on compiler team since the MCP is still open.

@petrochenkov petrochenkov added S-waiting-on-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 14, 2022
@bors
Copy link
Contributor

bors commented Oct 21, 2022

☔ The latest upstream changes (presumably #103344) made this pull request unmergeable. Please resolve the merge conflicts.

@Noratrieb
Copy link
Member

Hi, I've seen you changed some diagnostic structs in your PR. After #103345, the way we refer to fluent messages changed. They are now in a flat namespace with the same identifier as in the fluent file. For example, parser::cool_thing is now parser_cool_thing and parser::suggestion just suggestion.
You should rebase to the latest master and change your fluent message references as described above. Thanks!

@rustbot rustbot added the A-testsuite Area: The testsuite used to check the correctness of rustc label Oct 29, 2022
@rustbot
Copy link
Collaborator

rustbot commented Oct 29, 2022

These commits modify compiler targets.
(See the Target Tier Policy.)

@bors
Copy link
Contributor

bors commented Nov 10, 2022

☔ The latest upstream changes (presumably #104215) made this pull request unmergeable. Please resolve the merge conflicts.

@apiraino
Copy link
Contributor

Is the PR review status updated? Is it waiting for its MCP to be seconded (as per comment cc @petrochenkov )? Thanks for an update.

@ilammy
Copy link
Contributor Author

ilammy commented Dec 16, 2022

@apiraino, MCP is indeed still waiting to be seconded.

Recent updates to PR were only resolving merge conflicts. No substantial changes since @petrochenkov's review.

@ilammy
Copy link
Contributor Author

ilammy commented Feb 5, 2023

Rebased once again to resolve conflicts.

MCP has been accepted, unblocking this PR.

cc @petrochenkov, @estebank, @apiraino

@bors
Copy link
Contributor

bors commented Feb 5, 2023

☔ The latest upstream changes (presumably #107679) made this pull request unmergeable. Please resolve the merge conflicts.

@estebank
Copy link
Contributor

estebank commented Feb 6, 2023

r=me after rebasing once more

Recognize all bells and whistles that LLVM's XRay pass is capable of.
The always/never settings are a bit dumb without attributes but they're
still there. The default instruction count is chosen by the compiler,
not LLVM pass. We'll do it later.
I'm tired of testing it manually, just codify my expectations in tests.
They're pretty low-maintenance.
Four because that's the new reasonable maximum for XRay instrumentation
attributes in the following commit.
Add the attributes to functions according to the settings.

"xray-always" overrides "xray-never", and they both override
"xray-ignore-loops" and "xray-instruction-threshold", but we'll
let lints deal with warnings about silly attribute combinations.
Let's add at least some tests to verify that this option is accepted
and produces expected LLVM attributes. More tests can be added later
with attribute support.
Specify where XRay is supported. I only test ARM64 and x86_64, but hey
those others should work too, right? LLVM documentation says that MIPS
and PPC are also supported, but I don't have the hardware, so I won't
pretend. Naturally, more targets can be added later with more testing.
This is somewhat important because LLVM enables the pass based on
target architecture, but support by the target OS also matters.

For example, XRay attributes are processed by codegen for macOS
targets, but Apple linker fails to process relocations in XRay
data sections, so the feature as a whole is not supported there
for the time being.
Now that the compiler accepts "-Z instrument-xray" option only when
targeting one of the supported targets, make sure to not run the
codegen tests where the compiler will fail.

Like with other compiletests, we don't have access to internals,
so simply hardcode a list of supported architectures here.
@ilammy
Copy link
Contributor Author

ilammy commented Feb 9, 2023

Once again, resolved merge conflicts.

@pnkfelix
Copy link
Member

pnkfelix commented Feb 9, 2023

@bors r=estebank

@bors
Copy link
Contributor

bors commented Feb 9, 2023

📌 Commit 54b26f4 has been approved by estebank

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-team Status: Awaiting decision from the relevant subteam (see the T-<team> label). labels Feb 9, 2023
@bors
Copy link
Contributor

bors commented Feb 10, 2023

⌛ Testing commit 54b26f4 with merge a12d31d...

@bors
Copy link
Contributor

bors commented Feb 10, 2023

☀️ Test successful - checks-actions
Approved by: estebank
Pushing a12d31d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 10, 2023
@bors bors merged commit a12d31d into rust-lang:master Feb 10, 2023
@rustbot rustbot added this to the 1.69.0 milestone Feb 10, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a12d31d): 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)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-2.8% [-3.2%, -1.5%] 15
All ❌✅ (primary) -3.2% [-3.2%, -3.2%] 1

Cycles

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

@ilammy ilammy deleted the xray-basic branch February 12, 2023 08:16
@workingjubilee workingjubilee added the A-CLI Area: Command-line interface (CLI) to the compiler label Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: Command-line interface (CLI) to the compiler A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.