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

[QNN EP] Support Conv + Clip/Relu fusion #21537

Merged
merged 22 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d50890b
Try fuse conv + relu in qnn
adrianlizarraga Jul 25, 2024
9c164ce
Check in progress
adrianlizarraga Jul 26, 2024
4cab5f9
Get it working on test model
adrianlizarraga Jul 27, 2024
e2c9c00
Finish clip removal calcs
adrianlizarraga Jul 27, 2024
6f042c8
Dont always return Status
adrianlizarraga Jul 27, 2024
dd8dc3d
Remove macro
adrianlizarraga Jul 27, 2024
fa79a2f
Use different NodeUnit constructor
adrianlizarraga Jul 27, 2024
f21dd77
Update NodeUnit constructor to use gsl::span
adrianlizarraga Jul 27, 2024
a96d342
Remove initial conv qnn validation when grouping conv+activation
adrianlizarraga Jul 27, 2024
dfee473
Refactor and use jump tables to compare cpu usage on session creation
adrianlizarraga Jul 28, 2024
3dbd2d6
Reuse utility func
adrianlizarraga Jul 28, 2024
44dc696
Use virtual base class instead of enum type
adrianlizarraga Jul 28, 2024
576c2f8
Clean up
adrianlizarraga Jul 28, 2024
0e7eece
Remove use of optimizer qdq utils from fusion code; Rename fusion cla…
adrianlizarraga Jul 28, 2024
94faeaf
Add more comments
adrianlizarraga Jul 29, 2024
a946b5e
Add unit tests
adrianlizarraga Jul 29, 2024
5850900
Run lintrunner
adrianlizarraga Jul 29, 2024
259dbce
Merge branch 'main' into adrianl/qnn-conv-relu-clip
adrianlizarraga Jul 29, 2024
7b430f7
Forgot error message
adrianlizarraga Jul 29, 2024
dab7496
Fix linux compiler error due to struct initialization
adrianlizarraga Jul 29, 2024
fe0f58e
Merge branch 'main' into adrianl/qnn-conv-relu-clip
adrianlizarraga Jul 30, 2024
2fd5863
Rename variable according to review comment; Add function comments.
adrianlizarraga Jul 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions onnxruntime/core/framework/node_unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#if !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD)

#include "node_unit.h"
#include <utility>
#include "core/graph/graph_viewer.h"

namespace onnxruntime {
Expand Down Expand Up @@ -272,6 +273,20 @@ NodeUnit::NodeUnit(const GraphViewer& graph_viewer, const QDQ::NodeGroup& node_g
}
}

NodeUnit::NodeUnit(gsl::span<const Node* const> dq_nodes, const Node& target_node,
gsl::span<const Node* const> q_nodes, Type type,
adrianlizarraga marked this conversation as resolved.
Show resolved Hide resolved
gsl::span<const NodeUnitIODef> inputs, gsl::span<const NodeUnitIODef> outputs,
size_t input_edge_count, Node::EdgeSet output_edges)
: dq_nodes_(dq_nodes.begin(), dq_nodes.end()),
target_node_(target_node),
q_nodes_(q_nodes.begin(), q_nodes.end()),
type_(type),
inputs_(inputs.begin(), inputs.end()),
outputs_(outputs.begin(), outputs.end()),
input_edge_count_(input_edge_count),
output_edges_(std::move(output_edges)) {
}

const std::string& NodeUnit::Domain() const noexcept { return target_node_.Domain(); }
const std::string& NodeUnit::OpType() const noexcept { return target_node_.OpType(); }
const std::string& NodeUnit::Name() const noexcept { return target_node_.Name(); }
Expand Down
4 changes: 4 additions & 0 deletions onnxruntime/core/framework/node_unit.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class NodeUnit {
public:
explicit NodeUnit(const Node& node);
explicit NodeUnit(const GraphViewer& graph_viewer, const QDQ::NodeGroup& node_group);
NodeUnit(gsl::span<const Node* const> dq_nodes, const Node& target_node,
gsl::span<const Node* const> q_nodes, Type type,
gsl::span<const NodeUnitIODef> inputs, gsl::span<const NodeUnitIODef> outputs,
size_t input_edge_count, Node::EdgeSet output_edges);

Type UnitType() const noexcept { return type_; }

Expand Down
294 changes: 0 additions & 294 deletions onnxruntime/core/providers/qnn/builder/qnn_fusions.cc

This file was deleted.

38 changes: 0 additions & 38 deletions onnxruntime/core/providers/qnn/builder/qnn_fusions.h

This file was deleted.

Loading
Loading