From dd86e3be10b58f6240620dbc8146b0619f84ddbd Mon Sep 17 00:00:00 2001 From: Dwayne Robinson Date: Fri, 24 Apr 2020 01:12:50 +0000 Subject: [PATCH] Merged PR 4596882: Fix assert in ReadbackFromGpu `ExecutionProviderImpl::CopyTensors` calls `ReadbackFromGpu`, and depending on the mix of source/destination tensors (CPU/CPU, CPU/GPU, GPU/CPU, GPU/GPU), there can be anywhere from 0 to multiple tensors to copy. Copying 0 tensors is not an assertable failure and should just be a nop (tests work fine in release build). This assert reproes locally when running Pad tests (and some other operator tests too). --- .../dml/DmlExecutionProvider/src/ReadbackHeap.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp index a02f0e49c7..d3765acc34 100644 --- a/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp +++ b/onnxruntime/core/providers/dml/DmlExecutionProvider/src/ReadbackHeap.cpp @@ -104,7 +104,13 @@ namespace Dml gsl::span src, D3D12_RESOURCE_STATES srcState) { - assert(!dst.empty()); + assert(dst.size() == src.size()); + assert(dstSizes.size() == src.size()); + + if (dst.empty()) + { + return; + } uint32_t totalSize = 0; for (auto size : dstSizes)