Skip to content

[TVM] Add importer for ONNX QLinearMatMul op - #8952

Merged
tmoreau89 merged 1 commit into
apache:mainfrom
cconvey:cconvey/qlmatmul
Oct 11, 2021
Merged

[TVM] Add importer for ONNX QLinearMatMul op#8952
tmoreau89 merged 1 commit into
apache:mainfrom
cconvey:cconvey/qlmatmul

Conversation

@cconvey

Copy link
Copy Markdown
Contributor
  • adds importer code

  • enables test_qlinearmatmul_2D unit test

Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated

@tmoreau89tmoreau89 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you @cconvey for this first contribution!

@tmoreau89

Copy link
Copy Markdown
Contributor

@cconvey may need to rebase and resolve conflicts given that test_forward has changed. @anwang2009 and @mbrookhart if you get cycles on Friday could you help review? thanks!

Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
@cconveycconvey changed the title [TVM] Add importer for ONNX QLinearMatMul op**WIP** [TVM] Add importer for ONNX QLinearMatMul opOct 6, 2021
@cconvey

Copy link
Copy Markdown
ContributorAuthor

I just pushed a significantly revised version of the code, but it's not ready for review yet.

Comment threadtests/python/frontend/onnx/test_forward.py Outdated
@cconvey
cconveyforce-pushed the cconvey/qlmatmul branch 2 times, most recently from 1092db4 to d15bc48CompareOctober 6, 2021 20:29
@cconveycconvey changed the title **WIP** [TVM] Add importer for ONNX QLinearMatMul op[TVM] Add importer for ONNX QLinearMatMul opOct 6, 2021

@AndrewZhaoLuoAndrewZhaoLuo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some comments

Comment threadtests/python/frontend/onnx/test_forward.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
Comment threadpython/tvm/relay/frontend/onnx.py
Comment threadtests/python/frontend/onnx/test_forward.py
Comment threadpython/tvm/relay/frontend/onnx.py Outdated
@cconvey
cconveyforce-pushed the cconvey/qlmatmul branch 3 times, most recently from 5f8b0d4 to 23748c1CompareOctober 7, 2021 15:01
@cconvey

Copy link
Copy Markdown
ContributorAuthor

@mbrookhart@AndrewZhaoLuo ready for (re)review.

# express these constraints.
matmul_result_dtype = "int32"

matmul_result = _qnn.op.dense(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you add a TODO looking into refactoring this with regular MatMul code which handles broadcasting and the 3D cases already?

Feel free to assign it to you or me.

E.g.
TODO (AndrewZhaoLuo): ... or TODO(cconvey): ...

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'm thinking that this should probably be part of a larger discussion about what collection of matmul-related ops are provided by Relay / Relax. If you don't mind I'll bring the topic up in a different forum.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean the Matmul code in onnx, which handles numpy style broadcasting. That one is just a frontend change on how we generate relay from frontend code.

@AndrewZhaoLuoAndrewZhaoLuo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tmoreau89

Copy link
Copy Markdown
Contributor

Also CC- @anwang2009 for the re-review

@cconvey
cconveyforce-pushed the cconvey/qlmatmul branch 2 times, most recently from e20764d to ec16e22CompareOctober 8, 2021 18:39

@mbrookhartmbrookhart left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mbrookhart

Copy link
Copy Markdown
Contributor

Looks like you hit #9231

 * adds importer code
* enables `test_qlinearmatmul_2D` unit test
@tmoreau89
tmoreau89 merged commit 0fa860c into apache:mainOct 11, 2021
@tmoreau89

Copy link
Copy Markdown
Contributor

Thank you @cconvey@anwang2009@AndrewZhaoLuo@mbrookhart the PR has been merged!

masahi pushed a commit to Laurawly/tvm-1 that referenced this pull request Oct 14, 2021
* adds importer code
* enables `test_qlinearmatmul_2D` unit test
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* adds importer code
* enables `test_qlinearmatmul_2D` unit test
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* adds importer code
* enables `test_qlinearmatmul_2D` unit test
@cconvey
cconvey deleted the cconvey/qlmatmul branch May 5, 2022 13:25
Sign up for freeto 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.

5 participants

@cconvey@tmoreau89@mbrookhart@anwang2009@AndrewZhaoLuo