Skip to content

Conversation

@lbushi25
Copy link
Contributor

@lbushi25 lbushi25 commented May 28, 2025

Add support for structs containing special types as free function kernel parameters.

@lbushi25 lbushi25 changed the title [SYCL] Struct contains special types [SYCL] Add support for structs containing special types as free function kernel parameters May 28, 2025
@lbushi25 lbushi25 requested review from a team and bader as code owners December 5, 2025 18:58
@lbushi25 lbushi25 requested a review from mmichel11 December 5, 2025 18:58
// TODO
unsupportedFreeFunctionParamType();
bool enterStruct(const CXXRecordDecl *, ParmVarDecl *,
QualType ParamTy) final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
QualType ParamTy) final {
QualType) final {

Since it is not used.

Comment on lines +2604 to +2605
bool leaveStruct(const CXXRecordDecl *, ParmVarDecl *PD,
QualType ParamTy) final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool leaveStruct(const CXXRecordDecl *, ParmVarDecl *PD,
QualType ParamTy) final {
bool leaveStruct(const CXXRecordDecl *, ParmVarDecl *,
QualType) final {

bool handleScalarType(ParmVarDecl *, QualType) final {
// TODO
unsupportedFreeFunctionParamType();
bool handleScalarType(ParmVarDecl *PD, QualType ParamTy) final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool handleScalarType(ParmVarDecl *PD, QualType ParamTy) final {
bool handleScalarType(ParmVarDecl *, QualType) final {

Comment on lines +2697 to +2698
bool handleNonDecompStruct(const CXXRecordDecl *, ParmVarDecl *PD,
QualType ParamTy) final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool handleNonDecompStruct(const CXXRecordDecl *, ParmVarDecl *PD,
QualType ParamTy) final {
bool handleNonDecompStruct(const CXXRecordDecl *, ParmVarDecl *,
QualType) final {

bool enterStruct(const CXXRecordDecl *, ParmVarDecl *, QualType) final {
// TODO
// ++StructDepth;
bool enterStruct(const CXXRecordDecl *, ParmVarDecl *PD, QualType Ty) final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool enterStruct(const CXXRecordDecl *, ParmVarDecl *PD, QualType Ty) final {
bool enterStruct(const CXXRecordDecl *, ParmVarDecl *, QualType Ty) final {

bool leaveStruct(const CXXRecordDecl *, FieldDecl *, QualType) final {
// TODO
unsupportedFreeFunctionParamType();
bool leaveStruct(const CXXRecordDecl *, FieldDecl *FD, QualType Ty) final {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool leaveStruct(const CXXRecordDecl *, FieldDecl *FD, QualType Ty) final {
bool leaveStruct(const CXXRecordDecl *, FieldDecl *, QualType) final {

assert(CurrentStructs.size() &&
"Current free function parameter is not inside a structure!");
return CurrentStructs.back();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function used anywhere?


FwdDeclEmitter.Visit(type.getDesugaredType(S.getASTContext()));

// this is a struct that contains a special type so its neither a
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// this is a struct that contains a special type so its neither a
// This is a struct that contains a special type so it's neither a

// CHECK-NEXT: { kernel_param_kind_t::kind_pointer, 8, 0 },
// CHECK-NEXT: { kernel_param_kind_t::kind_std_layout, 4, 8 },
// CHECK-NEXT: { kernel_param_kind_t::kind_std_layout, 4, 12 },
// CHECK-NEXT: { kernel_param_kind_t::kind_std_layout, 4, 0 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please explain the changes to the offsets (i.e. previous value to 0) in this test?

@lbushi25
Copy link
Contributor Author

lbushi25 commented Dec 5, 2025

I seem to have added a lot of unneeded reviewers due to a dirty local repository. Please ignore this PR, only @intel/dpcpp-cfe-reviewers are relevant here.

Co-authored-by: premanandrao <premanand.m.rao@intel.com>
@lbushi25
Copy link
Contributor Author

lbushi25 commented Dec 5, 2025

@premanandrao please head over to #20844 as I'm closing this as the commit history has been completely messed up. I will address your review there instead.

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.