-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[Libomptarget] Rework image checking further #76120
Conversation
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.
Thank you Joseph; two questions.
llvm::getLazyIRModule(std::move(MB), Diagnostic, Context, | ||
/*ShouldLazyLoadMetadata=*/true); | ||
auto ModuleOrErr = getLazyBitcodeModule(MemoryBufferRef(Buffer, ""), Context, | ||
/*ShouldLazyLoadMetadata=*/false); |
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.
Can the construction of the MemoryBufferRef
fail?
I probably don't know enough about the different APIs. Can you tell me why the last parameter here was changed to false
?
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.
No, a memory buffer reference is just a reference to existing memory. The second parameter is the buffer's identifier. E.g. if it was opened from a file it would be the filename.
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.
Thanks for explaining, and sorry for confusion. I was asking for the parameter about "ShouldLazyLoadMetadata". Why has that changed to false?
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.
Oh, good catch, that was unintentional. We're only interested in the Triple so we should skip loading the entire table.
Summary: In the future, we may have more checks for different kinds of inputs, e.g. SPIR-V. This patch simply reworks the handling to be more generic and do the magic detection up-front. The checks inside the routines are now asserts so we don't spend time checking this stuff over and over again. This patch also tweaked the bitcode check. I used a different function to get the Lazy-IR module now, as it returns the raw expected value rather than the SM diganostic. No functionality change intended.
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.
LG
Lands and reverts: 64f0681 [Libomptarget] Rework image checking further (llvm#76120) Change-Id: I1420dcaaceb16986d3c2d3f4c0cfc2bc35333fce
Summary:
In the future, we may have more checks for different kinds of inputs,
e.g. SPIR-V. This patch simply reworks the handling to be more generic
and do the magic detection up-front. The checks inside the routines are
now asserts so we don't spend time checking this stuff over and over
again.
This patch also tweaked the bitcode check. I used a different function
to get the Lazy-IR module now, as it returns the raw expected value
rather than the SM diganostic.
No functionality change intended.