Skip to content

Commit edb0d2c

Browse files
sagyakwacopybara-github
authored andcommitted
[Cleanup] Change namespace for TFRT sync lowering dialect to something more descriptive
PiperOrigin-RevId: 634558773
1 parent 76dfd9f commit edb0d2c

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@ tfrt_cc_library(
10721072
":tensor_shape_sync_opdefs_inc_gen",
10731073
"@llvm-project//mlir:IR",
10741074
"@llvm-project//mlir:SideEffectInterfaces",
1075+
"@llvm-project//mlir:Support",
10751076
],
10761077
)
10771078

include/tfrt/tensor/opdefs/tensor.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
using namespace mlir;
2727

2828
namespace tfrt {
29-
namespace t {
29+
namespace tfrt_tensor {
3030

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

48-
} // namespace t
49-
namespace tfrt_tensor {
50-
using TensorType = tfrt::t::TensorType;
51-
using TensorDialect = tfrt::t::TensorDialect;
5249
} // namespace tfrt_tensor
5350
} // namespace tfrt
5451

include/tfrt/tensor/opdefs/tensor.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include "mlir/IR/OpBase.td"
2727
// TFRT tensor dialect.
2828
// TODO(b/170246041): Move `TensorType` under the TFRT dialect.
2929
def Tensor_Dialect : Dialect {
30-
let name = "t";
30+
let name = "tfrt_tensor";
3131

3232
let description = [{
3333
The TFRT tensor dialect.
@@ -42,10 +42,10 @@ def Tensor_Dialect : Dialect {
4242
// Type definitions
4343
//===----------------------------------------------------------------------===//
4444
def TensorType : DialectType<Tensor_Dialect,
45-
CPred<"$_self.isa<::tfrt::tfrt_tensor::TensorType>()">, "!t.tensor type">,
45+
CPred<"$_self.isa<::tfrt::tfrt_tensor::TensorType>()">, "!tfrt_tensor.tensor type">,
4646
BuildableType<"$_builder.getType<::tfrt::tfrt_tensor::TensorType>()"> {
4747
let description = [{
48-
`!t.tensor type` represents a generic tfrt tensor.
48+
`!trft_tensor.tensor type` represents a generic tfrt tensor.
4949
}];
5050
}
5151

lib/tensor/opdefs/tensor.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@
1717
#include "tfrt/tensor/opdefs/tensor.h"
1818

1919
#include "mlir/IR/Builders.h"
20-
#include "mlir/IR/BuiltinTypes.h"
20+
#include "mlir/IR/Dialect.h"
2121
#include "mlir/IR/DialectImplementation.h"
22+
#include "mlir/IR/MLIRContext.h"
2223
#include "mlir/IR/OpImplementation.h"
2324
#include "mlir/IR/TypeUtilities.h"
25+
#include "mlir/Support/LLVM.h"
26+
#include "mlir/Support/TypeID.h"
2427

2528
namespace tfrt {
26-
namespace t {
29+
namespace tfrt_tensor {
2730

2831
//===----------------------------------------------------------------------===//
2932
// TensorShape Dialect
3033
//===----------------------------------------------------------------------===//
3134

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

63-
} // namespace t
64-
namespace tfrt_tensor {
65-
using TensorType = tfrt::t::TensorType;
66-
using TensorDialect = tfrt::t::TensorDialect;
6768
} // namespace tfrt_tensor
6869
} // namespace tfrt
6970

0 commit comments

Comments
 (0)