-
Notifications
You must be signed in to change notification settings - Fork 566
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
Fix non-strict HIP device lib order #2217
Conversation
could you please add a test for this ? thanks |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2217 +/- ##
===========================================
+ Coverage 30.91% 62.25% +31.34%
===========================================
Files 53 59 +6
Lines 20112 31049 +10937
Branches 9755 0 -9755
===========================================
+ Hits 6217 19330 +13113
- Misses 7922 11719 +3797
+ Partials 5973 0 -5973 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
4d87a24
to
c3eb3c5
Compare
Im not 100% sure what the best way is to add the tests, considering that fully testing that issue requires deleting and then re-adding a file from the HIP bitcode directory ( |
e0a58c1
to
48d6ed7
Compare
bump |
still need tests, sorry :) |
3d28979
to
b2355f7
Compare
Seems that fuse doesn't work in github actions. I guess the only other approach swapping out calls to |
Hmm, it might be possible to LD_PRELOAD a library which returns random results from readdir... |
84c025c
to
c7c9136
Compare
@sylvestre What do you think about this approach? It seems to be working fine in our fork's CI, though I feel like theres some confirmation missing that the shim is actually running. One details is that I've had to set LD_PRELOAD separately on each run, it seems that using |
@@ -0,0 +1,196 @@ | |||
use ctor::ctor; |
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.
please add the license header
c7c9136
to
7c11cce
Compare
sorry but could you please rebase it? thanks |
7c11cce
to
dc7bbdd
Compare
0251a07
to
d6a4255
Compare
Alright, I think this is finally really ready now. I've updated the readdir randomizer with a comment that describes how and why it works the way it does, and added a simple log-based method to double check that the shim is actually running. Sorry for taking so long to finalize this... |
d6a4255
to
de08ad3
Compare
This is a simple libc shim that randomizes the results of readdir(). For some functionality, cache hashes are dependent on the order that values are returned from fs::read_dir(), which calls lib readdir(). This library can be inserted into the target application's runtime using LD_PRELOAD=target/debug/librandmize_readdir.so, after which the results of readdir() will return in random order. It is only intended to be used while testing sccache.
de08ad3
to
c366abf
Compare
In #2045 initial support for HIP was added. While trying it out, I noticed that different runs across different machines did not yield an expected cache hit. After some investigation, it turns out that the list of bitcode device libraries is not sorted after discovering them from the file system, and this resulted in a different order across those machines. I've added a fix that simply sorts those libraries after discovering them, that seems to be similar to how its handled elsewhere.