[llvm] [WIP][Offload] Introduce ATTACH map-type support for pointer attachment. (PR #149036)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 01:42:46 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- offload/include/OpenMP/Mapping.h offload/include/omptarget.h offload/libomptarget/interface.cpp offload/libomptarget/omptarget.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/offload/libomptarget/interface.cpp b/offload/libomptarget/interface.cpp
index 16e46e6d2..b6b4cb1ef 100644
--- a/offload/libomptarget/interface.cpp
+++ b/offload/libomptarget/interface.cpp
@@ -173,8 +173,8 @@ targetData(ident_t *Loc, int64_t DeviceId, int32_t ArgNum, void **ArgsBase,
}
Rc = TargetDataFunction(Loc, *DeviceOrErr, ArgNum, ArgsBase, Args, ArgSizes,
- ArgTypes, ArgNames, ArgMappers, AsyncInfo,
- AttachInfo, false /*FromMapper=*/);
+ ArgTypes, ArgNames, ArgMappers, AsyncInfo, AttachInfo,
+ false /*FromMapper=*/);
if (Rc == OFFLOAD_SUCCESS) {
// Process deferred ATTACH entries BEFORE synchronization
diff --git a/offload/libomptarget/omptarget.cpp b/offload/libomptarget/omptarget.cpp
index aa142814e..b5bbc5a40 100644
--- a/offload/libomptarget/omptarget.cpp
+++ b/offload/libomptarget/omptarget.cpp
@@ -496,9 +496,8 @@ static int performPointerAttachment(DeviceTy &Device, AsyncInfoTy &AsyncInfo,
// Device.submitData(..., /*InOrder=*/IsFirstAttachEntry)
// Where the boolean InOrder being true means that this submission should
// wait for prior memory submissions to finish.
- int SubmitResult =
- Device.submitData(TgtPtrAddr, DataBuffer, HstPtrSize, AsyncInfo,
- PtrTPR.getEntry());
+ int SubmitResult = Device.submitData(TgtPtrAddr, DataBuffer, HstPtrSize,
+ AsyncInfo, PtrTPR.getEntry());
AsyncInfo.addPostProcessingFunction([DataBuffer]() -> int {
delete[] DataBuffer;
@@ -678,10 +677,10 @@ int targetDataBegin(ident_t *Loc, DeviceTy &Device, int32_t ArgNum,
}
if (ArgTypes[I] & OMP_TGT_MAPTYPE_PTR_AND_OBJ && !IsHostPtr) {
- int Ret = performPointerAttachment(Device, AsyncInfo,
- (void **)PointerHstPtrBegin, HstPtrBase, HstPtrBegin,
- (void **)PointerTgtPtrBegin, TgtPtrBegin,
- sizeof(void *), PointerTpr);
+ int Ret = performPointerAttachment(
+ Device, AsyncInfo, (void **)PointerHstPtrBegin, HstPtrBase,
+ HstPtrBegin, (void **)PointerTgtPtrBegin, TgtPtrBegin, sizeof(void *),
+ PointerTpr);
if (Ret != OFFLOAD_SUCCESS)
return OFFLOAD_FAIL;
}
@@ -783,8 +782,9 @@ int processAttachEntries(DeviceTy &Device, AttachInfoTy &AttachInfo,
IsAttachAlways ? "yes" : "no");
// Lambda to perform target pointer lookup and validation
- auto LookupTargetPointer = [&](void *Ptr, int64_t Size, const char *PtrType)
- -> std::optional<TargetPointerResultTy> {
+ auto LookupTargetPointer =
+ [&](void *Ptr, int64_t Size,
+ const char *PtrType) -> std::optional<TargetPointerResultTy> {
// ATTACH map-type does not change ref-count, or do any allocation
// We just need to do a lookup for the pointer/pointee.
TargetPointerResultTy TPR = Device.getMappingInfo().getTgtPtrBegin(
``````````
</details>
https://github.com/llvm/llvm-project/pull/149036
More information about the llvm-commits
mailing list