[Openmp-commits] [openmp] e4f4022 - [Libomptarget][NFC] Fix linting warnings in the plugins

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 20 08:07:41 PST 2023


Author: Joseph Huber
Date: 2023-12-20T10:07:34-06:00
New Revision: e4f4022b7044b135a950a5fdc033af13fee9f6fa

URL: https://github.com/llvm/llvm-project/commit/e4f4022b7044b135a950a5fdc033af13fee9f6fa
DIFF: https://github.com/llvm/llvm-project/commit/e4f4022b7044b135a950a5fdc033af13fee9f6fa.diff

LOG: [Libomptarget][NFC] Fix linting warnings in the plugins

Summary:
Fix some linting warnings present in the plugins.

Added: 
    

Modified: 
    openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
    openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
    openmp/libomptarget/plugins-nextgen/common/include/JIT.h
    openmp/libomptarget/plugins-nextgen/common/src/Utils/ELF.cpp
    openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
index 598239d942362a..fe435a3f558557 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp
@@ -1246,7 +1246,7 @@ struct AMDGPUStreamTy {
     AMDGPUSignalTy *OutputSignals[2] = {};
     if (auto Err = SignalManager.getResources(/*Num=*/2, OutputSignals))
       return Err;
-    for (auto Signal : OutputSignals) {
+    for (auto *Signal : OutputSignals) {
       Signal->reset();
       Signal->increaseUseCount();
     }
@@ -1312,7 +1312,7 @@ struct AMDGPUStreamTy {
     AMDGPUSignalTy *OutputSignals[2] = {};
     if (auto Err = SignalManager.getResources(/*Num=*/2, OutputSignals))
       return Err;
-    for (auto Signal : OutputSignals) {
+    for (auto *Signal : OutputSignals) {
       Signal->reset();
       Signal->increaseUseCount();
     }

diff  --git a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
index 2d447c81a22ab1..1cb99c0a5dca39 100644
--- a/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
+++ b/openmp/libomptarget/plugins-nextgen/amdgpu/utils/UtilitiesRTL.h
@@ -53,7 +53,7 @@ struct AMDGPUImplicitArgsTyCOV4 {
   uint8_t Unused[56];
 };
 
-uint32_t getImplicitArgsSize(uint16_t Version) {
+inline uint32_t getImplicitArgsSize(uint16_t Version) {
   return Version < ELF::ELFABIVERSION_AMDGPU_HSA_V5
              ? sizeof(AMDGPUImplicitArgsTyCOV4)
              : sizeof(AMDGPUImplicitArgsTy);
@@ -173,44 +173,44 @@ class KernelInfoReader {
     if (!V.first.isString())
       return Error::success();
 
-    const auto isKey = [](const msgpack::DocNode &DK, StringRef SK) {
+    const auto IsKey = [](const msgpack::DocNode &DK, StringRef SK) {
       return DK.getString() == SK;
     };
 
-    const auto getSequenceOfThreeInts = [](msgpack::DocNode &DN,
+    const auto GetSequenceOfThreeInts = [](msgpack::DocNode &DN,
                                            uint32_t *Vals) {
       assert(DN.isArray() && "MsgPack DocNode is an array node");
       auto DNA = DN.getArray();
       assert(DNA.size() == 3 && "ArrayNode has at most three elements");
 
-      int i = 0;
+      int I = 0;
       for (auto DNABegin = DNA.begin(), DNAEnd = DNA.end(); DNABegin != DNAEnd;
            ++DNABegin) {
-        Vals[i++] = DNABegin->getUInt();
+        Vals[I++] = DNABegin->getUInt();
       }
     };
 
-    if (isKey(V.first, ".name")) {
+    if (IsKey(V.first, ".name")) {
       KernelName = V.second.toString();
-    } else if (isKey(V.first, ".sgpr_count")) {
+    } else if (IsKey(V.first, ".sgpr_count")) {
       KernelData.SGPRCount = V.second.getUInt();
-    } else if (isKey(V.first, ".sgpr_spill_count")) {
+    } else if (IsKey(V.first, ".sgpr_spill_count")) {
       KernelData.SGPRSpillCount = V.second.getUInt();
-    } else if (isKey(V.first, ".vgpr_count")) {
+    } else if (IsKey(V.first, ".vgpr_count")) {
       KernelData.VGPRCount = V.second.getUInt();
-    } else if (isKey(V.first, ".vgpr_spill_count")) {
+    } else if (IsKey(V.first, ".vgpr_spill_count")) {
       KernelData.VGPRSpillCount = V.second.getUInt();
-    } else if (isKey(V.first, ".private_segment_fixed_size")) {
+    } else if (IsKey(V.first, ".private_segment_fixed_size")) {
       KernelData.PrivateSegmentSize = V.second.getUInt();
-    } else if (isKey(V.first, ".group_segement_fixed_size")) {
+    } else if (IsKey(V.first, ".group_segement_fixed_size")) {
       KernelData.GroupSegmentList = V.second.getUInt();
-    } else if (isKey(V.first, ".reqd_workgroup_size")) {
-      getSequenceOfThreeInts(V.second, KernelData.RequestedWorkgroupSize);
-    } else if (isKey(V.first, ".workgroup_size_hint")) {
-      getSequenceOfThreeInts(V.second, KernelData.WorkgroupSizeHint);
-    } else if (isKey(V.first, ".wavefront_size")) {
+    } else if (IsKey(V.first, ".reqd_workgroup_size")) {
+      GetSequenceOfThreeInts(V.second, KernelData.RequestedWorkgroupSize);
+    } else if (IsKey(V.first, ".workgroup_size_hint")) {
+      GetSequenceOfThreeInts(V.second, KernelData.WorkgroupSizeHint);
+    } else if (IsKey(V.first, ".wavefront_size")) {
       KernelData.WavefronSize = V.second.getUInt();
-    } else if (isKey(V.first, ".max_flat_workgroup_size")) {
+    } else if (IsKey(V.first, ".max_flat_workgroup_size")) {
       KernelData.MaxFlatWorkgroupSize = V.second.getUInt();
     }
 
@@ -273,9 +273,10 @@ class KernelInfoReader {
 
 /// Reads the AMDGPU specific metadata from the ELF file and propagates the
 /// KernelInfoMap
-Error readAMDGPUMetaDataFromImage(MemoryBufferRef MemBuffer,
-                                  StringMap<KernelMetaDataTy> &KernelInfoMap,
-                                  uint16_t &ELFABIVersion) {
+inline Error
+readAMDGPUMetaDataFromImage(MemoryBufferRef MemBuffer,
+                            StringMap<KernelMetaDataTy> &KernelInfoMap,
+                            uint16_t &ELFABIVersion) {
   Error Err = Error::success(); // Used later as out-parameter
 
   auto ELFOrError = object::ELF64LEFile::create(MemBuffer.getBuffer());

diff  --git a/openmp/libomptarget/plugins-nextgen/common/include/JIT.h b/openmp/libomptarget/plugins-nextgen/common/include/JIT.h
index 7252519a8c2eb3..3ec4424f856a00 100644
--- a/openmp/libomptarget/plugins-nextgen/common/include/JIT.h
+++ b/openmp/libomptarget/plugins-nextgen/common/include/JIT.h
@@ -25,7 +25,6 @@
 
 #include <functional>
 #include <memory>
-#include <shared_mutex>
 #include <string>
 
 struct __tgt_device_image;

diff  --git a/openmp/libomptarget/plugins-nextgen/common/src/Utils/ELF.cpp b/openmp/libomptarget/plugins-nextgen/common/src/Utils/ELF.cpp
index 85976ee3e017ff..bdac6c1db5d23a 100644
--- a/openmp/libomptarget/plugins-nextgen/common/src/Utils/ELF.cpp
+++ b/openmp/libomptarget/plugins-nextgen/common/src/Utils/ELF.cpp
@@ -12,9 +12,6 @@
 
 #include "Utils/ELF.h"
 
-#include "Shared/APITypes.h"
-#include "Shared/Debug.h"
-
 #include "llvm/BinaryFormat/Magic.h"
 #include "llvm/Object/Binary.h"
 #include "llvm/Object/ELFObjectFile.h"

diff  --git a/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
index 9f59f1e6107097..0c7535a0da8b92 100644
--- a/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
+++ b/openmp/libomptarget/plugins-nextgen/cuda/src/rtl.cpp
@@ -728,7 +728,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
 
     // If there is already pending work on the stream it could be waiting for
     // someone to check the RPC server.
-    if (auto RPCServer = getRPCServer()) {
+    if (auto *RPCServer = getRPCServer()) {
       CUresult Res = cuStreamQuery(Stream);
       while (Res == CUDA_ERROR_NOT_READY) {
         if (auto Err = RPCServer->runServer(*this))
@@ -1088,7 +1088,7 @@ struct CUDADeviceTy : public GenericDeviceTy {
     }
 
     // Sort the created array to be in priority order.
-    llvm::sort(Funcs, [=](auto x, auto y) { return x.second < y.second; });
+    llvm::sort(Funcs, [=](auto X, auto Y) { return X.second < Y.second; });
 
     // Allocate a buffer to store all of the known constructor / destructor
     // functions in so we can iterate them on the device.


        


More information about the Openmp-commits mailing list