[Openmp-commits] [openmp] 5244617 - [OpenMP][NFC] Delete dead code
Johannes Doerfert via Openmp-commits
openmp-commits at lists.llvm.org
Mon Mar 27 21:30:49 PDT 2023
Author: Johannes Doerfert
Date: 2023-03-27T21:30:23-07:00
New Revision: 5244617e3a03376565afed14713eda4e87e725af
URL: https://github.com/llvm/llvm-project/commit/5244617e3a03376565afed14713eda4e87e725af
DIFF: https://github.com/llvm/llvm-project/commit/5244617e3a03376565afed14713eda4e87e725af.diff
LOG: [OpenMP][NFC] Delete dead code
This code may have served a purpose at some point but it has been dead
for a long while. `FromMapperBase` was always `nullptr` which is `false`
which makes the rest of the code dead. Since this has not
affected tests, I delete it for now.
Added:
Modified:
openmp/libomptarget/src/omptarget.cpp
Removed:
################################################################################
diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp
index 69af6ac24a41d..9df1d3637fde2 100644
--- a/openmp/libomptarget/src/omptarget.cpp
+++ b/openmp/libomptarget/src/omptarget.cpp
@@ -751,16 +751,13 @@ struct PostProcessingInfo {
/// The mapping type (bitfield).
int64_t ArgType;
- /// Index of the argument in the data mapping scheme.
- int32_t ArgIndex;
-
/// The target pointer information.
TargetPointerResultTy TPR;
PostProcessingInfo(void *HstPtr, int64_t Size, int64_t ArgType,
- int32_t ArgIndex, TargetPointerResultTy &&TPR)
+ TargetPointerResultTy &&TPR)
: HstPtrBegin(HstPtr), DataSize(Size), ArgType(ArgType),
- ArgIndex(ArgIndex), TPR(std::move(TPR)) {}
+ TPR(std::move(TPR)) {}
};
} // namespace
@@ -772,12 +769,10 @@ struct PostProcessingInfo {
/// according to the successfulness of the operations.
[[nodiscard]] static int
postProcessingTargetDataEnd(DeviceTy *Device,
- SmallVector<PostProcessingInfo> &EntriesInfo,
- bool FromMapper) {
+ SmallVector<PostProcessingInfo> &EntriesInfo) {
int Ret = OFFLOAD_SUCCESS;
- void *FromMapperBase = nullptr;
- for (auto &[HstPtrBegin, DataSize, ArgType, ArgIndex, TPR] : EntriesInfo) {
+ for (auto &[HstPtrBegin, DataSize, ArgType, TPR] : EntriesInfo) {
bool DelEntry = !TPR.isHostPointer();
// If the last element from the mapper (for end transfer args comes in
@@ -788,11 +783,6 @@ postProcessingTargetDataEnd(DeviceTy *Device,
DelEntry = false; // protect parent struct from being deallocated
}
- if (DelEntry && FromMapper && ArgIndex == 0) {
- DelEntry = false;
- FromMapperBase = HstPtrBegin;
- }
-
// If we marked the entry to be deleted we need to verify no other
// thread reused it by now. If deletion is still supposed to happen by
// this thread LR will be set and exclusive access to the HDTT map
@@ -836,7 +826,7 @@ postProcessingTargetDataEnd(DeviceTy *Device,
// TPR), or erase TPR.
TPR.setEntry(nullptr);
- if (!DelEntry || (FromMapperBase && FromMapperBase == HstPtrBegin))
+ if (!DelEntry)
continue;
Ret = Device->eraseMapEntry(HDTTMap, Entry, DataSize);
@@ -860,7 +850,6 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
void **ArgMappers, AsyncInfoTy &AsyncInfo, bool FromMapper) {
int Ret = OFFLOAD_SUCCESS;
auto *PostProcessingPtrs = new SmallVector<PostProcessingInfo>();
- void *FromMapperBase = nullptr;
// process each input.
for (int32_t I = ArgNum - 1; I >= 0; --I) {
// 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,
}
// Add pointer to the buffer for post-synchronize processing.
- PostProcessingPtrs->emplace_back(HstPtrBegin, DataSize, ArgTypes[I], I,
+ PostProcessingPtrs->emplace_back(HstPtrBegin, DataSize, ArgTypes[I],
std::move(TPR));
PostProcessingPtrs->back().TPR.getEntry()->unlock();
}
@@ -1007,8 +996,7 @@ int targetDataEnd(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
// TODO: We might want to remove `mutable` in the future by not changing the
// captured variables somehow.
AsyncInfo.addPostProcessingFunction([=, Device = &Device]() mutable -> int {
- return postProcessingTargetDataEnd(Device, *PostProcessingPtrs,
- FromMapperBase);
+ return postProcessingTargetDataEnd(Device, *PostProcessingPtrs);
});
return Ret;
More information about the Openmp-commits
mailing list