Skip to content

[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

Merged
merged 19 commits into from
Aug 17, 2023

Conversation

maksimsab
Copy link
Contributor

No description provided.

@maksimsab maksimsab changed the title [SYCL] Add generation of device image with specialization constants replaced by default values [SYCL][NFC] Add generation of device image with specialization constants replaced by default values Jun 28, 2023
@maksimsab maksimsab changed the title [SYCL][NFC] Add generation of device image with specialization constants replaced by default values [SYCL] Add generation of device image with specialization constants replaced by default values Jun 29, 2023
@maksimsab maksimsab force-pushed the add_devimage_spec_consts branch 6 times, most recently from 2d6a440 to e2c6b23 Compare July 12, 2023 14:09
@maksimsab maksimsab force-pushed the add_devimage_spec_consts branch from e2c6b23 to c4c9bdb Compare July 12, 2023 14:12
@maksimsab maksimsab marked this pull request as ready for review July 12, 2023 14:13
@maksimsab maksimsab requested a review from a team as a code owner July 12, 2023 14:13
@maksimsab maksimsab temporarily deployed to aws July 12, 2023 14:31 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws July 12, 2023 15:11 — with GitHub Actions Inactive
@maksimsab
Copy link
Contributor Author

maksimsab commented Jul 13, 2023

TODO:

  • add test with padding
  • test without sret.
  • test with scalars
  • test esimd properties and symbol generation
  • zeroinitializer
  • bool

@maksimsab maksimsab temporarily deployed to aws July 25, 2023 16:59 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws July 25, 2023 17:36 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws July 27, 2023 16:38 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws July 27, 2023 17:22 — with GitHub Actions Inactive
Comment on lines 573 to 578
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;
}
Copy link
Contributor

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.

Copy link
Contributor Author

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

@maksimsab maksimsab requested a review from AlexeySachkov July 28, 2023 11:59
@maksimsab maksimsab temporarily deployed to aws July 28, 2023 12:19 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws July 28, 2023 12:59 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 3, 2023 13:28 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 3, 2023 14:08 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 3, 2023 14:59 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 3, 2023 15:40 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 4, 2023 15:53 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 4, 2023 16:42 — with GitHub Actions Inactive
@maksimsab maksimsab requested a review from AlexeySachkov August 7, 2023 13:04
@maksimsab maksimsab temporarily deployed to aws August 7, 2023 13:19 — with GitHub Actions Inactive
@maksimsab maksimsab temporarily deployed to aws August 7, 2023 14:31 — with GitHub Actions Inactive
#include "llvm/IR/InstIterator.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Operator.h"

#include <vector>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary include

Copy link
Contributor Author

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.

Copy link
Contributor

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

Comment on lines 905 to 907
if (Mode == HandlingMode::default_values)
for (Function *F : SpecConstDeclarations)
F->removeFromParent();
Copy link
Contributor

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

@AlexeySachkov AlexeySachkov merged commit a7ef268 into intel:sycl Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants