[llvm] [Offload][NFC] Re-enable clang-format for omptarget.h (PR #152937)
Kevin Sala Penades via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 10 15:32:52 PDT 2025
https://github.com/kevinsala updated https://github.com/llvm/llvm-project/pull/152937
>From de0ff180dd2ab88d4105ef505a66b8e191dbd943 Mon Sep 17 00:00:00 2001
From: Kevin Sala <salapenades1 at llnl.gov>
Date: Sun, 10 Aug 2025 12:28:11 -0700
Subject: [PATCH 1/2] [Offload][NFC] Re-enable clang-format for omptarget.h
---
offload/include/omptarget.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/offload/include/omptarget.h b/offload/include/omptarget.h
index 6971780c7bdb5..f1a67dbd2acf5 100644
--- a/offload/include/omptarget.h
+++ b/offload/include/omptarget.h
@@ -269,6 +269,8 @@ struct __tgt_target_non_contig {
uint64_t Stride;
};
+// clang-format on
+
#ifdef __cplusplus
extern "C" {
#endif
>From bdef621512a681810512b56e92e6994da9ed7657 Mon Sep 17 00:00:00 2001
From: Kevin Sala <salapenades1 at llnl.gov>
Date: Sun, 10 Aug 2025 15:12:41 -0700
Subject: [PATCH 2/2] Re-enable clang-format for whole file
---
offload/include/omptarget.h | 43 ++++++++++++++++---------------------
1 file changed, 19 insertions(+), 24 deletions(-)
diff --git a/offload/include/omptarget.h b/offload/include/omptarget.h
index f1a67dbd2acf5..625bbaa0db85c 100644
--- a/offload/include/omptarget.h
+++ b/offload/include/omptarget.h
@@ -33,9 +33,6 @@
#define OFFLOAD_DEVICE_DEFAULT -1
-// Don't format out enums and structs.
-// clang-format off
-
/// return flags of __tgt_target_XXX public APIs
enum __tgt_target_return_t : int {
/// successful offload executed on a target device
@@ -51,39 +48,39 @@ enum __tgt_target_return_t : int {
/// Data attributes for each data reference used in an OpenMP target region.
enum tgt_map_type {
// No flags
- OMP_TGT_MAPTYPE_NONE = 0x000,
+ OMP_TGT_MAPTYPE_NONE = 0x000,
// copy data from host to device
- OMP_TGT_MAPTYPE_TO = 0x001,
+ OMP_TGT_MAPTYPE_TO = 0x001,
// copy data from device to host
- OMP_TGT_MAPTYPE_FROM = 0x002,
+ OMP_TGT_MAPTYPE_FROM = 0x002,
// copy regardless of the reference count
- OMP_TGT_MAPTYPE_ALWAYS = 0x004,
+ OMP_TGT_MAPTYPE_ALWAYS = 0x004,
// force unmapping of data
- OMP_TGT_MAPTYPE_DELETE = 0x008,
+ OMP_TGT_MAPTYPE_DELETE = 0x008,
// map the pointer as well as the pointee
- OMP_TGT_MAPTYPE_PTR_AND_OBJ = 0x010,
+ OMP_TGT_MAPTYPE_PTR_AND_OBJ = 0x010,
// pass device base address to kernel
- OMP_TGT_MAPTYPE_TARGET_PARAM = 0x020,
+ OMP_TGT_MAPTYPE_TARGET_PARAM = 0x020,
// return base device address of mapped data
- OMP_TGT_MAPTYPE_RETURN_PARAM = 0x040,
+ OMP_TGT_MAPTYPE_RETURN_PARAM = 0x040,
// private variable - not mapped
- OMP_TGT_MAPTYPE_PRIVATE = 0x080,
+ OMP_TGT_MAPTYPE_PRIVATE = 0x080,
// copy by value - not mapped
- OMP_TGT_MAPTYPE_LITERAL = 0x100,
+ OMP_TGT_MAPTYPE_LITERAL = 0x100,
// mapping is implicit
- OMP_TGT_MAPTYPE_IMPLICIT = 0x200,
+ OMP_TGT_MAPTYPE_IMPLICIT = 0x200,
// copy data to device
- OMP_TGT_MAPTYPE_CLOSE = 0x400,
+ OMP_TGT_MAPTYPE_CLOSE = 0x400,
// runtime error if not already allocated
- OMP_TGT_MAPTYPE_PRESENT = 0x1000,
+ OMP_TGT_MAPTYPE_PRESENT = 0x1000,
// use a separate reference counter so that the data cannot be unmapped within
// the structured region
// This is an OpenMP extension for the sake of OpenACC support.
- OMP_TGT_MAPTYPE_OMPX_HOLD = 0x2000,
+ OMP_TGT_MAPTYPE_OMPX_HOLD = 0x2000,
// descriptor for non-contiguous target-update
- OMP_TGT_MAPTYPE_NON_CONTIG = 0x100000000000,
+ OMP_TGT_MAPTYPE_NON_CONTIG = 0x100000000000,
// member of struct, member given by [16 MSBs] - 1
- OMP_TGT_MAPTYPE_MEMBER_OF = 0xffff000000000000
+ OMP_TGT_MAPTYPE_MEMBER_OF = 0xffff000000000000
};
/// Flags for offload entries.
@@ -105,9 +102,9 @@ enum TargetAllocTy : int32_t {
TARGET_ALLOC_DEVICE_NON_BLOCKING,
};
-inline KernelArgsTy CTorDTorKernelArgs = {1, 0, nullptr, nullptr,
- nullptr, nullptr, nullptr, nullptr,
- 0, {0,0,0}, {1, 0, 0}, {1, 0, 0}, 0};
+inline KernelArgsTy CTorDTorKernelArgs = {
+ 1, 0, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, 0, {0, 0, 0}, {1, 0, 0}, {1, 0, 0}, 0};
struct DeviceTy;
@@ -269,8 +266,6 @@ struct __tgt_target_non_contig {
uint64_t Stride;
};
-// clang-format on
-
#ifdef __cplusplus
extern "C" {
#endif
More information about the llvm-commits
mailing list