This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[61/62] Running the torch-mlir regression tests | |
FAIL: TORCH_MLIR :: Conversion/TorchToTosa/basic.mlir (42 of 105) | |
******************** TEST 'TORCH_MLIR :: Conversion/TorchToTosa/basic.mlir' FAILED ******************** | |
Script: | |
-- | |
: 'RUN: at line 1'; /home/chi/src/ubuntu20/shark/torch-mlir/build/bin/torch-mlir-opt </home/chi/src/ubuntu20/shark/torch-mlir/test/Conversion/TorchToTosa/basic.mlir -convert-torch-to-tosa -split-input-file -verify-diagnostics | FileCheck /home/chi/src/ubuntu20/shark/torch-mlir/test/Conversion/TorchToTosa/basic.mlir | |
-- | |
Exit Code: 1 | |
Command Output (stderr): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mlir_venv) nod% torch-mlir-opt -convert-torch-to-tosa /tmp/where.mlir | |
module { | |
func.func @torch.aten.where.self(%arg0: !torch.vtensor<[1,1,5,5],i1>, %arg1: !torch.vtensor<[1,12,5,5],f32>, %arg2: !torch.vtensor<[],f32>) -> !torch.vtensor<[1,12,5,5],f32> { | |
%0 = torch_c.to_builtin_tensor %arg0 : !torch.vtensor<[1,1,5,5],i1> -> tensor<1x1x5x5xi1> | |
%1 = torch_c.to_builtin_tensor %arg1 : !torch.vtensor<[1,12,5,5],f32> -> tensor<1x12x5x5xf32> | |
%2 = torch_c.to_builtin_tensor %arg2 : !torch.vtensor<[],f32> -> tensor<f32> | |
%3 = "tosa.select"(%0, %1, %2) : (tensor<1x1x5x5xi1>, tensor<1x12x5x5xf32>, tensor<f32>) -> tensor<1x12x5x5xf32> | |
%4 = torch_c.from_builtin_tensor %3 : tensor<1x12x5x5xf32> -> !torch.vtensor<[1,12,5,5],f32> | |
return %4 : !torch.vtensor<[1,12,5,5],f32> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OVERVIEW: MLIR modular optimizer driver | |
Available Dialects: acc, affine, amdgpu, amx, arith, arm_neon, arm_sve, async, bufferization, builtin, cf, complex, dlti, emitc, func, gpu, linalg, llvm, math, memref, ml_program, nvgpu, nvvm, omp, pdl, pdl_interp, quant, rocdl, scf, shape, sparse_tensor, spirv, tensor, tm_tensor, torch, torch_c, tosa, transform, vector, x86vector | |
USAGE: torch-mlir-opt [options] <input file> | |
OPTIONS: | |
Color Options: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func.func @torch.aten.softmax.int$cst_dim(%arg0: !torch.vtensor<[2,3],f32>) -> !torch.vtensor<[2,3],f32> { | |
%none = torch.constant.none | |
%int1 = torch.constant.int 1 | |
%true = torch.constant.bool true | |
%values, %indices = torch.aten.max.dim %arg0, %int1, %true : !torch.vtensor<[2,3],f32>, !torch.int, !torch.bool -> !torch.vtensor<[2,1],f32>, !torch.vtensor<[2,1],si64> | |
%float1.000000e00 = torch.constant.float 1.000000e+00 | |
%0 = torch.aten.sub.Tensor %arg0, %values, %float1.000000e00 : !torch.vtensor<[2,3],f32>, !torch.vtensor<[2,1],f32>, !torch.float -> !torch.vtensor<[2,3],f32> | |
%1 = torch.aten.exp %0 : !torch.vtensor<[2,3],f32> -> !torch.vtensor<[2,3],f32> | |
%2 = torch.prim.ListConstruct %int1 : (!torch.int) -> !torch.list<int> | |
%true_0 = torch.constant.bool true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mlir_venv) nod% cmake --build build --target tools/torch-mlir/all | |
[54/72] Building CXX object tools/torch-mlir/lib/Conversion/TorchToTosa/CMakeFiles/obj.TorchMLIRTorchToTosa.dir/TorchToTosa.cpp.o | |
FAILED: tools/torch-mlir/lib/Conversion/TorchToTosa/CMakeFiles/obj.TorchMLIRTorchToTosa.dir/TorchToTosa.cpp.o | |
/usr/lib/ccache/clang++ -DGTEST_HAS_RTTI=0 -DTORCH_MLIR_ENABLE_MHLO -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/torch-mlir/lib/Conversion/TorchToTosa -I/home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa -I/home/chi/src/ubuntu20/shark/torch-mlir/build/include -I/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/include -I/home/chi/src/ubuntu20/shark/torch-mlir/externals/mlir-hlo/include -I/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/torch-mlir/mlir-hlo/include -I/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include -I/home/chi/src/ubuntu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func.func @torch.aten.softmax.int$cst_dim(%t: !torch.vtensor<[2,3],f32>) -> !torch.vtensor<[2,3],f32> { | |
%none = torch.constant.none | |
%dim = torch.constant.int 1 | |
%ret = torch.aten.softmax.int %t, %dim, %none : !torch.vtensor<[2,3],f32>, !torch.int, !torch.none -> !torch.vtensor<[2,3],f32> | |
return %ret : !torch.vtensor<[2,3],f32> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(mlir_venv) nod% python -m e2e_testing.main --config=tosa -v | |
[W TensorShape.cpp:3154] Warning: The use of `x.T` on tensors of dimension other than 2 to reverse their shape is deprecated and it will throw an error in a future release. Consider `x.mT` to transpose batches of matrices or `x.permute(*torch.arange(x.ndim - 1, -1, -1))` to reverse the dimensions of a tensor. (function operator()) | |
XFAIL - "AdaptiveAvgPool2dNonUnitOutputSizeDynamicModule_basic" | |
XFAIL - "AdaptiveAvgPool2dNonUnitOutputSizeStaticModule_basic" | |
XFAIL - "AdaptiveAvgPool2dUnitOutputSizeDynamicModule_basic" | |
PASS - "AdaptiveAvgPool2dUnitOutputSizeStaticModule_basic" | |
PASS - "AddCDivModule_basic" | |
PASS - "AddCMulModule_basic" | |
XFAIL - "AddIntModule_basic" | |
XFAIL - "AddSizeIntModule_basic" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename AtenOpT> | |
class ConvertSelectiveAtenOpToTosaCustom : public OpConversionPattern<AtenOpT> { | |
public: | |
using OpConversionPattern<AtenOpT>::OpConversionPattern; | |
using OpAdaptor = typename AtenOpT::Adaptor; | |
LogicalResult | |
matchAndRewrite(AtenOpT op, OpAdaptor adaptor, | |
ConversionPatternRewriter &rewriter) const override { | |
ValueRange operands = adaptor.getOperands(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
➜ SHARK git:(main) ✗ python tank/pytorch/deberta/deberta_tosa.py | |
Some weights of the model checkpoint at hf-internal-testing/tiny-random-deberta were not used when initializing DebertaForSequenceClassification: ['cls.predictions.transform.dense.bias', 'cls.predictions.transform.LayerNorm.bias', 'cls.predictions.transform.dense.weight', 'cls.predictions.bias', 'cls.predictions.decoder.weight', 'qa_outputs.bias', 'cls.predictions.transform.LayerNorm.weight', 'qa_outputs.weight', 'cls.predictions.decoder.bias'] | |
- This IS expected if you are initializing DebertaForSequenceClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model). | |
- This IS NOT expected if you are initializing DebertaForSequenceClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model). | |
model(test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from transformers import AutoTokenizer, AutoModelForSequenceClassification | |
import torch | |
from torch.fx.experimental.proxy_tensor import make_fx | |
from torch._decomp import get_decompositions | |
import tempfile | |
import torch_mlir | |
def prepare_sentence_tokens(hf_model: str, sentence: str): | |
tokenizer = AutoTokenizer.from_pretrained(hf_model) |