Skip to content

Conversation

@stumpOS
Copy link
Contributor

@stumpOS stumpOS commented Apr 28, 2025

No description provided.

@github-actions
Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/lib/Target/NVPTX/NVPTXRegCount.cpp llvm/lib/Target/NVPTX/NVPTX.h llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
View the diff from clang-format here.
diff --git a/llvm/lib/Target/NVPTX/NVPTXRegCount.cpp b/llvm/lib/Target/NVPTX/NVPTXRegCount.cpp
index 5caf934ed..6306d775b 100644
--- a/llvm/lib/Target/NVPTX/NVPTXRegCount.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXRegCount.cpp
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "NVPTXISelDAGToDAG.h"
 #include "NVPTX.h"
+#include "NVPTXISelDAGToDAG.h"
 #include "NVPTXUtilities.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/Analysis/ValueTracking.h"
@@ -31,34 +31,34 @@ using namespace llvm;
 
 namespace {
 class NVPTXRegCountPass : public MachineFunctionPass {
-    public:
-      static char ID;
-      NVPTXRegCountPass() : MachineFunctionPass(ID) {}
-    
-      bool runOnMachineFunction(MachineFunction &MF) override {
-        unsigned maxRegs = 0;
-        for (const MachineBasicBlock &MBB : MF) {
-          unsigned liveRegs = 0;
-          for (const MachineInstr &MI : MBB) {
-            // Count unique virtual and physical registers
-            for (const MachineOperand &MO : MI.operands()) {
-              if (MO.isReg() && MO.getReg())
-                liveRegs++;
-            }
-          }
-          maxRegs = std::max(maxRegs, liveRegs);
+public:
+  static char ID;
+  NVPTXRegCountPass() : MachineFunctionPass(ID) {}
+
+  bool runOnMachineFunction(MachineFunction &MF) override {
+    unsigned maxRegs = 0;
+    for (const MachineBasicBlock &MBB : MF) {
+      unsigned liveRegs = 0;
+      for (const MachineInstr &MI : MBB) {
+        // Count unique virtual and physical registers
+        for (const MachineOperand &MO : MI.operands()) {
+          if (MO.isReg() && MO.getReg())
+            liveRegs++;
         }
-        errs() << "Function " << MF.getName() << " uses maximum of " 
-               << maxRegs << " registers\n";
-        return false;
       }
-    };
+      maxRegs = std::max(maxRegs, liveRegs);
+    }
+    errs() << "Function " << MF.getName() << " uses maximum of " << maxRegs
+           << " registers\n";
+    return false;
+  }
+};
 } // namespace
 
 char NVPTXRegCountPass::ID = 0;
 // INITIALIZE_PASS(NVPTXRegCountPass, "nvptx-count-reg",
 //     "NVPTX count reg", false, false)
 
-    FunctionPass *llvm::createNVPTXRegCountPass() {
-      return new NVPTXRegCountPass();
-    }
\ No newline at end of file
+FunctionPass *llvm::createNVPTXRegCountPass() {
+  return new NVPTXRegCountPass();
+}
\ No newline at end of file
diff --git a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
index da6ef5a99..bb7d62922 100644
--- a/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXTargetMachine.cpp
@@ -239,13 +239,16 @@ void NVPTXTargetMachine::registerDefaultAliasAnalyses(AAManager &AAM) {
 struct NVPTXModulePrinter : public PassInfoMixin<NVPTXModulePrinter> {
   PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM) {
     std::error_code EC;
-    raw_fd_ostream OutFile("/home/ubuntu/modular/delete-me-test_batch_kv_cache_flash_attention_causal_mask_ragged_paged.ll", EC);
+    raw_fd_ostream OutFile("/home/ubuntu/modular/"
+                           "delete-me-test_batch_kv_cache_flash_attention_"
+                           "causal_mask_ragged_paged.ll",
+                           EC);
     if (!EC) {
       M.print(OutFile, nullptr);
     }
     return PreservedAnalyses::all();
   }
-  
+
   static bool isRequired() { return true; }
 };
 
@@ -266,7 +269,7 @@ void NVPTXTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
         FPM.addPass(NVVMIntrRangePass());
         if (EarlyByValArgsCopy)
           FPM.addPass(NVPTXCopyByValArgsPass());
-        //PM.addPass(NVPTXModulePrinter());
+        // PM.addPass(NVPTXModulePrinter());
         PM.addPass(createModuleToFunctionPassAdaptor(std::move(FPM)));
       });
 

@stumpOS stumpOS closed this Apr 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant