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

[TOPI][ONNX] Fix for trilu and set_matrix_diag ops #11761

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mikepapadim
Copy link
Contributor

This PR addresses and extends issues of PRs #10873 and #9329.

Refactor the implementation of set_matrix_diag to enable support of the trilu operator in ONNX.

@sfvaroglu @bfgoldstein @AndrewZhaoLuo

@AndrewZhaoLuo
Copy link
Contributor

@mikepapadim can you make sure the tests pass?

@mikepapadim
Copy link
Contributor Author

I am trying to reproduce them locally. Will update when I have them fixed.

Copy link
Contributor

@shingjan shingjan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM. Do we have an update on the PR? I am trying to add triu for our pytorch frontend and this PR could be really useful if merged! Thanks

@@ -17,9 +17,12 @@
# pylint: disable=invalid-name,consider-using-enumerate,redefined-outer-name
"""Injective transformation operators"""
from __future__ import absolute_import as _abs
import numpy as np
from tables import Expr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these two lines necessary? i am getting a tables not found on my end and it seems like those two libs aren't referenced anyway

Copy link
Contributor

@shingjan shingjan Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am hitting the following error:

E             0: tvm::codegen::CodeGenLLVM::CreateBufferPtr(llvm::Value*, tvm::runtime::DataType, llvm::ArrayRef<llvm::Value*>, tvm::runtime::DataType)
E                   at /home/yj/tvm/src/target/llvm/codegen_llvm.cc:737
E             File "/home/yj/tvm/src/target/llvm/codegen_llvm.cc", line 737
E           TVMError: 
E           ---------------------------------------------------------------
E           An error occurred during the execution of TVM.
E           For more information, please see: https://tvm.apache.org/docs/errors.html
E           ---------------------------------------------------------------
E             Check failed: (index->getType()->isIntegerTy()) is false: Expected buffer index to be an integer

I wonder if there are still places in the codegen that assumes k1,k2 as integer

Copy link
Contributor

@AndrewZhaoLuo AndrewZhaoLuo Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's probably a spurious import (e.g. typed Expr and IDE autoimported this when it should be tvms)

@shingjan
Copy link
Contributor

shingjan commented Jul 1, 2022

@mikepapadim I took a look and looks like we need to add

    if not isinstance(k_one, tvm.te.Tensor):
        k_one = const_vector(np.asarray([k_one], dtype=np.int64))
    if not isinstance(k_two, tvm.te.Tensor):
        k_two = const_vector(np.asarray([k_two], dtype=np.int64))

to here:

@@ -17,9 +17,12 @@
# pylint: disable=invalid-name,consider-using-enumerate,redefined-outer-name
"""Injective transformation operators"""
from __future__ import absolute_import as _abs
import numpy as np
from tables import Expr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
from tables import Expr

@areusch areusch added needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it and removed needs-triage PRs or issues that need to be investigated by maintainers to find the right assignees to address it labels Oct 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants