diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/AbiCustomRegistry.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/AbiCustomRegistry.cpp index 571778398a..c9bfe54571 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/AbiCustomRegistry.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/AbiCustomRegistry.cpp @@ -28,6 +28,7 @@ onnx::OpSchema::FormalParameterOption AbiCustomRegistry::ConvertFormalParameterO default: THROW_HR(E_NOTIMPL); + return onnx::OpSchema::FormalParameterOption::Single; } } diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/DmlCommon.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/DmlCommon.cpp index 70a29a2d3d..37eb719f08 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/DmlCommon.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/DmlCommon.cpp @@ -87,7 +87,9 @@ MLOperatorTensorDataType GetMlDataTypeFromDmlDataType(DML_TENSOR_DATA_TYPE tenso case DML_TENSOR_DATA_TYPE_INT64: return MLOperatorTensorDataType::Int64; case DML_TENSOR_DATA_TYPE_FLOAT64: return MLOperatorTensorDataType::Double; - default: ML_INVALID_ARGUMENT("Unknown DML_TENSOR_DATA_TYPE."); + default: + ML_INVALID_ARGUMENT("Unknown DML_TENSOR_DATA_TYPE."); + return MLOperatorTensorDataType::Undefined; }; } diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiHelpers.h b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiHelpers.h index 4689bae39d..b86aa302ec 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiHelpers.h +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiHelpers.h @@ -56,7 +56,9 @@ struct ActivationOperatorDesc case DML_OPERATOR_ACTIVATION_TANH: return { activationType, ¶ms.tanh }; case DML_OPERATOR_ACTIVATION_THRESHOLDED_RELU: return { activationType, ¶ms.thresholdedRelu }; case DML_OPERATOR_ACTIVATION_SHRINK: return { activationType, ¶ms.shrink }; - default: THROW_HR(E_INVALIDARG); + default: + THROW_HR(E_INVALIDARG); + return { activationType, ¶ms.relu }; } } }; @@ -206,9 +208,9 @@ private: ~DynamicBucket() { - if (data) + if (this->data) { - (void)VirtualFree(data, 0, MEM_RELEASE); + (void)VirtualFree(this->data, 0, MEM_RELEASE); } } }; diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiTraits.h b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiTraits.h index 2b177faeda..12cf34b974 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiTraits.h +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/ApiTraits.h @@ -2159,6 +2159,7 @@ auto OperatorTypeVisitor(DML_OPERATOR_TYPE type, Visitor&& visitor, Ts&&... args default: THROW_HR(E_INVALIDARG); + return std::invoke(std::forward(visitor), DML_ACTIVATION_RELU_OPERATOR_DESC{}, std::forward(args)...); } } diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/GeneratedSchemaHelpers.h b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/GeneratedSchemaHelpers.h index 7630e98489..0fcc3336c0 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/GeneratedSchemaHelpers.h +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/External/DirectMLHelpers/GeneratedSchemaHelpers.h @@ -1484,7 +1484,9 @@ inline const DML_OPERATOR_SCHEMA& GetSchema(DML_OPERATOR_TYPE operatorType) case DML_OPERATOR_ACTIVATION_THRESHOLDED_RELU: return DML_ACTIVATION_THRESHOLDED_RELU_OPERATOR_SCHEMA; case DML_OPERATOR_ACTIVATION_SHRINK: return DML_ACTIVATION_SHRINK_OPERATOR_SCHEMA; - default: THROW_HR(E_INVALIDARG); + default: + THROW_HR(E_INVALIDARG); + return DML_ACTIVATION_RELU_OPERATOR_SCHEMA; } } @@ -2052,7 +2054,11 @@ inline AbstractOperatorDesc ConvertOperatorDesc(const DML_OPERATOR_DESC& opDesc) return AbstractOperatorDesc( &DML_ACTIVATION_SHRINK_OPERATOR_SCHEMA, GetFields(*static_cast(opDesc.Desc))); - default: THROW_HR(E_INVALIDARG); + default: + THROW_HR(E_INVALIDARG); + return AbstractOperatorDesc( + &DML_ACTIVATION_RELU_OPERATOR_SCHEMA, + GetFields(*static_cast(opDesc.Desc))); } } diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/GraphDescBuilder.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/GraphDescBuilder.cpp index eddea1e78b..d9b8687b83 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/GraphDescBuilder.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/GraphDescBuilder.cpp @@ -25,6 +25,7 @@ namespace Dml::GraphDescBuilder assert(false); THROW_HR(E_UNEXPECTED); + return node.OutputDefs()[0]->Name(); } GraphDesc BuildGraphDesc( diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp index 30e96e0621..3085765edb 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/MLOperatorAuthorImpl.cpp @@ -43,6 +43,7 @@ size_t AttributeValue::ElementCount() const { // The type is validated when default attributes are registered assert(false); THROW_HR(E_FAIL); + return 0; } } @@ -238,6 +239,7 @@ struct MLTypeTraits { ML_TENSOR_TYPE_CASE(onnxruntime::MLFloat16); THROW_HR(E_NOTIMPL); + return MLOperatorTensorDataType::Undefined; } #undef ML_TENSOR_TYPE_CASE @@ -264,6 +266,7 @@ onnxruntime::MLDataType ToTensorDataType(::MLOperatorTensorDataType type) { ML_TENSOR_TYPE_CASE(onnxruntime::MLFloat16); THROW_HR(E_NOTIMPL); + return onnxruntime::DataTypeImpl::GetTensorType(); } ::MLOperatorTensorDataType ToMLTensorDataType(onnx::TensorProto_DataType type) { @@ -315,6 +318,7 @@ onnxruntime::MLDataType ToTensorDataType(::MLOperatorTensorDataType type) { default: THROW_HR(E_NOTIMPL); + return MLOperatorTensorDataType::Undefined; } } @@ -389,6 +393,7 @@ std::string ToTypeString(MLOperatorEdgeDescription desc) { default: THROW_HR(E_NOTIMPL); + return ""; } } @@ -594,7 +599,7 @@ HRESULT OpNodeInfoWrapper::GetAttributeHelper( uint32_t elementByteSize, void* value) const { using elementType_t = typename MLAttributeTypeTraits::Type; - static_assert(!typename MLAttributeTypeTraits::IsArray, "This function only works for simple non-array types."); + static_assert(!MLAttributeTypeTraits::IsArray, "This function only works for simple non-array types."); ML_CHECK_BOOL(sizeof(elementType_t) == elementByteSize); THROW_IF_NOT_OK(m_impl->template GetAttr(name, static_cast(value))); return S_OK; diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp index 50499ce207..c67beb596d 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/DmlOperatorRecurrentNeuralNetwork.cpp @@ -62,6 +62,7 @@ public: if (direction == AttrValue::DirectionBidirectional) { return DML_RECURRENT_NETWORK_DIRECTION_BIDIRECTIONAL; } ML_INVALID_ARGUMENT("Unsupported direction"); // throws + return DML_RECURRENT_NETWORK_DIRECTION_FORWARD; } void InitActivationDescs(const MLOperatorKernelCreationContext& kernelInfo, _Out_ std::vector& descs, gsl::span defaultActivations) diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorUtility.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorUtility.cpp index 5e2cfd4ccc..faf7dafe34 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorUtility.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/Operators/OperatorUtility.cpp @@ -436,6 +436,7 @@ namespace Dml return *index; } ML_INVALID_ARGUMENT("Unknown interpolation mode"); + return (DML_INTERPOLATION_MODE)0; } DML_DEPTH_SPACE_ORDER MapStringToDepthSpaceMode(std::string_view mode) @@ -450,6 +451,7 @@ namespace Dml return *index; } ML_INVALID_ARGUMENT("Unknown depth/space order"); + return (DML_DEPTH_SPACE_ORDER)0; } } // namespace Dml diff --git a/onnxruntime/core/providers/dml/OperatorAuthorHelper/MLOperatorAuthorHelper.h b/onnxruntime/core/providers/dml/OperatorAuthorHelper/MLOperatorAuthorHelper.h index a6615bd815..878249d044 100644 --- a/onnxruntime/core/providers/dml/OperatorAuthorHelper/MLOperatorAuthorHelper.h +++ b/onnxruntime/core/providers/dml/OperatorAuthorHelper/MLOperatorAuthorHelper.h @@ -119,7 +119,9 @@ inline size_t GetByteSizeFromMlDataType(MLOperatorTensorDataType tensorDataType) case MLOperatorTensorDataType::Complex64: return 8; case MLOperatorTensorDataType::Complex128: return 16; case MLOperatorTensorDataType::Undefined: - default: THROW_HR(E_INVALIDARG); + default: + THROW_HR(E_INVALIDARG); + return 0; }; } diff --git a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp index eeeced230b..c558f89776 100644 --- a/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp +++ b/onnxruntime/core/providers/dml/OperatorAuthorHelper/OperatorHelper.cpp @@ -163,7 +163,9 @@ namespace OperatorHelper case MLOperatorTensorDataType::Complex64: return static_cast(*reinterpret_cast(p)); // Read the real component. case MLOperatorTensorDataType::Complex128: return static_cast(*reinterpret_cast(p)); // Read the real component. case MLOperatorTensorDataType::Undefined: - default: ML_INVALID_ARGUMENT("Unknown MLOperatorTensorDataType."); + default: + ML_INVALID_ARGUMENT("Unknown MLOperatorTensorDataType."); + return 0; }; } @@ -187,7 +189,9 @@ namespace OperatorHelper case MLOperatorTensorDataType::Complex64: return static_cast(*reinterpret_cast(p)); // Read the real component. case MLOperatorTensorDataType::Complex128: return static_cast(*reinterpret_cast(p)); // Read the real component. case MLOperatorTensorDataType::Undefined: - default: ML_INVALID_ARGUMENT("Unknown MLOperatorTensorDataType."); + default: + ML_INVALID_ARGUMENT("Unknown MLOperatorTensorDataType."); + return 0.0; }; }