Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick: Allow creation of TCP groups where an op has multiple uses #76

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ccaa542
Apply Cruise Internal Patches (#1)
sjain-stanford Oct 27, 2023
7547c93
Conversion for `aten.index.Tensor_hacked_twin` -> `tcp.custom_op` (#3)
sjain-stanford Oct 31, 2023
04b9d8c
Merge remote-tracking branch 'upstream/main' into cruise_main
sjain-stanford Nov 3, 2023
b2811d4
Merge remote-tracking branch 'upstream/main' into cruise_main
sjain-stanford Nov 3, 2023
aba958a
remove parts that are now upstreamed
sjain-stanford Nov 3, 2023
b0add85
Merge remote-tracking branch 'upstream/main' into cruise_main
sjain-stanford Nov 5, 2023
fc9d25c
Merge remote-tracking branch 'upstream/main' into cruise_main
sjain-stanford Nov 6, 2023
80bba2e
Merge branch 'upstream/main' into cruise_main
navahgar Nov 10, 2023
052ba71
Converting index_put op to a custom op (#5)
navahgar Nov 10, 2023
eea9c34
Move bottom up fuser declaration to header file (#23)
mabubakarpurdue Dec 7, 2023
9c19ae3
[Cherry-Pick] Move bottom up fuser declaration to header file (#7)
Dec 7, 2023
fe8bacd
Merge remote-tracking branch 'origin/main' into sambhav/upgrade-llvm-…
sjain-stanford Dec 19, 2023
aec758d
TCP Upgrade (#8)
sjain-stanford Dec 19, 2023
fdf0338
Lower torch transposed convolution to a custom TCP op (#25)
srinathava Jan 15, 2024
bf6191f
Cherry pick: Lower torch transposed convolution to a custom TCP op (#…
Jan 16, 2024
33846e9
Merge branch 'main' into aaron.stgeorge/upgrade_01_24
Jan 17, 2024
4e1d4c9
Add TCP custom op builder helper (#33)
srinathava Jan 22, 2024
ef63c4d
Cherry-pick: Add TCP custom op builder helper (#33) (#12)
Jan 23, 2024
827a780
[TorchToTcp] lowering support for aten.size.int op (#35)
zezhang Jan 22, 2024
2eff963
[TorchToTcp] Constrain dynamic legality condition for 2d convolutions…
sjain-stanford Jan 22, 2024
4eb3ce9
Cherry-pick: aten.size.int and conv2d constrain (#13)
Jan 23, 2024
6d38b86
MLIR-tcp Upgrade (#11)
Jan 31, 2024
dcd1338
Merge branch 'main' into sambhav/upgrade_feb_1
sjain-stanford Feb 1, 2024
7f1899b
TCP Upgrade (#14)
sjain-stanford Feb 3, 2024
bb21cd2
Cherry-pick from upstream for tensor.extract_slice (#15)
Feb 21, 2024
ff2d017
Merge branch 'main' into zezhang/upgrade_3_5
Mar 6, 2024
6945903
remove hermetic python deps and python tests for internal repo
Mar 6, 2024
4680380
TCP Upgrade (#16)
Mar 7, 2024
a44b76b
Merge remote-tracking branch 'upstream/main' into sambhav/update
sjain-stanford Mar 26, 2024
cc8b4ed
disable all targets that rely on hermetic python
sjain-stanford Mar 26, 2024
ef24d46
Sync with upstream and add hermetic python patches for c/c (#17)
sjain-stanford Mar 26, 2024
3c78997
Merge branch 'main' into raghavanr/upgrade_4_16
navahgar Apr 16, 2024
1b94201
set generic name for executing tensor-rt engine (#19)
Apr 17, 2024
6292caa
Merge branch 'cruise_main' into raghavanr/upgrade_4_16
Apr 19, 2024
c78a73e
TCP Upgrade (#18)
Apr 22, 2024
fa0a65f
handle create_tensor_from_int
May 1, 2024
456bb9c
Add create_tensor_from_int (#20)
May 1, 2024
22fc7d0
support index from tensor
May 8, 2024
51a9bdf
add test and incorporate feedback
May 10, 2024
f3e6748
support index_from_tensor (#21)
May 13, 2024
cf71f96
Merge remote-tracking branch 'upstream/main' into sambhav/bump
sjain-stanford May 14, 2024
f28249a
Sync with upstream (#22)
sjain-stanford May 14, 2024
1677b79
add missing file
May 15, 2024
dd2d06a
update test
May 16, 2024
aa8740f
Add missing file from previous PR (#23)
May 16, 2024
3eb5a4d
handle create_tensor_from_index_array
May 15, 2024
be0f91d
handle create_index_from_tensor_array
May 15, 2024
ca86ee1
support create_index_from_tensor
May 15, 2024
4741c39
add test case
May 16, 2024
a7dde48
Move Tcp::IndexArrayType to CruiseInternal
May 16, 2024
a5b2c20
Create tensor from index array (#24)
May 21, 2024
8da2258
LRDPrefilterPrediction Cleanup (#25)
May 29, 2024
913ffbb
Allow creation of TCP groups where an op has multiple uses (#74)
srinathava Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ td_library(
"include/mlir-tcp/Dialect/IR/TcpEnums.td",
"include/mlir-tcp/Dialect/IR/TcpOps.td",
"include/mlir-tcp/Dialect/IR/TcpTypes.td",
],
"include/mlir-tcp/Dialect/IR/TcpOpsCruiseInternal.td",
"include/mlir-tcp/Dialect/IR/TcpTypesCruiseInternal.td",
],
includes = ["include"],
deps = [
"@llvm-project//mlir:OpBaseTdFiles",
Expand Down Expand Up @@ -202,12 +204,15 @@ cc_library(
"lib/Conversion/TorchToTcp/PopulatePatterns.h",
"lib/Conversion/TorchToTcp/TcpCustomOp.cpp",
"lib/Conversion/TorchToTcp/TorchToTcp.cpp",
"lib/Conversion/TorchToTcp/TorchToTcpCruiseInternal.cpp",
"lib/Conversion/TorchToTcp/CruiseInternalPatterns.cpp",
"lib/Conversion/TorchToTcp/TorchToTcpCustomOp.cpp",
"lib/Conversion/TorchToTcp/Utils.cpp",
"lib/Conversion/TorchToTcp/Utils.h",
],
hdrs = [
"include/mlir-tcp/Conversion/TorchToTcp/TorchToTcp.h",
"include/mlir-tcp/Conversion/TorchToTcp/TorchToTcpCruiseInternal.h",
"include/mlir-tcp/Conversion/TorchToTcp/TorchToTcpCustomOp.h",
],
strip_include_prefix = "include",
Expand Down
12 changes: 12 additions & 0 deletions include/mlir-tcp/Conversion/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ def ConvertTorchToTcpCustomOp : Pass<"convert-torch-to-tcp-custom-op", "func::Fu
];
}

//===----------------------------------------------------------------------===//
// TorchToTcpCruiseInternal
//===----------------------------------------------------------------------===//

def ConvertTorchToTcpCruiseInternal : Pass<"convert-torch-to-tcp-cruise-internal", "func::FuncOp"> {
let summary = "Convert Torch ops to Tcp ops with cruise internal patterns only";
let description = [{
Convert Torch ops to Tcp ops with cruise internal patterns only.
}];
let constructor = "mlir::tcp::createConvertTorchToTcpCruiseInternalPass()";
}

//===----------------------------------------------------------------------===//
// StablehloToTcp
//===----------------------------------------------------------------------===//
Expand Down
26 changes: 26 additions & 0 deletions include/mlir-tcp/Conversion/TorchToTcp/TorchToTcpCruiseInternal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//===------------------------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Also available under a BSD-style license. See LICENSE.
//
//===----------------------------------------------------------------------===//

#pragma once

#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Pass/Pass.h"

namespace mlir {

#define GEN_PASS_DECL_CONVERTTORCHTOTCPCRUISEINTERNAL
#include "mlir-tcp/Conversion/Passes.h.inc"

namespace tcp {

std::unique_ptr<OperationPass<func::FuncOp>>
createConvertTorchToTcpCruiseInternalPass();

} // namespace tcp
} // namespace mlir
3 changes: 3 additions & 0 deletions include/mlir-tcp/Dialect/IR/TcpOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ include "mlir-tcp/Dialect/IR/TcpBase.td"
include "mlir-tcp/Dialect/IR/TcpEnums.td"
include "mlir-tcp/Dialect/IR/TcpTypes.td"

// Import cruise specific ops
include "mlir-tcp/Dialect/IR/TcpOpsCruiseInternal.td"

def Tcp_TanhOp : Tcp_UnaryElementwiseOp<"tanh", [SameOperandsAndResultElementType]> {
let summary = "Computes tanh of input, elementwise";

Expand Down
83 changes: 83 additions & 0 deletions include/mlir-tcp/Dialect/IR/TcpOpsCruiseInternal.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//===-------------------------------------------------------*- tablegen -*-===//
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Also available under a BSD-style license. See LICENSE.
//
//===----------------------------------------------------------------------===//

#ifndef TCP_OPS_CRUISE_INTERNAL
#define TCP_OPS_CRUISE_INTERNAL

def Tcp_CreateIndexArrayOp : Tcp_Op<"create_index_array"> {
let summary = "Creates index_arry type given variadic number of input indices";

let arguments = (ins
Variadic<Index>:$inputs
);

let results = (outs
Tcp_IndexArrayType : $outputs
);

let assemblyFormat = [{
`(` operands `)` `:` attr-dict-with-keyword functional-type(operands, results)
}];
}

def Tcp_BindTensorShape : Tcp_Op<"bind_tensor_shape", []> {
let summary = "Binds a tensor to its index_array shape type.";

let arguments = (ins
AnyType:$tensor,
Tcp_IndexArrayType : $inputs
);
}

// caspr CasprCreateTensorFromIndexOp : used for encapsulating result of tensor_dim_op in tensor
def Tcp_CasprCreateTensorFromIndexOp : Tcp_Op<"caspr_create_tensor_from_index"> {
let arguments = (ins
Index:$index
);

let results = (outs
AnyType:$result
);

let assemblyFormat = [{
`(` operands `)` `:` attr-dict-with-keyword functional-type(operands, results)
}];
}

// caspr CasprCreateTensorFromIndexArrayOp : used for encapsulating result of tensor_dim_op in tensor
def Tcp_CasprCreateTensorFromIndexArrayOp : Tcp_Op<"caspr_create_tensor_from_index_array"> {
let arguments = (ins
Tcp_IndexArrayType:$shape_array
);

let results = (outs
AnyType:$result
);

let assemblyFormat = [{
`(` operands `)` `:` attr-dict-with-keyword functional-type(operands, results)
}];
}

def Tcp_CasprIndexFromTensorOp : Tcp_Op<"caspr_index_from_tensor"> {
let arguments = (ins
AnyType:$input
);

let results = (outs
Index:$index
);

let assemblyFormat = [{
`(` operands `)` `:` attr-dict-with-keyword functional-type(operands, results)
}];
}


#endif // TCP_OPS_CRUISE_INTERNAL
11 changes: 1 addition & 10 deletions include/mlir-tcp/Dialect/IR/TcpTypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/DialectBase.td"

include "mlir-tcp/Dialect/IR/TcpBase.td"

include "mlir-tcp/Dialect/IR/TcpTypesCruiseInternal.td"

//===----------------------------------------------------------------------===//
// Tcp Quantized Types
Expand Down Expand Up @@ -58,13 +58,4 @@ def Tcp_FloatTensor : RankedTensorOf<[AnyFloat]>;
def Tcp_IntTensor : RankedTensorOf<[AnySignlessInteger]>;
def Tcp_FloatOrIntTensor : RankedTensorOf<[AnyFloat, AnySignlessInteger]>;


//===----------------------------------------------------------------------===//
// Tcp Custom Types
//===----------------------------------------------------------------------===//

def Tcp_IndexArrayType : Tcp_Type<"IndexArray", "index_array"> {
let summary = "IndexArray TCP type, to holds a list of index builtin type to represent shape";
}

#endif // TCP_TYPES
27 changes: 27 additions & 0 deletions include/mlir-tcp/Dialect/IR/TcpTypesCruiseInternal.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//===-------------------------------------------------------*- tablegen -*-===//
//
// Licensed under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// Also available under a BSD-style license. See LICENSE.
//
//===----------------------------------------------------------------------===//

#ifndef TCP_TYPES_CRUISE_INTERNAL
#define TCP_TYPES_CRUISE_INTERNAL

//===----------------------------------------------------------------------===//
// Tcp Custom Types
//===----------------------------------------------------------------------===//

def Tcp_IndexArrayType : Tcp_Type<"IndexArray", "index_array"> {
let summary = "IndexArray TCP type, to holds a list of index builtin type to represent shape";

let parameters = (ins
"int":$elements
);

let assemblyFormat = "`<` `[` $elements `]` `>`";
}

#endif // TCP_TYPES_CRUISE_INTERNAL
1 change: 1 addition & 0 deletions lib/Conversion/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "mlir-tcp/Conversion/TcpToArith/TcpToArith.h"
#include "mlir-tcp/Conversion/TcpToLinalg/TcpToLinalg.h"
#include "mlir-tcp/Conversion/TorchToTcp/TorchToTcp.h"
#include "mlir-tcp/Conversion/TorchToTcp/TorchToTcpCruiseInternal.h"
#include "mlir-tcp/Conversion/TorchToTcp/TorchToTcpCustomOp.h"

//===----------------------------------------------------------------------===//
Expand Down
Loading
Loading