microsoft / microsoft/onnxruntime

[Performance] Replace MatMul with FullyConnected

Open
#20,524 2 comments 0 reactions 1 assignee View on GitHub

@adrianlizarraga is already working on this.

Since May 4, 2024.

ep:QNN performance
Dominant language
C++
Stars
21.9k
Forks
4.2k
Avg merge
4d 11h
Merged PRs (30d)
184

Description

### Describe the issue

QNN's implementation of MatMul is much slower than the equivalent FullyConnected implementation.

The QNN delegate should insert reshapes around 3D/4D MatMul to squish the input to 2D, then replace all instances of MatMul with FullyConnected layers.

### To reproduce

See attached models.

### Urgency

_No response_

### Platform

Linux

### OS Version

Ubuntu 22.04

### ONNX Runtime Installation

Built from Source

### ONNX Runtime Version or Commit ID

Latest

### ONNX Runtime API

Python

### Architecture

ARM64

### Execution Provider

Other / Unknown

### Execution Provider Library Version

QNN 2.20

### Model File

[MatMul_Repros.zip](https://github.com/microsoft/onnxruntime/files/15170393/MatMul_Repros.zip)

### Is this a quantized model?

No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.