@@ -751,16 +751,13 @@ struct PostProcessingInfo {
751
751
// / The mapping type (bitfield).
752
752
int64_t ArgType;
753
753
754
- // / Index of the argument in the data mapping scheme.
755
- int32_t ArgIndex;
756
-
757
754
// / The target pointer information.
758
755
TargetPointerResultTy TPR;
759
756
760
757
PostProcessingInfo (void *HstPtr, int64_t Size, int64_t ArgType,
761
- int32_t ArgIndex, TargetPointerResultTy &&TPR)
758
+ TargetPointerResultTy &&TPR)
762
759
: HstPtrBegin(HstPtr), DataSize(Size), ArgType(ArgType),
763
- ArgIndex (ArgIndex), TPR(std::move(TPR)) {}
760
+ TPR (std::move(TPR)) {}
764
761
};
765
762
766
763
} // namespace
@@ -772,12 +769,10 @@ struct PostProcessingInfo {
772
769
// / according to the successfulness of the operations.
773
770
[[nodiscard]] static int
774
771
postProcessingTargetDataEnd (DeviceTy *Device,
775
- SmallVector<PostProcessingInfo> &EntriesInfo,
776
- bool FromMapper) {
772
+ SmallVector<PostProcessingInfo> &EntriesInfo) {
777
773
int Ret = OFFLOAD_SUCCESS;
778
- void *FromMapperBase = nullptr ;
779
774
780
- for (auto &[HstPtrBegin, DataSize, ArgType, ArgIndex, TPR] : EntriesInfo) {
775
+ for (auto &[HstPtrBegin, DataSize, ArgType, TPR] : EntriesInfo) {
781
776
bool DelEntry = !TPR.isHostPointer ();
782
777
783
778
// If the last element from the mapper (for end transfer args comes in
@@ -788,11 +783,6 @@ postProcessingTargetDataEnd(DeviceTy *Device,
788
783
DelEntry = false ; // protect parent struct from being deallocated
789
784
}
790
785
791
- if (DelEntry && FromMapper && ArgIndex == 0 ) {
792
- DelEntry = false ;
793
- FromMapperBase = HstPtrBegin;
794
- }
795
-
796
786
// If we marked the entry to be deleted we need to verify no other
797
787
// thread reused it by now. If deletion is still supposed to happen by
798
788
// this thread LR will be set and exclusive access to the HDTT map
@@ -836,7 +826,7 @@ postProcessingTargetDataEnd(DeviceTy *Device,
836
826
// TPR), or erase TPR.
837
827
TPR.setEntry (nullptr );
838
828
839
- if (!DelEntry || (FromMapperBase && FromMapperBase == HstPtrBegin) )
829
+ if (!DelEntry)
840
830
continue ;
841
831
842
832
Ret = Device->eraseMapEntry (HDTTMap, Entry, DataSize);
@@ -860,7 +850,6 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
860
850
void **ArgMappers, AsyncInfoTy &AsyncInfo, bool FromMapper) {
861
851
int Ret = OFFLOAD_SUCCESS;
862
852
auto *PostProcessingPtrs = new SmallVector<PostProcessingInfo>();
863
- void *FromMapperBase = nullptr ;
864
853
// process each input.
865
854
for (int32_t I = ArgNum - 1 ; I >= 0 ; --I) {
866
855
// Ignore private variables and arrays - there is no mapping for them.
@@ -998,7 +987,7 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
998
987
}
999
988
1000
989
// Add pointer to the buffer for post-synchronize processing.
1001
- PostProcessingPtrs->emplace_back (HstPtrBegin, DataSize, ArgTypes[I], I,
990
+ PostProcessingPtrs->emplace_back (HstPtrBegin, DataSize, ArgTypes[I],
1002
991
std::move (TPR));
1003
992
PostProcessingPtrs->back ().TPR .getEntry ()->unlock ();
1004
993
}
@@ -1007,8 +996,7 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
1007
996
// TODO: We might want to remove `mutable` in the future by not changing the
1008
997
// captured variables somehow.
1009
998
AsyncInfo.addPostProcessingFunction ([=, Device = &Device]() mutable -> int {
1010
- return postProcessingTargetDataEnd (Device, *PostProcessingPtrs,
1011
- FromMapperBase);
999
+ return postProcessingTargetDataEnd (Device, *PostProcessingPtrs);
1012
1000
});
1013
1001
1014
1002
return Ret;
0 commit comments