Skip to content

Commit adb0a54

Browse files
Review fixes
1 parent f41a03f commit adb0a54

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,8 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
17741774
ArgTy = CAT->getElementType();
17751775
Size = SemaRef.getASTContext().getTypeSizeInChars(ArgTy).getQuantity();
17761776
Header.addParamDesc(Kind, static_cast<unsigned>(Size),
1777-
static_cast<unsigned>(CurOffset), 1);
1777+
static_cast<unsigned>(CurOffset),
1778+
/*NumOpenCLParams=*/1);
17781779
}
17791780

17801781
public:
@@ -1785,14 +1786,11 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
17851786
Header.startKernel(Name, NameType, StableName, KernelObj->getLocation());
17861787
}
17871788

1788-
unsigned getNumOpenCLParams(const CXXRecordDecl *SamplerOrAccessorTy) {
1789-
assert(SamplerOrAccessorTy &&
1790-
"Sampler/Accessor type must be a C++ record type");
1791-
CXXMethodDecl *InitMethod =
1792-
getMethodByName(SamplerOrAccessorTy, InitMethodName);
1793-
assert(InitMethod && "sampler/accessor must have __init method");
1794-
unsigned NumOpenCLParams;
1795-
return NumOpenCLParams = InitMethod->param_size();
1789+
unsigned getNumOpenCLParams(const CXXRecordDecl *AccessorTy) {
1790+
assert(AccessorTy && "Accessor type must be a C++ record type");
1791+
CXXMethodDecl *InitMethod = getMethodByName(AccessorTy, InitMethodName);
1792+
assert(InitMethod && "accessor must have __init method");
1793+
return InitMethod->param_size();
17961794
}
17971795

17981796
bool handleSyclAccessorType(const CXXBaseSpecifier &BC,
@@ -2726,14 +2724,11 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
27262724
O << " { kernel_param_kind_t::" << TyStr << ", ";
27272725
O << P.Info << ", " << P.Offset << ", ";
27282726
O << "param_omit_table[" << CurIndex << "]";
2727+
++CurIndex;
27292728
for (unsigned X = 1; X < P.NumOpenCLParams; X++) {
2729+
O << " | (param_omit_table[" << CurIndex << "] << " << X << ")";
27302730
++CurIndex;
2731-
if (X < P.NumOpenCLParams)
2732-
O << " | ";
2733-
O << "(param_omit_table[" << CurIndex << "]"
2734-
<< " << " << X << ")";
27352731
}
2736-
++CurIndex;
27372732
O << "}";
27382733
O << ",\n";
27392734
}

sycl/include/CL/sycl/detail/kernel_desc.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct kernel_param_desc_t {
4343
// object
4444
int offset;
4545
// bitfield to mark kernel parameters that will be omitted
46-
unsigned char kernel_param_omitted : 1;
46+
unsigned char kernel_param_omitted;
4747
};
4848

4949
// Translates specialization constant type to its name.

0 commit comments

Comments
 (0)