mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-06 00:03:22 +00:00
[DML EP] Expose NPU macro via build command (#20306)
### Description This fixes following things: - Expose `ENABLE_NPU_ADAPTER_ENUMERATION` macro via build command, so that a user can enable NPU support for DML EP seamlessly. - Add keyword `_dmlEp_` as part of the node name, which would be useful for debugging purpose. ### 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:
parent
76434907fb
commit
f664f91298
2 changed files with 9 additions and 6 deletions
|
|
@ -848,6 +848,9 @@ if (onnxruntime_USE_DML)
|
|||
list(APPEND ORT_PROVIDER_FLAGS -DUSE_DML=1)
|
||||
list(APPEND ORT_PROVIDER_CMAKE_FLAGS -Donnxruntime_USE_DML=1)
|
||||
list(APPEND ONNXRUNTIME_PROVIDER_NAMES dml)
|
||||
if(onnxruntime_ENABLE_NPU_ADAPTER_ENUMERATION)
|
||||
list(APPEND ORT_PROVIDER_FLAGS -DENABLE_NPU_ADAPTER_ENUMERATION=1)
|
||||
endif()
|
||||
endif()
|
||||
if (onnxruntime_USE_MIGRAPHX)
|
||||
list(APPEND ORT_PROVIDER_FLAGS -DUSE_MIGRAPHX=1)
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ namespace Dml::GraphDescBuilder
|
|||
|
||||
uint32_t SetAndGetDmlGraphNodeIndex(
|
||||
const uint32_t operatorDmlGraphNodeIndex,
|
||||
const std::string& nodeNamePrefix,
|
||||
const onnxruntime::Node& node,
|
||||
AbstractOperatorDesc& operatorDesc,
|
||||
/*in_out*/std::unordered_map<uint32_t, uint32_t>& operatorDmlGraphToDmlGraphNodeIndexMap,
|
||||
/*in_out*/std::vector<DmlSerializedGraphNode>& dmlGraphNodes)
|
||||
|
|
@ -205,7 +205,7 @@ namespace Dml::GraphDescBuilder
|
|||
return iter->second;
|
||||
}
|
||||
operatorDmlGraphToDmlGraphNodeIndexMap[operatorDmlGraphNodeIndex] = static_cast<uint32_t>(dmlGraphNodes.size());
|
||||
dmlGraphNodes.push_back({operatorDesc, nodeNamePrefix + std::to_string(operatorDmlGraphNodeIndex)});
|
||||
dmlGraphNodes.push_back({operatorDesc, GetUniqueNodeName(node) + "_dmlEp_" + std::to_string(operatorDmlGraphNodeIndex)});
|
||||
return operatorDmlGraphToDmlGraphNodeIndexMap[operatorDmlGraphNodeIndex];
|
||||
}
|
||||
|
||||
|
|
@ -432,7 +432,7 @@ namespace Dml::GraphDescBuilder
|
|||
{
|
||||
uint32_t dmlGraphNodeIndex = SetAndGetDmlGraphNodeIndex(
|
||||
operatorDmlGraphInputEdge.ToNodeIndex,
|
||||
node.Name(),
|
||||
node,
|
||||
*operatorDmlGraphCreateInfo.nodes[operatorDmlGraphInputEdge.ToNodeIndex],
|
||||
operatorDmlGraphToDmlGraphNodeIndexMap,
|
||||
dmlGraphNodes);
|
||||
|
|
@ -508,13 +508,13 @@ namespace Dml::GraphDescBuilder
|
|||
DmlIntermediateSerializedGraphEdge edge = {};
|
||||
uint32_t shiftedFromNodeIndex = SetAndGetDmlGraphNodeIndex(
|
||||
operatorGraphIntermediateEdge.FromNodeIndex,
|
||||
node.Name(),
|
||||
node,
|
||||
*operatorDmlGraphCreateInfo.nodes[operatorGraphIntermediateEdge.FromNodeIndex],
|
||||
operatorDmlGraphToDmlGraphNodeIndexMap,
|
||||
dmlGraphNodes);
|
||||
uint32_t shiftedToNodeIndex = SetAndGetDmlGraphNodeIndex(
|
||||
operatorGraphIntermediateEdge.ToNodeIndex,
|
||||
node.Name(),
|
||||
node,
|
||||
*operatorDmlGraphCreateInfo.nodes[operatorGraphIntermediateEdge.ToNodeIndex],
|
||||
operatorDmlGraphToDmlGraphNodeIndexMap,
|
||||
dmlGraphNodes);
|
||||
|
|
@ -535,7 +535,7 @@ namespace Dml::GraphDescBuilder
|
|||
{
|
||||
uint32_t shiftedNodeIndex = SetAndGetDmlGraphNodeIndex(
|
||||
operatorGraphOutputEdge.FromNodeIndex,
|
||||
node.Name(),
|
||||
node,
|
||||
*operatorDmlGraphCreateInfo.nodes[operatorGraphOutputEdge.FromNodeIndex],
|
||||
operatorDmlGraphToDmlGraphNodeIndexMap,
|
||||
dmlGraphNodes);
|
||||
|
|
|
|||
Loading…
Reference in a new issue