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

operator GEMM does not compile with template type int #84

Open
srohit0 opened this issue Oct 21, 2019 · 0 comments
Open

operator GEMM does not compile with template type int #84

srohit0 opened this issue Oct 21, 2019 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@srohit0
Copy link
Member

srohit0 commented Oct 21, 2019

How to Reproduce

Step 1
Change gemm operator in swig/dnnc.api file to add int shown below:

tensor<output> gemm(tensor<input> &a, tensor<input> &b, 
                                       tensor<input> &c, float alpha = 1.0, float beta = 1.0, 
                                       int transA = 0, int transB = 0) {
     Gemm<output, input, input> op("localOpName", alpha, beta, transA, transB);
     return op.compute(a, b, c);
     dtype = {
         "double" : "double",
         "float" : "float",
         "int" : "int"
     }
}

Step 2

cd swig
make clean
make

Observe compiler errors

/home/dnnc/master/dnnCompiler/include/operators/Gemm.h:139:25: error: invalid operands to binary expression ('float' and 'const Product<Eigen::Map<Eigen::Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >, Eigen:: Map<Eigen::Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> > >')
eResult = alpha * (eigenMatrixA * eigenMatrixB) + beta * eigenMatrixC;
~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dnnc_api.cpp:10885:13: note: in instantiation of member function 'dnnc::Gemm<int, int, int>::compute' requested here
return op.compute(a, b, c);
^
/home/dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/../plugins/CommonCwiseBinaryOps.h: 50:29: note: candidate function template not viable: no known conversion from 'const Product<Eigen::Map<Eigen:: Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >, Eigen::Map<Eigen::Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> > >' to 'const Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 1, -1, -1> >::StorageBaseType' (aka 'const Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 1, -1, -1> >') for 2nd argument
EIGEN_MAKE_SCALAR_BINARY_OP(operator*,product)
^
/home/dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/util/Macros.h:960:41: note: expanded from macro 'EIGEN_MAKE_SCALAR_BINARY_OP'
EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME)
^
/home/dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/util/Macros.h:953:4: note: expanded from macro 'EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT'
(METHOD)(const T& scalar, const StorageBaseType& matrix) { \

/home//dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/../plugins/CommonCwiseBinaryOps.h: 50:29: note: candidate function template not viable: no known conversion from 'const Product<Eigen::Map<Eigen:: Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> >, Eigen::Map<Eigen::Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> > >' to 'const Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen:: Stride<0, 0> > >::StorageBaseType' (aka 'const Eigen::MatrixBase<Eigen::Map<Eigen::Matrix<int, -1, -1, 1, -1, -1>, 0, Eigen::Stride<0, 0> > >') for 2nd argument
/home//dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/util/Macros.h:960:41: note: expanded from macro 'EIGEN_MAKE_SCALAR_BINARY_OP'
EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME)
^
/home//dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/util/Macros.h:953:4: note: expanded from macro 'EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT'
(METHOD)(const T& scalar, const StorageBaseType& matrix) {
^
/home//dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/Eigen/src/Core/PermutationMatrix.h:543:1: note: candidate template ignored: could not match 'MatrixBase' against 'float'
operator*(const MatrixBase &matrix,

...
...

/home/dnnc/master/dnnCompiler/packages/eigen-eigen-323c052e1731/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128. h:135:35: note: candidate template ignored: could not match 'TensorUInt128<type-parameter-0-0, type-parameter-0-1>' against 'float'
TensorUInt128<uint64_t, uint64_t> operator * (const TensorUInt128<HL, LL>& lhs, const TensorUInt128<HR, LR>& rhs)
^

@srohit0 srohit0 added the bug Something isn't working label Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants