Skip to content

Commit

Permalink
[Cleanup] Change namespace for TFRT sync lowering dialect to somethin…
Browse files Browse the repository at this point in the history
…g more descriptive

PiperOrigin-RevId: 634558773
  • Loading branch information
sagyakwa authored and copybara-github committed May 16, 2024
1 parent 76dfd9f commit edb0d2c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,7 @@ tfrt_cc_library(
":tensor_shape_sync_opdefs_inc_gen",
"@llvm-project//mlir:IR",
"@llvm-project//mlir:SideEffectInterfaces",
"@llvm-project//mlir:Support",
],
)

Expand Down
7 changes: 2 additions & 5 deletions include/tfrt/tensor/opdefs/tensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
using namespace mlir;

namespace tfrt {
namespace t {
namespace tfrt_tensor {

// TODO (b/341154040): Pass in "tfrt_tensor" instead of "t".
class TensorDialect : public Dialect {
public:
static StringRef getDialectNamespace() { return "t"; }
Expand All @@ -45,10 +46,6 @@ class TensorType : public Type::TypeBase<TensorType, Type, TypeStorage> {
static constexpr StringLiteral name = "tfrt.t.tensor";
};

} // namespace t
namespace tfrt_tensor {
using TensorType = tfrt::t::TensorType;
using TensorDialect = tfrt::t::TensorDialect;
} // namespace tfrt_tensor
} // namespace tfrt

Expand Down
6 changes: 3 additions & 3 deletions include/tfrt/tensor/opdefs/tensor.td
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ include "mlir/IR/OpBase.td"
// TFRT tensor dialect.
// TODO(b/170246041): Move `TensorType` under the TFRT dialect.
def Tensor_Dialect : Dialect {
let name = "t";
let name = "tfrt_tensor";

let description = [{
The TFRT tensor dialect.
Expand All @@ -42,10 +42,10 @@ def Tensor_Dialect : Dialect {
// Type definitions
//===----------------------------------------------------------------------===//
def TensorType : DialectType<Tensor_Dialect,
CPred<"$_self.isa<::tfrt::tfrt_tensor::TensorType>()">, "!t.tensor type">,
CPred<"$_self.isa<::tfrt::tfrt_tensor::TensorType>()">, "!tfrt_tensor.tensor type">,
BuildableType<"$_builder.getType<::tfrt::tfrt_tensor::TensorType>()"> {
let description = [{
`!t.tensor type` represents a generic tfrt tensor.
`!trft_tensor.tensor type` represents a generic tfrt tensor.
}];
}

Expand Down
13 changes: 7 additions & 6 deletions lib/tensor/opdefs/tensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@
#include "tfrt/tensor/opdefs/tensor.h"

#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Support/TypeID.h"

namespace tfrt {
namespace t {
namespace tfrt_tensor {

//===----------------------------------------------------------------------===//
// TensorShape Dialect
//===----------------------------------------------------------------------===//

// TODO (b/341154040): Pass in "tfrt_tensor" into the Dialect constructor
// instead of "t".
TensorDialect::TensorDialect(MLIRContext *context)
: Dialect(/*name=*/"t", context, TypeID::get<TensorDialect>()) {
allowUnknownTypes();
Expand Down Expand Up @@ -60,10 +65,6 @@ void TensorDialect::printType(Type type, DialectAsmPrinter &os) const {
llvm_unreachable("unexpected 'tensor' type kind");
}

} // namespace t
namespace tfrt_tensor {
using TensorType = tfrt::t::TensorType;
using TensorDialect = tfrt::t::TensorDialect;
} // namespace tfrt_tensor
} // namespace tfrt

Expand Down

0 comments on commit edb0d2c

Please sign in to comment.