onnxruntime/winml/adapter/abi_custom_registry_impl.h
sumitsays 43c45ddd66
Update DirectML EP changes from DmlDev as of 2021-06-07 (#7987)
* Merged PR 6093117: Fix test_DynamicQuantizedLinear_max_adjusted_expanded by allowing Identity operator to run on non-float inputs

Motivation:
As part of the OnnxConformance Backend tests, DynamicQuantizedLinear_max_adjusted_expanded is failing.

Root Cause:
- The test model has `Identity` operator as one of the node. The input of this node is of non-float data type.
- In DML, `Identity` operator is registered as operator which requires floating input.
- As per `DirectMLSchema.h`, support for non-float input has been added for `Identity` operator in DML but the same has not been reflected in the `OperatorRegistration.cpp`.

Changes:
- Removed all traces of the requiresFloatFormatsForGraph flag from it's definition and usage. This flag was only used for Identity and it's related operator.
- Added null check for the graphOutput nodeArg in GraphDescBuilder.cpp to stop the crash of the test.

Related work items: #33076298

* Merged PR 6103324: Remove usage of non-generic error code (FWP_E_NULL_POINTER)

Motivation:
Addressing Dwayne comment on the previous PR. [Ref: [6093117](https://dev.azure.com/microsoft/WindowsAI/_git/onnxruntime/pullrequest/6093117?discussionId=44292162&path=%2Fonnxruntime%2Fcore%2Fproviders%2Fdml%2FDmlExecutionProvider%2Fsrc%2FGraphPartitioner.cpp)]

Changes:
Inside the DML EP, we should not use some other platform specific error codes. Instead we should a appropriate generic error code.

Related work items: #33076298

Co-authored-by: Sumit Agarwal <sumitagarwal@microsoft.com>
2021-06-11 11:09:48 -07:00

44 lines
1.8 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#ifdef USE_DML
#include "core/providers/dml/DmlExecutionProvider/src/AbiCustomRegistry.h"
namespace Windows::AI::MachineLearning::Adapter {
// An implementation of AbiCustomRegistry that emits telemetry events when operator kernels or schemas are registered.
class AbiCustomRegistryImpl : public AbiCustomRegistry {
public:
HRESULT STDMETHODCALLTYPE RegisterOperatorSetSchema(
const MLOperatorSetId* op_set_id,
int baseline_version,
const MLOperatorSchemaDescription* const* schema,
uint32_t schema_count,
_In_opt_ IMLOperatorTypeInferrer* type_inferrer,
_In_opt_ IMLOperatorShapeInferrer* shape_inferrer) const noexcept override;
HRESULT STDMETHODCALLTYPE RegisterOperatorKernel(
const MLOperatorKernelDescription* operator_kernel,
IMLOperatorKernelFactory* operator_kernel_factory,
_In_opt_ IMLOperatorShapeInferrer* shape_inferrer,
_In_opt_ IMLOperatorSupportQueryPrivate* supportQuery,
bool is_internal_operator,
bool can_alias_first_input,
bool supports_graph,
const uint32_t* required_input_count_for_graph = nullptr,
bool supports_64bit_directly = false,
bool allows_64bit_via_strides = false,
bool allows_64bit_via_strides_from_any_ep = false,
_In_reads_(constant_cpu_input_count) const uint32_t* required_constant_cpu_inputs = nullptr,
uint32_t constant_cpu_input_count = 0) const noexcept override;
HRESULT STDMETHODCALLTYPE RegisterOperatorKernel(
const MLOperatorKernelDescription* op_kernel,
IMLOperatorKernelFactory* operator_kernel_factory,
_In_opt_ IMLOperatorShapeInferrer* shape_inferrer) const noexcept override;
};
} // namespace Windows::AI::MachineLearning::Adapter
#endif USE_DML