Skip to content
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

[WIP][Do not Review][SYCL] Decompose Kernel Parameters #1833

Closed

Conversation

elizabethandrews
Copy link
Contributor

First (incomplete) patch decomposing base classes and structfields.

Currently, struct kernel parameters are passed as a whole, along with
individual parameters for special SYCL types resulting in special SYCL
paramters being passed twice. To avoid this, we now decompose structs,
passing all fields as top level parameters.

TO DO: in follow up commit: Add condition to decompose only if struct
contains special SYCL type

Signed-off-by: Elizabeth Andrews elizabeth.andrews@intel.com

fields.

Currently, struct kernel parameters are passed as a whole, along with
individual parameters for special SYCL types resulting in special SYCL
paramters being passed twice. To avoid this, we now decompose structs,
passing all fields as top level parameters.

TO DO: in follow up commit: Add condition to decompose only if struct
contains special SYCL type

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
@elizabethandrews
Copy link
Contributor Author

Please note this crashes at the moment for multiple base classes. I am debugging this. I am not sure if the approach I've taken is correct, so any feedback is greatly appreciated.

Wrapped arrays cause issue now since it is now a top level kernel argument which is not handled. I am pretty sure all special SYCL types crash too. I haven't had a chance to debug those.

@elizabethandrews
Copy link
Contributor Author

This is the AST I was using as a 'prototype' - https://godbolt.org/z/vRdcNw

@Fznamznon
Copy link
Contributor

BTW, we started adding support for array kernel parameters #1764 . This change conflicts with yours.

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
CXXRecordDecl *RD = FieldTy->getAsCXXRecordDecl();
VisitAccessorWrapper(nullptr, Field, RD, handlers...);
VisitRecord(nullptr, Field, RD, handlers...);
Copy link
Contributor

@v-klochkov v-klochkov Jun 8, 2020

Choose a reason for hiding this comment

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

The 3rd parameter 'RD' seems optimizable to me. I suggest removing it.
It always depends on the 2nd parameter, and defined as Field->getType()->getAsCXXRecordDecl().

Suggested change
VisitRecord(nullptr, Field, RD, handlers...);
VisitRecord(nullptr, Field, handlers...);

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, inside VisitRecord func you can write:
CXXRecordDecl *Wrapper = Parent->getType()->getAsCXXRecordDecl();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I will take a look

Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
Signed-off-by: Elizabeth Andrews <elizabeth.andrews@intel.com>
@elizabethandrews elizabethandrews changed the title [WIP][SYCL] Decompose Kernel Parameters [WIP][Do not Review][SYCL] Decompose Kernel Parameters Jun 9, 2020
void leaveStruct(const CXXRecordDecl *, FieldDecl *FD) final {
MemberExprBases.pop_back();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should leave it.

}
// if (MemberExprBases.size() == 1) {
InitializedEntity Entity =
InitializedEntity::InitializeMember(FD, &VarEntity);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit concerned about this place since VarEntity is some stuff created for kernel object clone variable. I think we need to create corresponding InitializedEntity for each structure when we enter it.

@elizabethandrews
Copy link
Contributor Author

Work moved to PR#1877

KornevNikita pushed a commit to KornevNikita/llvm that referenced this pull request Feb 20, 2023
JointMatrixMadINTEL will stand for signed/signed Matrix type
JointMatrixSUMadINTEL will stand for signed/signed Matrix type
JointMatrixUSMadINTEL will stand for unsigned/signed Matrix type
JointMatrixUUMadINTEL will stand for unsigned/unsigned Matrix type

Spec update:
intel#8175

Signed-off-by: Dmitry Sidorov dmitry.sidorov@intel.com

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@a7a1d2f
Chenyang-L pushed a commit that referenced this pull request Feb 18, 2025
[OpenCL] Add OpenCL version check for independent forward progress query
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