Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Created October 20, 2022 17:19
Show Gist options
  • Save AmosLewis/3255f9c7eb8295afe7b93e7ef436abcd to your computer and use it in GitHub Desktop.
Save AmosLewis/3255f9c7eb8295afe7b93e7ef436abcd to your computer and use it in GitHub Desktop.
(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/ubuntu20/shark/torch-mlir/build/tools/mlir/include -I/home/chi/src/ubuntu20/shark/torch-mlir/include -I/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/torch-mlir/include -I/home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include -I/home/chi/src/ubuntu20/shark/torch-mlir/lib/Dialect/Torch/IR/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -fno-exceptions -fno-rtti -std=c++17 -MD -MT tools/torch-mlir/lib/Conversion/TorchToTosa/CMakeFiles/obj.TorchMLIRTorchToTosa.dir/TorchToTosa.cpp.o -MF tools/torch-mlir/lib/Conversion/TorchToTosa/CMakeFiles/obj.TorchMLIRTorchToTosa.dir/TorchToTosa.cpp.o.d -o tools/torch-mlir/lib/Conversion/TorchToTosa/CMakeFiles/obj.TorchMLIRTorchToTosa.dir/TorchToTosa.cpp.o -c /home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp
/home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp:3060:52: error: no viable conversion from 'mlir::IntegerType' to 'int64_t' (aka 'long')
IntegerAttr dimAttr = rewriter.getI64IntegerAttr(adaptor.dim().dyn_cast<IntegerType>());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:124:41: note: passing argument to parameter 'value' here
IntegerAttr getI64IntegerAttr(int64_t value);
^
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp:10:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/include/torch-mlir/Conversion/TorchToTosa/TorchToTosa.h:13:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/Dialect/Func/IR/FuncOps.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/OpDefinition.h:22:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Dialect.h:17:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/OperationSupport.h:17:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/BlockSupport.h:16:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Value.h:16:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Types.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/TypeSupport.h:17:
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/StorageUniquerSupport.h:110:5: error: static_assert failed due to requirement 'std::is_convertible<mlir::IntegerType, mlir::Value>::value' "casting from a non-convertible type"
static_assert(std::is_convertible<ConcreteT, T>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Value.h:579:47: note: in instantiation of function template specialization 'mlir::detail::StorageUserBase<mlir::IntegerType, mlir::Type, mlir::detail::IntegerTypeStorage, mlir::detail::TypeUniquer>::classof<mlir::Value>' requested here
std::is_base_of_v<To, From> || To::classof(ty);
^
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/include/llvm/Support/Casting.h:312:19: note: in instantiation of member function 'llvm::CastInfo<mlir::IntegerType, const mlir::Value, void>::isPossible' requested here
if (!Derived::isPossible(f))
^
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/include/llvm/Support/Casting.h:649:36: note: in instantiation of member function 'llvm::DefaultDoCastIfPossible<mlir::IntegerType, const mlir::Value, llvm::CastInfo<mlir::IntegerType, const mlir::Value, void> >::doCastIfPossible' requested here
return CastInfo<To, const From>::doCastIfPossible(Val);
^
/home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp:3060:66: note: in instantiation of function template specialization 'mlir::Value::dyn_cast<mlir::IntegerType>' requested here
IntegerAttr dimAttr = rewriter.getI64IntegerAttr(adaptor.dim().dyn_cast<IntegerType>());
^
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp:10:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/include/torch-mlir/Conversion/TorchToTosa/TorchToTosa.h:13:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/Dialect/Func/IR/FuncOps.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/OpDefinition.h:22:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Dialect.h:17:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/OperationSupport.h:17:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/BlockSupport.h:16:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Value.h:16:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Types.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/TypeSupport.h:17:
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/StorageUniquerSupport.h:112:16: error: no member named 'getTypeID' in 'mlir::Value'
return val.getTypeID() == getTypeID();
~~~ ^
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp:10:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/include/torch-mlir/Conversion/TorchToTosa/TorchToTosa.h:13:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/Dialect/Func/IR/FuncOps.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Builders.h:12:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/OpDefinition.h:22:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Dialect.h:17:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/OperationSupport.h:17:
In file included from /home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/BlockSupport.h:16:
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Value.h:581:55: error: no matching conversion for functional-style cast from 'detail::ValueImpl *' to 'mlir::IntegerType'
static inline To doCast(mlir::Value value) { return To(value.getImpl()); }
^~~~~~~~~~~~~~~~~~
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/include/llvm/Support/Casting.h:314:21: note: in instantiation of member function 'llvm::CastInfo<mlir::IntegerType, const mlir::Value, void>::doCast' requested here
return Derived::doCast(f);
^
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/include/llvm/Support/Casting.h:649:36: note: in instantiation of member function 'llvm::DefaultDoCastIfPossible<mlir::IntegerType, const mlir::Value, llvm::CastInfo<mlir::IntegerType, const mlir::Value, void> >::doCastIfPossible' requested here
return CastInfo<To, const From>::doCastIfPossible(Val);
^
/home/chi/src/ubuntu20/shark/torch-mlir/lib/Conversion/TorchToTosa/TorchToTosa.cpp:3060:66: note: in instantiation of function template specialization 'mlir::Value::dyn_cast<mlir::IntegerType>' requested here
IntegerAttr dimAttr = rewriter.getI64IntegerAttr(adaptor.dim().dyn_cast<IntegerType>());
^
/home/chi/src/ubuntu20/shark/torch-mlir/externals/llvm-project/llvm/../mlir/include/mlir/IR/Types.h:87:18: note: candidate inherited constructor not viable: no known conversion from 'detail::ValueImpl *' to 'const mlir::Type::ImplType *' (aka 'const mlir::TypeStorage *') for 1st argument
/* implicit */ Type(const ImplType *impl)
^
/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/mlir/include/mlir/IR/BuiltinTypes.h.inc:132:15: note: constructor from base class 'StorageUserBase<mlir::IntegerType, mlir::Type, mlir::detail::IntegerTypeStorage, mlir::detail::TypeUniquer>' inherited here
using Base::Base;
^
/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/mlir/include/mlir/IR/BuiltinTypes.h.inc:130:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'detail::ValueImpl *' to 'const mlir::IntegerType' for 1st argument
class IntegerType : public ::mlir::Type::TypeBase<IntegerType, ::mlir::Type, detail::IntegerTypeStorage> {
^
/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/mlir/include/mlir/IR/BuiltinTypes.h.inc:130:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'detail::ValueImpl *' to 'mlir::IntegerType' for 1st argument
/home/chi/src/ubuntu20/shark/torch-mlir/build/tools/mlir/include/mlir/IR/BuiltinTypes.h.inc:130:7: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
4 errors generated.
ninja: build stopped: subcommand failed.
@AmosLewis
Copy link
Author

(mlir_venv) nod% cmake --build build --target tools/torch-mlir/all

[72/72] Linking CXX shared module tools/torch-mlir/python_packages/torch_mlir/torch_mlir/_mlir_libs/_mlir.cpython-310-x86_64-linux-gnu.so
(mlir_venv) nod% torch-mlir-opt -torch-backend-to-tosa-backend-pipeline    /tmp/softmax.mlir                                      

/tmp/softmax.mlir:4:10: error: 'tosa.custom' op requires attribute 'identifier'
  %ret = torch.aten.softmax.int %t, %dim, %none : !torch.vtensor<[2,3],f32>, !torch.int, !torch.none -> !torch.vtensor<[2,3],f32>
         ^
/tmp/softmax.mlir:4:10: note: see current operation: %3 = "tosa.custom"(%0) {dim = 1 : i64, softmax = "softmax"} : (tensor<2x3xf32>) -> tensor<2x3xf32>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment