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

Merge GatherToSplitFusion and #19218 to a General Fusion #19600

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
318 changes: 193 additions & 125 deletions onnxruntime/core/optimizer/gather_fusion.cc

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions onnxruntime/core/optimizer/gather_fusion.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,23 @@
namespace onnxruntime {

/**
@Class GatherToSplitFusion
@Class GatherSliceToSplitFusion
Fuse multiple Gather nodes that comsuming one output to one Split node.
Fuse multiple Gather/Slice nodes that comsuming one output to one Split node.
*/
class GatherToSplitFusion : public GraphTransformer {
class GatherSliceToSplitFusion : public GraphTransformer {
public:
GatherToSplitFusion(const InlinedHashSet<std::string_view>& compatible_execution_providers = {}) noexcept
: GraphTransformer("GatherToSplitFusion", compatible_execution_providers) {}
GatherSliceToSplitFusion(const InlinedHashSet<std::string_view>& compatible_execution_providers = {}) noexcept

Check warning on line 17 in onnxruntime/core/optimizer/gather_fusion.h

View workflow job for this annotation

GitHub Actions / Lint C++

[cpplint] reported by reviewdog 🐶 Constructors callable with one argument should be marked explicit. [runtime/explicit] [5] Raw Output: onnxruntime/core/optimizer/gather_fusion.h:17: Constructors callable with one argument should be marked explicit. [runtime/explicit] [5]
: GraphTransformer("GatherSliceToSplitFusion", compatible_execution_providers) {}

Status ApplyImpl(Graph& graph, bool& modified, int graph_level, const logging::Logger& logger) const override;

private:
bool IsSupportedGather(const Graph& graph, const Node& node, int64_t& index, int64_t& axis, int64_t& indices_n_dims) const;
bool IsSupportedGather(const Graph& graph, const Node& node, int64_t rank, int64_t target_axis, int64_t dim_size,
InlinedVector<bool>& consumed, int64_t& start, bool& need_squeeze) const;

bool IsSupportedSlice(const Graph& graph, const Node& node, int64_t rank, int64_t target_axis, int64_t dim_size,
InlinedVector<bool>& consumed, int64_t& start, int64_t& end) const;
};

/**
Expand Down
344 changes: 0 additions & 344 deletions onnxruntime/core/optimizer/gather_slice_fusion.cc

This file was deleted.

Loading
Loading