-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[CAS] Add LLVMCAS library with InMemoryCAS implementation #114096
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
[CAS] Add LLVMCAS library with InMemoryCAS implementation #114096
Conversation
Created using spr 1.3.5
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.
This is a large patch, so I haven't read all the C++ closely enough to say anything about it. Mostly, I've left comments on the documentation, and pointed out a few things I saw while skimming the implementation.
I think overall a bit more explanation about how some of the key classes interoperate may be warranted. For instance I really don't understand why some of the reinterpret casts should be legal in InMemroyInlineObject
.
The other thing I see is a pattern of foo(){return fooImpl();}
, but fooImpl()
isn't private or (from what I can see) an extension point. I'm not sure I understand the design choice here, since I don't recall seeing it used this way much in LLVM. Normally the Impls are either private, virtual, or in some other module/namespace. It's a big project, so maybe I've just missed something though.
I'll try to take a more detailed look at the implementation code, but I'd encourage others to look too, since this is a very large, complicated patch set.
Created using spr 1.3.5
Created using spr 1.3.5
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.
Everything LGTM!
Created using spr 1.3.5
Created using spr 1.3.6
Ping! I am going to pushing to upstreaming CAS implementation again with the hope to land this before next dev meeting. @ilovepi @bogner @adrian-prantl Let me know if you want to take another look while I start working on rebasing and updating all the patches. |
Created using spr 1.3.6
Thanks @adrian-prantl . I will let it sit over the weekend in case anyone wants to make comments. |
Created using spr 1.3.6
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/19563 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/206/builds/4666 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/18352 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/207/builds/5164 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/18375 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/76/builds/12066 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/22828 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/22971 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/145/builds/9019 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/42/builds/5770 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/118/builds/7759 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/97/builds/8104 Here is the relevant piece of the build log for the reference
|
@cachemeifyoucan I'm seeing this MSVC warning since this patch please can you investigate?
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/130/builds/14938 Here is the relevant piece of the build log for the reference
|
The unit test associated with this commit appears to be running infinitely inside of CASTest.BlobsParallel with our downstream toolchain running on X86 Linux. I'm not sure where to begin with respect to figuring out why other than just to turn it off.
|
@evodius96 Do you have a stack trace for the hang? Is it really hang or just take a long time? I can disable it but we have x86 linux bot (ubuntu) that runs this test without problem. |
@evodius96 I have a guess. Is it possible that you config llvm with LLVM_ENABLE_THREADS=Off? I should disable test in single thread mode. |
Yes, we do -- I believe that's the issue. Thanks! |
We have also observed hangs in this test on s390x, ppc64le and i686 (but not x86_64 and aarch64). We're not using LLVM_ENABLE_THREADS=OFF. |
Okay, it looks like the test hangs whenever only two cores or less are available. Trivially reproducible using |
Checking getMaxConcurrency() would work, but really I don't think using ThreadPool is appropriate for what you are doing here. These are not "tasks" where it's okay to schedule the later ones only after the earlier ones have finished. You should probably be using std::thread directly. |
This test hangs forever if executed with less than three cores available, see: #114096 (comment)
Test commented out in ba45ac6. |
This test hangs forever if executed with less than three cores available, see: llvm/llvm-project#114096 (comment)
@nikic thanks for reporting. I guess we were not yielding the thread so it dead-lock when the parallelism is only two. Maybe the simpler fix is to just call producer first since the concurrency behavior that is being tested wasn't guaranteed either way. |
Try fix and enable: #154151 |
Add llvm::cas::ObjectStore abstraction and InMemoryCAS as a in-memory
CAS object store implementation.
The ObjectStore models its objects as:
And each CAS Object can be idenfied with an unqine ID/Hash.
ObjectStore supports following general action:
It also introduces following types to interact with a CAS ObjectStore:
print/compare CASIDs.
implementation defined so it can be optimized for
read/store/references depending on the implementation.
inside CAS Object. It bundles a ObjectHandle and an ObjectStore
instance.