| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[MLIR][Torch] Canonicalize torch.from_i1 and torch.to_i1 (#3067) When lowering torch.aten.convolution, it is expected that the 'transposed' argument is a torch.constant operation. In some cases, the argument was a from_i1 operation converting an arith.constant operation into a torch.bool. This is not wrong semantically, but instead of generalizing the legality of the torch.aten.convolution op, we canonicalize arith.constant ops followed by from_i1 ops to torch.bool ops. For example: //===-------------------------------------------===// Legalizing operation : 'torch.aten.convolution'(0x124705b90) { %33 = "torch.aten.convolution"(%arg0, %20, %21, %31, %29, %30, %19, %32, %0) : (!torch.vtensor<[1,1,28,28],f32>, !torch.vtensor<[10,1,5,5],f32>, !torch.vtensor<[10],f32>, !torch.list<int>, !torch.list<int>, !torch.list<int>, !torch.bool, !torch.list<int>, !torch.int) -> !torch.vtensor<[1,10,24,24],f32> * Fold { } -> FAILURE : unable to fold * Pattern : 'torch.aten.convolution -> ()' { ** Failure : unimplemented: only constant transposed supported. <-- Resolved by this PR } -> FAILURE : pattern failed to match * Pattern : 'torch.aten.convolution -> ()' { ** Failure : not a supported Scalar to Tensor like op } -> FAILURE : pattern failed to match * Pattern : 'torch.aten.convolution -> ()' { ** Failure : not a supported elementwise op } -> FAILURE : pattern failed to match * Pattern : 'torch.aten.convolution -> ()' { ** Failure : not a supported reduce op } -> FAILURE : pattern failed to match } -> FAILURE : no matched legalization pattern //===-------------------------------------------===// <stdin>:21:11: error: failed to legalize operation 'torch.aten.convolution' that was explicitly marked illegal %17 = torch.operator "onnx.Conv"(%arg0, %0, %1) {torch.onnx.dilations = [1 : si64, 1 : si64], torch.onnx.group = 1 : si64, torch.onnx.kernel_shape = [5 : si64, 5 : si64], torch.onnx.pads = [0 : si64, 0 : si64, 0 : si64, 0 : si64], torch.onnx.strides = [1 : si64, 1 : si64]} : (!torch.vtensor<[1,1,28,28],f32>, !torch.vtensor<[10,1,5,5],f32>, !torch.vtensor<[10],f32>) -> !torch.vtensor<[1,10,24,24],f32> ^ <stdin>:21:11: note: see current operation: %33 = "torch.aten.convolution"(%arg0, %20, %21, %31, %29, %30, %19, %32, %0) : (!torch.vtensor<[1,1,28,28],f32>, !torch.vtensor<[10,1,5,5],f32>, !torch.vtensor<[10],f32>, !torch.list<int>, !torch.list<int>, !torch.list<int>, !torch.bool, !torch.list<int>, !torch.int) -> !torch.vtensor<[1,10,24,24],f32> Additionally, we require the canonicalization of to_i1 operating on a torch.constant bool to an arith.constant ... : i1 for the e2e tests to pass successfully. | 2 年前 | |
Integrate llvm-project at dabdec1001dc368373dd581cf72f37a440873ce3 (#3300) Co-authored-by: Jacques Pienaar <jpienaar@google.com> | 2 年前 | |
Add extf-trunc f32-f64-f32 ellision (#3579) Torch has all scalars represented as i64 and f64 types which results in extraneous trunc-extf commands. We can rework this by elliding widen-narrow cases away. | 1 年前 | |
mlir: bump llvm tag to 5380e3 (#856) In addition to updating the llvm-project submodule, this patch also: 1. updates shape functions and tests so that func and call operations refer to the func dialect 2. avoid duplicate registration of dialects | 4 年前 | |
Add verifiers for ToBuiltinTensorOp and FromBuiltinTensorOp (#1089) This commit adds verifiers to the ops ToBuiltinTensorOp and FromBuiltinTensorOp that make sure that the input and output have the same shape and data type. | 3 年前 | |
Migrate passes in TorchConversion to use FunctionOpInterface. (#2935) This enables better re-use in downstreams which use different func implementations and should have no impact on those that don't except in opt pipelines if using the old form. With interfaces, explicit pipelines via --pass-pipeline= must be used. | 2 年前 | |
build: update llvm tag to 4546397e (#1502) This commit makes the following changes needed to update bump LLVM: - Replace linalg.init_tensor with tensor.empty (see: https://reviews.llvm.org/D135129) - Replace NoSideEffect with Pure (see https://reviews.llvm.org/D135505) - Replace body region accessor for ReduceOp and ReduceWindowOp with getBody - Fix incorrect use of tosa::ReduceSumOp in AtenNativeLayerNormOp conversion pattern. The result type of tosa::ReduceSumOp must have the same rank as the input type. (see: https://www.mlplatform.org/tosa/tosa_spec.html#_reduce_sum) Co-authored-by: Ashay Rane <ashay@users.noreply.github.com> Co-authored-by: Ashay Rane <ashay@users.noreply.github.com> | 3 年前 | |
Integrate llvm-project and mlir-hlo. (#2454) Corresponding commits: * mlir-hlo: 16886a108eff5197f816ca0f1950cc5ff1b078d9 * stablehlo: 77a59815a82b34f7b08ed2d42a711d9920682d0e * llvm-project: 4acc3ffbb0af5631bc7916aeff3570f448899647 * Adapt to ByteCodeOpInterface changes. * Adapt to RegionBranchPoint changes: https://reviews.llvm.org/D159116 * Adapt inferReturnTypes to get the value from properties. * Adapt invalid.mlir to properties syntax * [TOSA] Align with custom assembly format change. * [TOSA] handle change of axis to int32 type * [TOSA] Restore improper convert to i32 Landing with Windows broken (it cannot be fixed because of the way the mlir-hlo dep is inserted). Will followup with an untangling. --------- Co-authored-by: TatWai Chong <tatwai.chong@arm.com> Co-authored-by: Eric Kunze <eric.kunze@arm.com> | 2 年前 |