From d0e33d20787b6984b14ed43f7fd8557ca08824d7 Mon Sep 17 00:00:00 2001
From: aamajumder <150728138+aamajumder@users.noreply.github.com>
Date: Mon, 22 Apr 2024 12:01:59 -0700
Subject: [PATCH] [DML EP] Register opset 20 operators (#20092)
### Description
This PR registers the following opset 20 operators to the DML EP:
-IsNaN-20
-IsInf-20
-ReduceMax-20
### Motivation and Context
---
docs/OperatorKernels.md | 9 ++++++---
.../src/Operators/OperatorRegistration.cpp | 3 +++
.../dml/OperatorAuthorHelper/OperatorVersions.h | 7 +++++++
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/docs/OperatorKernels.md b/docs/OperatorKernels.md
index 3c739d89bf..f54f264255 100644
--- a/docs/OperatorKernels.md
+++ b/docs/OperatorKernels.md
@@ -1050,8 +1050,10 @@ Do not modify directly.*
|||7+|**B** = tensor(bool)
**V** = tensor(bfloat16), tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8)|
|ImageScaler|*in* input:**T**
*out* output:**T**|1+|**T** = tensor(float), tensor(float16)|
|InstanceNormalization|*in* input:**T**
*in* scale:**T**
*in* B:**T**
*out* output:**T**|6+|**T** = tensor(float), tensor(float16)|
-|IsInf|*in* X:**T1**
*out* Y:**T2**|10+|**T1** = tensor(float)
**T2** = tensor(bool)|
-|IsNaN|*in* X:**T1**
*out* Y:**T2**|13+|**T1** = tensor(float), tensor(float16)
**T2** = tensor(bool)|
+|IsInf|*in* X:**T1**
*out* Y:**T2**|20+|**T1** = tensor(float)
**T2** = tensor(bool)|
+|||10+|**T1** = tensor(float)
**T2** = tensor(bool)|
+|IsNaN|*in* X:**T1**
*out* Y:**T2**|20+|**T1** = tensor(float), tensor(float16)
**T2** = tensor(bool)|
+|||13+|**T1** = tensor(float), tensor(float16)
**T2** = tensor(bool)|
|||9+|**T1** = tensor(float), tensor(float16)
**T2** = tensor(bool)|
|LRN|*in* X:**T**
*out* Y:**T**|13+|**T** = tensor(float), tensor(float16)|
|||1+|**T** = tensor(float), tensor(float16)|
@@ -1158,7 +1160,8 @@ Do not modify directly.*
|||13+|**T** = tensor(float), tensor(float16)|
|||11+|**T** = tensor(float), tensor(float16)|
|||1+|**T** = tensor(float), tensor(float16)|
-|ReduceMax|*in* data:**T**
*in* axes:**tensor(int64)**
*out* reduced:**T**
or
*in* data:**T**
*out* reduced:**T**|18+|**T** = tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64)|
+|ReduceMax|*in* data:**T**
*in* axes:**tensor(int64)**
*out* reduced:**T**
or
*in* data:**T**
*out* reduced:**T**|20+|**T** = tensor(bool), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8)|
+|||18+|**T** = tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64)|
|||13+|**T** = tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8)|
|||12+|**T** = tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8)|
|||11+|**T** = tensor(float), tensor(float16)|
diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorRegistration.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorRegistration.cpp
index a2338a6da9..96949e777f 100644
--- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorRegistration.cpp
+++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorRegistration.cpp
@@ -924,6 +924,7 @@ constexpr static OperatorRegistrationInformation operatorRegistrationInformation
{REG_INFO( 13, Sign, typeNameListDefault, supportedTypeListFloat16to32Ints8to64, DmlGraphSupport::Supported)},
{REG_INFO( 9, IsNaN, typeNameListTwo, supportedTypeListIsNan, DmlGraphSupport::Supported)},
{REG_INFO( 13, IsNaN, typeNameListTwo, supportedTypeListIsNan, DmlGraphSupport::Supported)},
+ {REG_INFO( 20, IsNaN, typeNameListTwo, supportedTypeListIsNan, DmlGraphSupport::Supported)},
{REG_INFO( 9, Sinh, typeNameListDefault, supportedTypeListFloat16to32, DmlGraphSupport::Supported)},
{REG_INFO( 9, Cosh, typeNameListDefault, supportedTypeListFloat16to32, DmlGraphSupport::Supported)},
{REG_INFO( 9, Asinh, typeNameListDefault, supportedTypeListFloat16to32, DmlGraphSupport::Supported)},
@@ -970,6 +971,7 @@ constexpr static OperatorRegistrationInformation operatorRegistrationInformation
{REG_INFO( 12, ReduceMax, typeNameListDefault, supportedTypeListFloat16to32Ints8to64, DmlGraphSupport::Supported)},
{REG_INFO( 13, ReduceMax, typeNameListDefault, supportedTypeListFloat16to32Ints8to64, DmlGraphSupport::Supported)},
{REG_INFO( 18, ReduceMax, typeNameListDefault, supportedTypeListFloat16to32Ints32to64, DmlGraphSupport::Supported, requiredConstantCpuInputs(1))},
+ {REG_INFO( 20, ReduceMax, typeNameListDefault, supportedTypeListAllScalars, DmlGraphSupport::Supported, requiredConstantCpuInputs(1))},
{REG_INFO( 7, ReduceMin, typeNameListDefault, supportedTypeListFloat16to32, DmlGraphSupport::Supported)},
{REG_INFO( 11, ReduceMin, typeNameListDefault, supportedTypeListFloat16to32, DmlGraphSupport::Supported)},
{REG_INFO( 12, ReduceMin, typeNameListDefault, supportedTypeListFloat16to32Ints8to64, DmlGraphSupport::Supported)},
@@ -1113,6 +1115,7 @@ constexpr static OperatorRegistrationInformation operatorRegistrationInformation
{REG_INFO_MS( 1, QLinearConcat, typeNameListQLinearConcat, supportedTypeListQLinearConcat, DmlGraphSupport::Supported)},
{REG_INFO( 10, IsInf, typeNameListTwo, supportedTypeListIsInf, DmlGraphSupport::Supported)},
+ {REG_INFO( 20, IsInf, typeNameListTwo, supportedTypeListIsInf, DmlGraphSupport::Supported)},
{REG_INFO( 10, Mod, typeNameListDefault, supportedTypeListNumericDefault, DmlGraphSupport::Supported)},
{REG_INFO( 13, Mod, typeNameListDefault, supportedTypeListNumericDefault, DmlGraphSupport::Supported)},
{REG_INFO( 11, BitShift, typeNameListDefault, supportedTypeListUInt8to64, DmlGraphSupport::Supported)},
diff --git a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorVersions.h b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorVersions.h
index 896f18c507..cd188761b2 100644
--- a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorVersions.h
+++ b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorVersions.h
@@ -429,6 +429,13 @@ namespace OperatorHelper
static const int sc_sinceVer_Size = 19;
}
+ namespace OnnxOperatorSet20
+ {
+ static const int sc_sinceVer_IsNaN = 20;
+ static const int sc_sinceVer_IsInf = 20;
+ static const int sc_sinceVer_ReduceMax = 20;
+ }
+
namespace MsftOperatorSet1
{
static const int sc_sinceVer_DmlFusedConv = 1;