@@ -650,21 +650,20 @@ static void buildArgTys(ASTContext &Context, CXXRecordDecl *KernelObj,
650
650
CreateAndAddPrmDsc (Fld, PointerType);
651
651
652
652
FieldDecl *AccessRangeFld =
653
- getFieldDeclByName (RecordDecl, {" __impl " , " AccessRange" });
653
+ getFieldDeclByName (RecordDecl, {" impl " , " AccessRange" });
654
654
assert (AccessRangeFld &&
655
- " The accessor must contain the AccessRange from the __impl field" );
655
+ " The accessor.impl must contain the AccessRange field" );
656
656
CreateAndAddPrmDsc (AccessRangeFld, AccessRangeFld->getType ());
657
657
658
658
FieldDecl *MemRangeFld =
659
- getFieldDeclByName (RecordDecl, {" __impl " , " MemRange" });
659
+ getFieldDeclByName (RecordDecl, {" impl " , " MemRange" });
660
660
assert (MemRangeFld &&
661
- " The accessor must contain the MemRange from the __impl field" );
661
+ " The accessor.impl must contain the MemRange field" );
662
662
CreateAndAddPrmDsc (MemRangeFld, MemRangeFld->getType ());
663
663
664
664
FieldDecl *OffsetFld =
665
- getFieldDeclByName (RecordDecl, {" __impl" , " Offset" });
666
- assert (OffsetFld &&
667
- " The accessor must contain the Offset from the __impl field" );
665
+ getFieldDeclByName (RecordDecl, {" impl" , " Offset" });
666
+ assert (OffsetFld && " The accessor.impl must contain the Offset field" );
668
667
CreateAndAddPrmDsc (OffsetFld, OffsetFld->getType ());
669
668
} else if (Util::isSyclStreamType (ArgTy)) {
670
669
// the parameter is a SYCL stream object
@@ -710,37 +709,18 @@ static void populateIntHeader(SYCLIntegrationHeader &H, const StringRef Name,
710
709
uint64_t Offset = Layout.getFieldOffset (Fld->getFieldIndex ()) / 8 ;
711
710
712
711
if (Util::isSyclAccessorType (ArgTy)) {
713
- // The parameter is a SYCL accessor object - split into three
714
- // parameters, so need to generate three descriptors.
715
- // ... first descriptor (translated to pointer kernel parameter):
712
+ // The parameter is a SYCL accessor object.
713
+ // The Info field of the parameter descriptor for accessor contains
714
+ // two template parameters packed into thid integer field:
715
+ // - target (e.g. global_buffer, constant_buffer, local);
716
+ // - dimension of the accessor.
716
717
const auto *AccTy = ArgTy->getAsCXXRecordDecl ();
717
718
assert (AccTy && " accessor must be of a record type" );
718
719
const auto *AccTmplTy = cast<ClassTemplateSpecializationDecl>(AccTy);
719
- H.addParamDesc (SYCLIntegrationHeader::kind_accessor,
720
- getAccessTarget (AccTmplTy), Offset);
721
- // ... second descriptor (translated to access range kernel parameter):
722
- FieldDecl *AccessRngFld =
723
- getFieldDeclByName (AccTy, {" __impl" , " AccessRange" }, &Offset);
724
- uint64_t Sz =
725
- Ctx.getTypeSizeInChars (AccessRngFld->getType ()).getQuantity ();
726
- H.addParamDesc (SYCLIntegrationHeader::kind_std_layout,
727
- static_cast <unsigned >(Sz), static_cast <unsigned >(Offset));
728
- // ... third descriptor (translated to mem range kernel parameter):
729
- // Get offset in bytes
730
- Offset = Layout.getFieldOffset (Fld->getFieldIndex ()) / 8 ;
731
- FieldDecl *MemRngFld =
732
- getFieldDeclByName (AccTy, {" __impl" , " MemRange" }, &Offset);
733
- Sz = Ctx.getTypeSizeInChars (MemRngFld->getType ()).getQuantity ();
734
- H.addParamDesc (SYCLIntegrationHeader::kind_std_layout,
735
- static_cast <unsigned >(Sz), static_cast <unsigned >(Offset));
736
- // ... fourth descriptor (translated to id kernel parameter):
737
- // Get offset in bytes
738
- Offset = Layout.getFieldOffset (Fld->getFieldIndex ()) / 8 ;
739
- FieldDecl *OffstFld =
740
- getFieldDeclByName (AccTy, {" __impl" , " Offset" }, &Offset);
741
- Sz = Ctx.getTypeSizeInChars (OffstFld->getType ()).getQuantity ();
742
- H.addParamDesc (SYCLIntegrationHeader::kind_std_layout,
743
- static_cast <unsigned >(Sz), static_cast <unsigned >(Offset));
720
+ int Dims = static_cast <int >(
721
+ AccTmplTy->getTemplateArgs ()[1 ].getAsIntegral ().getExtValue ());
722
+ int Info = getAccessTarget (AccTmplTy) | (Dims << 11 );
723
+ H.addParamDesc (SYCLIntegrationHeader::kind_accessor, Info, Offset);
744
724
} else if (Util::isSyclStreamType (ArgTy)) {
745
725
// the parameter is a SYCL stream object
746
726
llvm_unreachable (" streams not supported yet" );
0 commit comments