-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 -Zremark-dir
unstable flag to write LLVM optimization remarks to YAML
#113040
Conversation
This PR changes how LLVM is built. Consider updating src/bootstrap/download-ci-llvm-stamp. |
6d1171d
to
293bd10
Compare
☔ The latest upstream changes (presumably #113105) made this pull request unmergeable. Please resolve the merge conflicts. |
-Cremark-dir
to write LLVM optimization remarks to YAML-Zremark-dir
unstable flag to write LLVM optimization remarks to YAML
293bd10
to
adfcae2
Compare
Rebased and turned the flag into an unstable one. The files are now also split based on the "section" of codegen that is being performed. |
As for testing maybe a run-make test similar to the existing ui test optimization-remark.rs? I would be nice to test filtering as well. There seems to be a an additional pre-existing issue: the diagnostic handler is not configured at all during post-link ThinLTO optimization phase. |
Oh, so that is not on purpose? I was wondering why is there only fat LTO 😅 |
I added a simple test, let me know if it's any good or if I should extend it :) |
Thanks for the review, I tried to improve error reporting in general. |
Thanks! @bors r+ |
…asko Add `-Zremark-dir` unstable flag to write LLVM optimization remarks to YAML This PR adds an option for `rustc` to emit LLVM optimization remarks to a set of YAML files, which can then be digested by existing tools, like https://github.com/OfekShilon/optview2. When `-Cremark-dir` is passed, and remarks are enabled (`-Cremark=all`), the remarks will be now written to the specified directory, **instead** of being printed to standard error output. The files are named based on the CGU from which they are being generated. Currently, the remarks are written using the LLVM streaming machinery, directly in the diagnostics handler. It seemed easier than going back to Rust and then form there back to C++ to use the streamer from the diagnostics handler. But there are many ways to implement this, of course, so I'm open to suggestions :) I included some comments with questions into the code. Also, I'm not sure how to test this. r? `@tmiasko`
@bors delegate=Kobzol |
📌 Commit 79a186638e1ca7641c24b2c0c873941773be2dd6 has been approved by It is now in the queue for this repository. |
@bors r- |
79a1866
to
62728c7
Compare
@bors rollup=iffy |
☀️ Test successful - checks-actions |
Finished benchmarking commit (131a036): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 662.06s -> 661.354s (-0.11%) |
Add hotness data to LLVM remarks Slight improvement of rust-lang#113040. This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute. r? `@tmiasko`
Add hotness data to LLVM remarks Slight improvement of rust-lang/rust#113040. This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute. r? `@tmiasko`
Add hotness data to LLVM remarks Slight improvement of rust-lang/rust#113040. This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute. r? `@tmiasko`
Add hotness data to LLVM remarks Slight improvement of rust-lang/rust#113040. This makes sure that if PGO is used, remarks generated using `-Zremark-dir` will include the `Hotness` attribute. r? `@tmiasko`
This PR adds an option for
rustc
to emit LLVM optimization remarks to a set of YAML files, which can then be digested by existing tools, like https://github.com/OfekShilon/optview2. When-Cremark-dir
is passed, and remarks are enabled (-Cremark=all
), the remarks will be now written to the specified directory, instead of being printed to standard error output. The files are named based on the CGU from which they are being generated.Currently, the remarks are written using the LLVM streaming machinery, directly in the diagnostics handler. It seemed easier than going back to Rust and then form there back to C++ to use the streamer from the diagnostics handler. But there are many ways to implement this, of course, so I'm open to suggestions :)
I included some comments with questions into the code. Also, I'm not sure how to test this.
r? @tmiasko