[DML EP] Add QDQ fusions for DML and disable QDQ + Resample fusion (#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. -->
This commit is contained in:
Patrice Vignola 2024-10-16 12:40:39 -07:00 committed by GitHub
parent f9e623e4d1
commit a164228c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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),
@ -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", {}},