-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL][NFC] Extract specialization constant's processing from sycl-post-link to SYCLPostLink library. #19022
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
base: sycl
Are you sure you want to change the base?
Conversation
…st-link to SYCLPostLink library. This change allows later reuse in the New Offloading Model and sycl-jit.
The interface of a function SmallVector<ModuleDesc> MDs;
Modified |= handleSpecializationConstants(MDs, Mode); If you have a better alternative for the function's interface let me know. |
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.
Looks good overall, just a few nits.
@@ -0,0 +1,97 @@ | |||
//= SpecializationConstants.h - Processing of SYCL Specialization Constants ==// |
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.
//= SpecializationConstants.h - Processing of SYCL Specialization Constants ==// | |
//= SpecializationConstants.cpp - Processing of SYCL Specialization Constants ==// |
std::optional<SpecConstantsPass::HandlingMode> Mode, | ||
bool GenerateModuleDescWithDefaultSpecConsts, | ||
SmallVectorImpl<module_split::ModuleDesc> *NewModuleDescs) { | ||
assert((GenerateModuleDescWithDefaultSpecConsts ^ !NewModuleDescs) && |
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 quite difficult to read. Could we rewrite this to something simpler?
Maybe something like:
assert((GenerateModuleDescWithDefaultSpecConsts ^ !NewModuleDescs) && | |
#ifdef NDEBUG | |
if (GenerateModuleDescWithDefaultSpecConsts) | |
assert(NewModuleDescs); | |
#endif |
} // namespace | ||
|
||
bool llvm::sycl::handleSpecializationConstants( | ||
SmallVectorImpl<module_split::ModuleDesc> &MDs, |
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.
SmallVectorImpl<module_split::ModuleDesc> &MDs, | |
const SmallVectorImpl<module_split::ModuleDesc> &MDs, |
MAM.registerPass([&] { return PassInstrumentationAnalysis(); }); | ||
RunSpecConst.addPass(std::move(SCP)); | ||
|
||
// Perform the spec constant intrinsics transformation on resulting module |
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.
// Perform the spec constant intrinsics transformation on resulting module | |
// Perform the spec constant intrinsics transformation on resulting module. |
ModulePassManager RunSpecConst; | ||
ModuleAnalysisManager MAM; | ||
SpecConstantsPass SCP(Mode); | ||
// Register required analysis |
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.
// Register required analysis | |
// Register required analysis. |
This change allows later reuse of specialization constant's processing in the New Offloading Model and sycl-jit.