Minor optimization: if a node has already been placed, there's no need to find a kernel for it. (#2417)

This commit is contained in:
Pranav Sharma 2019-11-17 20:08:33 -08:00 committed by GitHub
parent 5ab7041fa7
commit f268e69c79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1204,8 +1204,9 @@ CUDAExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph,
continue;
const auto& node = *p_node;
const auto* cuda_kernel_def = GetKernelRegistry()->TryFindKernel(node, Type());
if (cuda_kernel_def == nullptr || !node.GetExecutionProviderType().empty()) {
const KernelCreateInfo* cuda_kernel_def = nullptr;
if (!node.GetExecutionProviderType().empty() ||
!(cuda_kernel_def = GetKernelRegistry()->TryFindKernel(node, Type()))) {
// node is not in cuda exeuction provider if no kernel def found,
// or if other execution provider already assigned to it
defs_outside_cuda.insert(node.OutputDefs().cbegin(), node.OutputDefs().cend());