-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add generation of device image with specialization constants replaced by default values #10115
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
[SYCL] Add generation of device image with specialization constants replaced by default values #10115
Conversation
2d6a440
to
e2c6b23
Compare
…eplaced by default values
e2c6b23
to
c4c9bdb
Compare
llvm/test/tools/sycl-post-link/spec-constants/default-value/device-image.ll
Outdated
Show resolved
Hide resolved
TODO:
|
ModuleDesc CloneModuleDesc(const ModuleDesc &MD) { | ||
std::unique_ptr<Module> NewModule = CloneModule(MD.getModule()); | ||
ModuleDesc NewMD(std::move(NewModule)); | ||
NewMD.EntryPoints.Props = MD.EntryPoints.Props; | ||
return NewMD; | ||
} |
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.
It seems like some kind of deep copy of ModuleDesc is needed here. At least in addition to EntryPoints.Props also EntryPoints.Functions need to be copied.
Otherwise cloned module/device image is not registered in ProgramManager through void ProgramManager::addImages(pi_device_binaries DeviceBinary) because it doesn't have entry points.
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.
Addresses it. Now symbol generation is being checked in llvm/test/tools/sycl-post-link/spec-constants/default-value/device-image.ll
llvm/test/tools/sycl-post-link/spec-constants/default-value/struct-with-padding.ll
Outdated
Show resolved
Hide resolved
llvm/test/tools/sycl-post-link/spec-constants/default-value/split-by-source.ll
Outdated
Show resolved
Hide resolved
llvm/test/tools/sycl-post-link/spec-constants/default-value/esimd.ll
Outdated
Show resolved
Hide resolved
llvm/test/tools/sycl-post-link/spec-constants/default-value/device-image.ll
Outdated
Show resolved
Hide resolved
llvm/test/tools/sycl-post-link/spec-constants/default-value/split-by-kernel.ll
Outdated
Show resolved
Hide resolved
llvm/test/tools/sycl-post-link/spec-constants/default-value/struct-with-padding.ll
Outdated
Show resolved
Hide resolved
#include "llvm/IR/InstIterator.h" | ||
#include "llvm/IR/Instruction.h" | ||
#include "llvm/IR/Instructions.h" | ||
#include "llvm/IR/Operator.h" | ||
|
||
#include <vector> |
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.
Unnecessary include
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.
I saw there 2 usages of std::vector.
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.
Got it, I just though that we don't use it at all
if (Mode == HandlingMode::default_values) | ||
for (Function *F : SpecConstDeclarations) | ||
F->removeFromParent(); |
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.
I still don't think that removal of unused declarations should be a part of SpecConstantsPass
, because any transformation pass could leave those and having cleanup code in each of them does not seem like a good design. We have a dedicated pass for cleanup, no need to duplicate its code to every pass.
You can just add StripDeadPrototypesPass
to the pipeline when launching SpecConstantsPass
to emit that extra device image with default values of spec constants
No description provided.