mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-03 23:49:44 +00:00
SDL Native Warning errors in DML ep (#8396)
* Updated d3dx12.h with latest change. Fixed SDL native warning errors * Removed usage of IID_ID3D12Device variable, instead used __uuidof as in previous commit * Removed usage of NULL, used nullptr instead. Co-authored-by: Sumit Agarwal <sumitagarwal@microsoft.com>
This commit is contained in:
parent
bcd50afafb
commit
127b1f0d01
8 changed files with 1271 additions and 654 deletions
|
|
@ -267,7 +267,7 @@ IMLOperatorKernelCreationContext : public IMLOperatorAttributes
|
|||
//! For kernels registered with MLOperatorExecutionType::D3D12, executionObject will
|
||||
//! support the ID3D12GraphicsCommandList interface.
|
||||
STDMETHOD_(void, GetExecutionInterface)(
|
||||
_COM_Outptr_result_maybenull_ IUnknown** executionObject
|
||||
_Outptr_result_maybenull_ IUnknown** executionObject
|
||||
) const noexcept PURE;
|
||||
};
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ IMLOperatorTensor : IUnknown
|
|||
//! registered using MLOperatorExecutionType::D3D12. The dataInterface
|
||||
//! object supports the ID3D12Resource interface, and is a GPU buffer.
|
||||
STDMETHOD_(void, GetDataInterface)(
|
||||
_COM_Outptr_result_maybenull_ IUnknown** dataInterface
|
||||
_Outptr_result_maybenull_ IUnknown** dataInterface
|
||||
) noexcept PURE;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ void DmlCommandRecorder::ExecuteOperator(
|
|||
m_operationsRecordedInCurrentCommandList = true;
|
||||
|
||||
// Barrier all outputs.
|
||||
m_currentCommandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::UAV(nullptr));
|
||||
#pragma warning(suppress: 6387)
|
||||
m_currentCommandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::UAV(nullptr));
|
||||
}
|
||||
|
||||
void DmlCommandRecorder::CopyBufferRegion(
|
||||
|
|
@ -234,7 +235,8 @@ void DmlCommandRecorder::FillBufferWithPattern(
|
|||
m_operationsRecordedInCurrentCommandList = true;
|
||||
|
||||
// Barrier all outputs.
|
||||
m_currentCommandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::UAV(nullptr));
|
||||
#pragma warning(suppress: 6387)
|
||||
m_currentCommandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::UAV(nullptr));
|
||||
}
|
||||
|
||||
void DmlCommandRecorder::ExecuteCommandList(
|
||||
|
|
@ -296,7 +298,8 @@ void DmlCommandRecorder::ResourceBarrier(gsl::span<const D3D12_RESOURCE_BARRIER>
|
|||
|
||||
void DmlCommandRecorder::AddUAVBarrier()
|
||||
{
|
||||
auto barrier = CD3DX12_RESOURCE_BARRIER::UAV(nullptr);
|
||||
#pragma warning(suppress: 6387)
|
||||
auto barrier = CD3DX12_RESOURCE_BARRIER::UAV(nullptr);
|
||||
m_currentCommandList->ResourceBarrier(1, &barrier);
|
||||
m_operationsRecordedInCurrentCommandList = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,8 @@ namespace Dml
|
|||
}
|
||||
|
||||
static void CreateDmlKernelRegistry(
|
||||
_Outptr_ std::shared_ptr<onnxruntime::KernelRegistry>* registry,
|
||||
_Outptr_ std::shared_ptr<const InternalRegistrationInfoMap>* internalRegInfoMap)
|
||||
_Out_ std::shared_ptr<onnxruntime::KernelRegistry>* registry,
|
||||
_Out_ std::shared_ptr<const InternalRegistrationInfoMap>* internalRegInfoMap)
|
||||
{
|
||||
ComPtr<AbiCustomRegistry> abiRegistry = wil::MakeOrThrow<AbiCustomRegistry>();
|
||||
Dml::RegisterDmlOperators(abiRegistry.Get());
|
||||
|
|
@ -187,12 +187,16 @@ namespace Dml
|
|||
|
||||
HRESULT __stdcall ExecutionProviderImpl::GetD3DDevice(_COM_Outptr_ ID3D12Device** d3dDevice) const noexcept
|
||||
{
|
||||
return m_d3d12Device.CopyTo(d3dDevice);
|
||||
m_d3d12Device.CopyTo(d3dDevice);
|
||||
_Analysis_assume_(*d3dDevice != nullptr);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT __stdcall ExecutionProviderImpl::GetDmlDevice(_COM_Outptr_ IDMLDevice** dmlDevice) const noexcept
|
||||
{
|
||||
return m_dmlDevice.CopyTo(dmlDevice);
|
||||
m_dmlDevice.CopyTo(dmlDevice);
|
||||
_Analysis_assume_(*dmlDevice != nullptr);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT __stdcall ExecutionProviderImpl::ExecuteCommandList(
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -141,11 +141,11 @@ namespace GraphKernelHelper
|
|||
const Dml::GraphDescBuilder::GraphDesc& graphDesc,
|
||||
const onnxruntime::ConstPointerContainer<std::vector<onnxruntime::NodeArg*>>& fusedNodeInputDefs,
|
||||
_Out_ std::vector<bool>& inputsUsed,
|
||||
_Out_ std::vector<DML_BUFFER_BINDING>& initInputBindings,
|
||||
_Out_ std::vector<ComPtr<ID3D12Resource>>& initInputResources,
|
||||
_Out_ std::vector<ComPtr<ID3D12Resource>>& nonOwnedGraphInputsFromInitializers,
|
||||
_Out_ std::vector<ComPtr<ID3D12Resource>>& initializeResourceRefs,
|
||||
_Out_opt_ std::vector<std::vector<std::byte>>* inputRawData,
|
||||
_Inout_ std::vector<DML_BUFFER_BINDING>& initInputBindings,
|
||||
_Inout_ std::vector<ComPtr<ID3D12Resource>>& initInputResources,
|
||||
_Inout_ std::vector<ComPtr<ID3D12Resource>>& nonOwnedGraphInputsFromInitializers,
|
||||
_Inout_ std::vector<ComPtr<ID3D12Resource>>& initializeResourceRefs,
|
||||
_Inout_opt_ std::vector<std::vector<std::byte>>* inputRawData,
|
||||
_Inout_ std::unordered_map<std::string, onnx::TensorProto>& transferredInitializerMap)
|
||||
{
|
||||
const uint32_t graphInputCount = kernelInfo.GetInputCount();
|
||||
|
|
@ -279,11 +279,11 @@ namespace GraphKernelHelper
|
|||
const Dml::GraphDescBuilder::GraphDesc& graphDesc,
|
||||
_Out_ DML_GRAPH_DESC& dmlGraphDesc,
|
||||
const onnxruntime::OpKernelInfo& kernelInfo,
|
||||
_Out_ std::vector<DML_OPERATOR_GRAPH_NODE_DESC>& dmlOperatorGraphNodes,
|
||||
_Out_ std::vector<DML_GRAPH_NODE_DESC>& dmlGraphNodes,
|
||||
_Out_ std::vector<DML_GRAPH_EDGE_DESC>& dmlInputEdges,
|
||||
_Out_ std::vector<DML_GRAPH_EDGE_DESC>& dmlOutputEdges,
|
||||
_Out_ std::vector<DML_GRAPH_EDGE_DESC>& dmlIntermediateEdges)
|
||||
_Inout_ std::vector<DML_OPERATOR_GRAPH_NODE_DESC>& dmlOperatorGraphNodes,
|
||||
_Inout_ std::vector<DML_GRAPH_NODE_DESC>& dmlGraphNodes,
|
||||
_Inout_ std::vector<DML_GRAPH_EDGE_DESC>& dmlInputEdges,
|
||||
_Inout_ std::vector<DML_GRAPH_EDGE_DESC>& dmlOutputEdges,
|
||||
_Inout_ std::vector<DML_GRAPH_EDGE_DESC>& dmlIntermediateEdges)
|
||||
{
|
||||
const uint32_t graphInputCount = kernelInfo.GetInputCount();
|
||||
|
||||
|
|
|
|||
|
|
@ -52,22 +52,22 @@ namespace GraphKernelHelper
|
|||
const Dml::GraphDescBuilder::GraphDesc& graphDesc,
|
||||
const onnxruntime::ConstPointerContainer<std::vector<onnxruntime::NodeArg*>>& fusedNodeInputDefs,
|
||||
_Out_ std::vector<bool>& inputsUsed,
|
||||
_Out_ std::vector<DML_BUFFER_BINDING>& initInputBindings,
|
||||
_Out_ std::vector<ComPtr<ID3D12Resource>>& initInputResources,
|
||||
_Out_ std::vector<ComPtr<ID3D12Resource>>& nonOwnedGraphInputsFromInitializers,
|
||||
_Out_ std::vector<ComPtr<ID3D12Resource>>& initializeResourceRefs,
|
||||
_Out_opt_ std::vector<std::vector<std::byte>>* inputRawData,
|
||||
_Inout_ std::vector<DML_BUFFER_BINDING>& initInputBindings,
|
||||
_Inout_ std::vector<ComPtr<ID3D12Resource>>& initInputResources,
|
||||
_Inout_ std::vector<ComPtr<ID3D12Resource>>& nonOwnedGraphInputsFromInitializers,
|
||||
_Inout_ std::vector<ComPtr<ID3D12Resource>>& initializeResourceRefs,
|
||||
_Inout_opt_ std::vector<std::vector<std::byte>>* inputRawData,
|
||||
_Inout_ std::unordered_map<std::string, onnx::TensorProto>& transferredInitializerMap);
|
||||
|
||||
void ConvertGraphDesc(
|
||||
const Dml::GraphDescBuilder::GraphDesc& graphDesc,
|
||||
_Out_ DML_GRAPH_DESC& dmlGraphDesc,
|
||||
const onnxruntime::OpKernelInfo& kernelInfo,
|
||||
_Out_ std::vector<DML_OPERATOR_GRAPH_NODE_DESC>& dmlOperatorGraphNodes,
|
||||
_Out_ std::vector<DML_GRAPH_NODE_DESC>& dmlGraphNodes,
|
||||
_Out_ std::vector<DML_GRAPH_EDGE_DESC>& dmlInputEdges,
|
||||
_Out_ std::vector<DML_GRAPH_EDGE_DESC>& dmlOutputEdges,
|
||||
_Out_ std::vector<DML_GRAPH_EDGE_DESC>& dmlIntermediateEdges);
|
||||
_Inout_ std::vector<DML_OPERATOR_GRAPH_NODE_DESC>& dmlOperatorGraphNodes,
|
||||
_Inout_ std::vector<DML_GRAPH_NODE_DESC>& dmlGraphNodes,
|
||||
_Inout_ std::vector<DML_GRAPH_EDGE_DESC>& dmlInputEdges,
|
||||
_Inout_ std::vector<DML_GRAPH_EDGE_DESC>& dmlOutputEdges,
|
||||
_Inout_ std::vector<DML_GRAPH_EDGE_DESC>& dmlIntermediateEdges);
|
||||
|
||||
std::string GetFusedNodeArgNameMatchingGraph(const std::string& fusedNodeArgeName);
|
||||
|
||||
|
|
|
|||
|
|
@ -1091,13 +1091,13 @@ namespace OperatorHelper
|
|||
|
||||
ML_CHECK_VALID_ARGUMENT(inputShape.size() == dimensionCount, "Mismatch between input tensor shape and string equation label count.");
|
||||
|
||||
for (uint32_t i = 0; i < dimensionCount; ++i)
|
||||
for (uint32_t j = 0; j < dimensionCount; ++j)
|
||||
{
|
||||
// If this is the first time seeing this label, then record the size.
|
||||
// Otherwise any following occurrences of the label must match sizes.
|
||||
// e.g. Given "ij,ji", both i's and both j's must match dimension sizes.
|
||||
uint32_t dimensionSize = inputShape[i];
|
||||
uint32_t labelIndex = labelIndices[i];
|
||||
uint32_t dimensionSize = inputShape[j];
|
||||
uint32_t labelIndex = labelIndices[j];
|
||||
assert(labelIndex < labelSizes.size());
|
||||
|
||||
if (labelSizes[labelIndex] == INT_MIN)
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ API_IMPL_END
|
|||
}
|
||||
|
||||
ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProviderEx_DML, _In_ OrtSessionOptions* options,
|
||||
IDMLDevice* dml_device, ID3D12CommandQueue* cmd_queue) {
|
||||
_In_ IDMLDevice* dml_device, _In_ ID3D12CommandQueue* cmd_queue) {
|
||||
API_IMPL_BEGIN
|
||||
options->provider_factories.push_back(onnxruntime::CreateExecutionProviderFactory_DML(dml_device,
|
||||
cmd_queue));
|
||||
|
|
|
|||
Loading…
Reference in a new issue