-
Notifications
You must be signed in to change notification settings - Fork 397
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
[RR_GRAPH] Fixed Bug in LLVM17 Build #2522
[RR_GRAPH] Fixed Bug in LLVM17 Build #2522
Conversation
Thanks for this! I have not yet checked if this patch fixes the LLVM-17 build issue, but I will send it over to the tester very soon. But it does build and run for gcc-12 and llvm-15, which is what I have on my system. So, I checked the performance with this patch on the cmdlines that @amin1377 and I came up with for SPEC CPUv8. Indeed, there is about a 10% perf loss across a variety of configs/builds. Here is the data reported in seconds, on an aarch64 based Ampere Altra 3.0 Ghz system running Ubuntu 22.04.
|
I spent the last day running the large Titan benchmarks, and confirmed what @heshpdx has found: An 11% increase in overall runtime, no change in QoR. Unless we can find a more efficient way to make the de-reference operator a const method in this class, I do not think this can be merged into VPR master. We could IFDEF the old version with the new version based on the version of C++ being used to compile, as an idea. |
We confirmed that the patch does allow compilation on llvm-17, and also confirmed a perf slowdown. Can you try reverting the patch and then converting all of the instances of |
The std::sort function requires operands to be "pointer-like", this requires that de-referencing a const pointer should be allowed. This was not an issue in the past, but in LLVM17 this property is required. The edge_sort_iterator did not follow this property. Fixing this by naively allowing this property led to a 10% performance degredation due to requiring pointers to be allocated and deallocated. To fix this for now, made the sort use std::stable_sort instead. The performance degredation is quite small and may be worth it.
f4b6694
to
973acb7
Compare
@heshpdx I have reverted the changes and converted the std::sorts to std::stable_sorts. I have also rerun the profiling of the large Titan benchmarks and have shown only a minor slowdown of around 1%. I have also added a comment to the code to explain this issue to anyone who comes across this again in the future; since I do not think there is a guarantee that even stable sort would not make one of its references to its iterators to being const in the future. @vaughnbetz What do you think about this change? |
Thanks. This change seems OK to me. |
FYI, for SPEC CPUv8 we changed ALL of the sort's into stable_sort's, everywhere in the source. Maybe it was overkill, but it's a defensive move. |
@amin1377 : could you try running a cpu time experiment with the remaining sorts turned into stable sorts? If it doesn't hurt cpu time, we can convert them all. I'd like to keep the master in sync with SPEC CPUv8, with #ifdef SPEC or some such guarding any minor changes we can't turn on for the master (e.g. making sure all the base_costs are integral). |
I've already submitted a PR for this, and I'm currently waiting for the completion of the runs to gather the Quality of Results (QoR). |
I believe the patch below is the real fix. I can confirm that this builds for LLVM17 (and 18 and 19.1.0-rc3). BTW we have found which sorts need to be stable and which ones do not; when I get time I can share a patch that recovers performance.
|
The std::sort function requires operands to be "pointer-like", this requires that de-referencing a const pointer should be allowed.
This was not an issue in the past, but in LLVM17 this property is required. The edge_sort_iterator did not follow this property. This has been fixed.
Description
See issue #2517
The LLVM17 build failed due to a const edge_sort_iterator unable to be de-referenced. This PR fixes that issue.
The problem is that this required the
swapper_
member to be a pointer to allow this to work. This means that theswapper_
object needs to be declared on the heap. This may have affects on the performance of this implementation. To prevent regression in performance, this needs to be profiled to ensure we do not slow down the current high-priority builds for future builds.Related Issue
issue #2517
How Has This Been Tested?
Ran the quick and hard regression tests.
Still need to profile to ensure the performance does not regress.