[Mlir-commits] [mlir] 208f42f - [mlir][NVVM] Add constant memory space identifier (#111141)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Oct 4 06:13:37 PDT 2024


Author: Matthias Springer
Date: 2024-10-04T15:13:34+02:00
New Revision: 208f42fd9bb59c007b0d6abe7eaf8c4e829740ea

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

LOG: [mlir][NVVM] Add constant memory space identifier (#111141)

Also use these enums in `BasicPtxBuilderInferface.cpp`.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h
    mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h b/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h
index 08019e77ae6af8..4fd00ff929bd70 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/NVVMDialect.h
@@ -35,7 +35,9 @@ enum NVVMMemorySpace {
   /// Global memory space identifier.
   kGlobalMemorySpace = 1,
   /// Shared memory space identifier.
-  kSharedMemorySpace = 3
+  kSharedMemorySpace = 3,
+  /// Constant memory space identifier.
+  kConstantMemorySpace = 4
 };
 
 /// Return the element type and number of elements associated with a wmma matrix

diff  --git a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
index b109f00c3da13a..d181700f757a5b 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
@@ -12,6 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h"
+#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
 
 #define DEBUG_TYPE "ptx-builder"
 #define DBGS() (llvm::dbgs() << "[" DEBUG_TYPE "]: ")
@@ -26,8 +27,6 @@
 using namespace mlir;
 using namespace NVVM;
 
-static constexpr int64_t kSharedMemorySpace = 3;
-
 static char getRegisterType(Type type) {
   if (type.isInteger(1))
     return 'b';
@@ -43,7 +42,7 @@ static char getRegisterType(Type type) {
     return 'd';
   if (auto ptr = dyn_cast<LLVM::LLVMPointerType>(type)) {
     // Shared address spaces is addressed with 32-bit pointers.
-    if (ptr.getAddressSpace() == kSharedMemorySpace) {
+    if (ptr.getAddressSpace() == NVVMMemorySpace::kSharedMemorySpace) {
       return 'r';
     }
     return 'l';


        


More information about the Mlir-commits mailing list