Skip to content

Commit a248351

Browse files
committed
More formatting and some bug fixing
1 parent 4a41f85 commit a248351

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5053,6 +5053,7 @@ class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
50535053
}
50545054

50555055
bool leaveStruct(const CXXRecordDecl *, ParmVarDecl *, QualType) final {
5056+
Header.setParentStruct(nullptr);
50565057
return true;
50575058
}
50585059

@@ -7276,8 +7277,7 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
72767277
for (ParmVarDecl *Param : K.SyclKernel->parameters()) {
72777278
if (!Param->getType()->isStructureType())
72787279
continue;
7279-
const RecordDecl *Struct =
7280-
Param->getType()->getAsRecordDecl();
7280+
const RecordDecl *Struct = Param->getType()->getAsRecordDecl();
72817281
QualType type = Param->getType();
72827282
if (!S.getStructsWithSpecialType().count(Struct) ||
72837283
visitedStructWithSpecialType.count(Struct))
@@ -7408,8 +7408,16 @@ void SYCLIntegrationHeader::addParamDesc(kernel_param_kind_t Kind, int Info,
74087408
PD.Kind = Kind;
74097409
PD.Info = Info;
74107410
PD.Offset = Offset;
7411-
OffsetSizeInfo[ParentStruct].emplace_back(std::make_pair(Offset, Info));
7412-
KindInfo[ParentStruct].emplace_back(Kind);
7411+
// If we are adding a free function kernel parameter that is a struct that
7412+
// contains a special type, a little more work needs to be done in order to
7413+
// help the runtime set the kernel arguments properly. Add the offset, size,
7414+
// and Kind information to the integration header for each field inside this
7415+
// struct. Also, verify that we are actually adding a field and not the struct
7416+
// itself by checking the Kind.
7417+
if (ParentStruct && Kind != kernel_param_kind_t::kind_struct_with_special_type) {
7418+
OffsetSizeInfo[ParentStruct].emplace_back(std::make_pair(Offset, Info));
7419+
KindInfo[ParentStruct].emplace_back(Kind);
7420+
}
74137421
}
74147422

74157423
void SYCLIntegrationHeader::setParentStruct(ParmVarDecl *parent) {

sycl/include/sycl/handler.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,6 +3750,7 @@ class __SYCL_EXPORT handler {
37503750
queue getQueue();
37513751

37523752
void incrementArgShift(int Shift);
3753+
37533754
protected:
37543755
/// Registers event dependencies in this command group.
37553756
void depends_on(const detail::EventImplPtr &Event);

sycl/source/detail/handler_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class handler_impl {
6363

6464
KernelNameStrRefT getKernelName() const {
6565
return MKernelData.getKernelName();
66-
}
66+
}
6767

6868
/// Registers mutually exclusive submission states.
6969
HandlerSubmissionState MSubmissionState = HandlerSubmissionState::NO_STATE;

sycl/source/detail/kernel_data.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ void KernelData::processArg(void *Ptr, const detail::kernel_param_kind_t &Kind,
282282
}
283283
}
284284

285+
285286
void KernelData::extractArgsAndReqs(bool IsKernelCreatedFromSource) {
286287
std::vector<detail::ArgDesc> UnPreparedArgs = std::move(MArgs);
287288
clearArgs();

0 commit comments

Comments
 (0)