Skip to content

Commit

Permalink
[DML EP] Add QDQ fusions for DML and disable QDQ + Resample fusion (m…
Browse files Browse the repository at this point in the history
…icrosoft#22458)

### Description
<!-- Describe your changes. -->



### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
  • Loading branch information
PatriceVignola authored Oct 16, 2024
1 parent f9e623e commit a164228
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ void DropQDQNodesRules(SelectorActionRegistry& qdq_selector_action_registry) {
// And cannot eliminate the QDQ for MaxPool if the scale is not positive, as a negative
// scale will change the ordering of the elements between quantized & de-quantized values.
std::vector<const char*> providers = {kCpuExecutionProvider, kDmlExecutionProvider};

// We don't drop the resample QDQ ops here for DML because we don't know yet whether it is allowed to be executed in DML.
// This will be done within DML during a graph pass if allowed, but otherwise we need to keep the dequantize op alive.
std::vector<const char*> cpu_ep = {kCpuExecutionProvider};
std::unique_ptr<NodeSelector> selector_no_16bit = std::make_unique<QDQ::DropQDQNodesSelector>(false,
false,
true,
providers);
cpu_ep);
qdq_selector_action_registry.RegisterSelectorAndAction(drop_action_no_int16_name,
{{"Resize", {}}},
std::move(selector_no_16bit),
Expand Down Expand Up @@ -143,7 +147,7 @@ void UnaryOpQDQRules(SelectorActionRegistry& qdq_selector_action_registry) {
std::unique_ptr<Action> action = std::make_unique<QDQ::UnaryReplaceWithQLinear>(kMSDomain);

#if !defined(ORT_MINIMAL_BUILD)
std::vector<const char*> providers = {kCpuExecutionProvider};
std::vector<const char*> providers = {kCpuExecutionProvider, kDmlExecutionProvider};
std::unique_ptr<NodeSelector> selector = std::make_unique<QDQ::UnarySelector>(providers);
qdq_selector_action_registry.RegisterSelectorAndAction(action_name,
{{"AveragePool", {}},
Expand Down

0 comments on commit a164228

Please sign in to comment.