[Mlir-commits] [mlir] [mlir][nvvm] Fix circular dependency in (PR #68934)

Guray Ozen llvmlistbot at llvm.org
Thu Oct 12 14:59:21 PDT 2023


https://github.com/grypp created https://github.com/llvm/llvm-project/pull/68934

BasicPtxBuilder includes NVVMDialect and vice versa. Cmake appereantly forgives that, but this causes bazel build fails. This PR aims to fix that

>From 8cdc9ada1cd659888f96a7af4971fb1761b1cf8e Mon Sep 17 00:00:00 2001
From: Guray Ozen <guray.ozen at gmail.com>
Date: Thu, 12 Oct 2023 23:57:31 +0200
Subject: [PATCH] [mlir][nvvm] Fix circular dependency in

BasicPtxBuilder includes NVVMDialect and vice versa. Cmake appereantly forgives that, but this causes bazel build fails. This PR aims to fix that
---
 mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
index eeedccf3ba3fcbc..121504fc20c018f 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/BasicPtxBuilderInterface.cpp
@@ -12,7 +12,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "mlir/Dialect/LLVMIR/BasicPtxBuilderInterface.h"
-#include "mlir/Dialect/LLVMIR/NVVMDialect.h"
 #include "mlir/Support/LogicalResult.h"
 
 #define DEBUG_TYPE "ptx-builder"
@@ -28,6 +27,8 @@
 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 +44,7 @@ static char getRegisterType(Type type) {
     return 'd';
   if (auto ptr = type.dyn_cast<LLVM::LLVMPointerType>()) {
     // Shared address spaces is addressed with 32-bit pointers.
-    if (ptr.getAddressSpace() == NVVM::kSharedMemorySpace) {
+    if (ptr.getAddressSpace() == kSharedMemorySpace) {
       return 'r';
     }
     return 'l';



More information about the Mlir-commits mailing list