Skip to content

[WebNN EP] Add constraints for MatMul#19713

Merged
guschmue merged 3 commits into
microsoft:mainfrom
zesongw:add_matmul_constraint
Mar 2, 2024
Merged

[WebNN EP] Add constraints for MatMul#19713
guschmue merged 3 commits into
microsoft:mainfrom
zesongw:add_matmul_constraint

Conversation

@zesongw
Copy link
Copy Markdown
Contributor

@zesongw zesongw commented Feb 29, 2024

Description

Add constraints to MatMul:

  • The input must be at least 2D.
  • CPU backend: The input rank must be the same.
  • CPU backend: The input shape except for the last two axis must be the same.

Motivation and Context

Prevent regression for some models.

@zesongw
Copy link
Copy Markdown
Contributor Author

zesongw commented Feb 29, 2024

@fdwr, @guschmue, PTAL, thanks!

@guschmue guschmue added the ep:WebNN WebNN execution provider label Feb 29, 2024
guschmue
guschmue previously approved these changes Feb 29, 2024
@guschmue
Copy link
Copy Markdown
Contributor

/azp run ONNX Runtime Web CI Pipeline,Linux CPU CI Pipeline

@guschmue
Copy link
Copy Markdown
Contributor

/azp run Big Models,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,Windows ARM64 QNN CI Pipeline,Windows CPU CI Pipeline

@guschmue
Copy link
Copy Markdown
Contributor

/azp run Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed,Windows x64 QNN CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 7 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 9 pipeline(s).

Copy link
Copy Markdown
Contributor

@fdwr fdwr left a comment

Choose a reason for hiding this comment

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

Approved if we add todo comments to indicate these are temporary workarounds until the XNNPack backend follows the WebNN spec.

Comment thread onnxruntime/core/providers/webnn/builders/impl/gemm_op_builder.cc Outdated
Comment thread onnxruntime/core/providers/webnn/builders/impl/gemm_op_builder.cc
Comment thread onnxruntime/core/providers/webnn/builders/impl/gemm_op_builder.cc
Comment thread onnxruntime/core/providers/webnn/builders/impl/gemm_op_builder.cc
Copy link
Copy Markdown
Contributor

@fdwr fdwr left a comment

Choose a reason for hiding this comment

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

👍

@fdwr
Copy link
Copy Markdown
Contributor

fdwr commented Mar 1, 2024

/azp run Linux CPU CI Pipeline,Linux CPU Minimal Build E2E CI Pipeline,Linux GPU CI Pipeline,Linux GPU TensorRT CI Pipeline,Linux OpenVINO CI Pipeline,Linux QNN CI Pipeline,MacOS CI Pipeline,Windows ARM64 QNN CI Pipeline,Windows CPU CI Pipeline

@fdwr
Copy link
Copy Markdown
Contributor

fdwr commented Mar 1, 2024

/azp run Windows GPU CI Pipeline,Windows GPU TensorRT CI Pipeline,onnxruntime-binary-size-checks-ci-pipeline,orttraining-linux-ci-pipeline,orttraining-linux-gpu-ci-pipeline,orttraining-ortmodule-distributed

@fdwr
Copy link
Copy Markdown
Contributor

fdwr commented Mar 1, 2024

/azp run ONNX Runtime Web CI Pipeline,Windows x64 QNN CI Pipeline

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 6 pipeline(s).

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 9 pipeline(s).

@guschmue
Copy link
Copy Markdown
Contributor

guschmue commented Mar 1, 2024

/azp run Big Models

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@guschmue guschmue merged commit de3158e into microsoft:main Mar 2, 2024
@fdwr fdwr changed the title [WebNN EP] Add contraints for MatMul [WebNN EP] Add constraints for MatMul Mar 4, 2024
zz002 pushed a commit to zz002/onnxruntime that referenced this pull request Mar 7, 2024
### Description
Add constraints to MatMul:
- The input must be at least 2D.
- CPU backend: The input rank must be the same.
- CPU backend: The input shape except for the last two axis must be the
same.



### Motivation and Context
Prevent regression for some models.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebNN WebNN execution provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants