-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[test] Fixes #120514 #125450
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
[test] Fixes #120514 #125450
Conversation
@llvm/pr-subscribers-lld-elf @llvm/pr-subscribers-lld Author: Pengying Xu (Colibrow) ChangesFull diff: https://github.com/llvm/llvm-project/pull/125450.diff 1 Files Affected:
diff --git a/lld/test/ELF/bp-section-orderer.s b/lld/test/ELF/bp-section-orderer.s
index 1f3776280eae0e..ef7659e338aa7f 100644
--- a/lld/test/ELF/bp-section-orderer.s
+++ b/lld/test/ELF/bp-section-orderer.s
@@ -37,14 +37,18 @@
# RUN: ld.lld -o out.cd a.o --verbose-bp-section-orderer --bp-compression-sort=data 2>&1 | FileCheck %s --check-prefix=BP-COMPRESSION-DATA
# RUN: llvm-nm -jn out.cd | tr '\n' , | FileCheck %s --check-prefix=CDATA
-# CDATA: s4,s2,s1,s5,s3,F,C,E,D,B,A,_start,d4,d1,d3,d2,
+# CDATA-DAG: s4,s2,s1
+# CDATA-DAG: s5,s3
+# CDATA: F,C,E,D,B,A,_start,d4,d1,d3,d2,
# RUN: ld.lld -o out.cb a.o --verbose-bp-section-orderer --bp-compression-sort=both 2>&1 | FileCheck %s --check-prefix=BP-COMPRESSION-BOTH
# RUN: llvm-nm -jn out.cb | tr '\n' , | FileCheck %s --check-prefix=CDATA
# RUN: ld.lld -o out.cbs a.o --verbose-bp-section-orderer --bp-compression-sort=both --irpgo-profile=a.profdata --bp-startup-sort=function 2>&1 | FileCheck %s --check-prefix=BP-COMPRESSION-BOTH
# RUN: llvm-nm -jn out.cbs | tr '\n' , | FileCheck %s --check-prefix=CBOTH-STARTUP
-# CBOTH-STARTUP: s4,s2,s1,s5,s3,A,B,C,F,E,D,_start,d4,d1,d3,d2,
+# CBOTH-STARTUP-DAG: s4,s2,s1,
+# CBOTH-STARTUP-DAG: s5,s3
+# CBOTH-STARTUP: A,B,C,F,E,D,_start,d4,d1,d3,d2,
# BP-COMPRESSION-FUNC: Ordered 7 sections using balanced partitioning
# BP-COMPRESSION-DATA: Ordered 9 sections using balanced partitioning
@@ -100,8 +104,6 @@ E
D
s2
s1
-r3
-r2
#--- a.c
const char s5[] = "engineering";
|
If there is a problem due to DenseMap, DenseSet iteration order, we should fix the source code to avoid host differences. |
https://lab.llvm.org/buildbot/#/builders/24/builds/4900
I haven't found the reason which the problem reproduced on my local mac build which flip the order of s5 and s4.. |
No, we hit the error also at b693e1c which comes after: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8723973565647921217/+/u/package_clang/stdout |
Reverted in f3c4b58 to unbreak the bots for now. |
@MaskRay I was able to reproduce this problem in the Mac environment and printed the nodesForDataCompression information before and after the BalancePartition algorithm. I found that the input before the algorithm was consistent, but there was a difference in order after running. Is this something in the BP algorithm? some randomness or something.. |
llvm-project/llvm/lib/Support/BalancedPartitioning.cpp Lines 308 to 310 in fe8b323
Maybe I am wrong. Splitting the nodes using std::nth_element causes a slight difference because this API doesn't guarantee the order of initialization. In my opinion, it shouldn't affect the final order, but it does. When I switched to llvm::sort , it seems to match.
|
Are you seeing non-deterministic behavior on different platforms? Or have you seen this on the same platform? |
Exposed by the test added in the reverted #120514 * Fix libstdc++/libc++ differences due to nth_element. #125450 (comment) * Fix LLVM_ENABLE_REVERSE_ITERATION=1 differences * Fix potential issue in `currentSize += D::getSize(*sections[*sectionIdxs.begin()])` where DenseSet was used, though not covered by a test
Exposed by the test added in the reverted #120514 * Fix libstdc++/libc++ differences due to nth_element. llvm/llvm-project#125450 (comment) * Fix LLVM_ENABLE_REVERSE_ITERATION=1 differences * Fix potential issue in `currentSize += D::getSize(*sections[*sectionIdxs.begin()])` where DenseSet was used, though not covered by a test
I mainly tested on mac arm64 and debian-x86_64, for the same input, which in linux-nth-element:
After nth_element, the ID:11 becomes the first item, while the other two builds follow the original input order, resulting in the same final output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proper fix is in 2f6e3df, which seems ok to me. Since it should be fixed I think we can close this PR.
Closed. |
The ELF/bp-section-orderer.s test is failing on some buildbots due to what seems like non-determinism issues, see comments on the original PR and llvm#125450 Reverting to green the build. This reverts commit 0154dce and follow-up commits 046dd4b and c92f204.
Exposed by the test added in the reverted llvm#120514 * Fix libstdc++/libc++ differences due to nth_element. llvm#125450 (comment) * Fix LLVM_ENABLE_REVERSE_ITERATION=1 differences * Fix potential issue in `currentSize += D::getSize(*sections[*sectionIdxs.begin()])` where DenseSet was used, though not covered by a test
No description provided.