MCPcopy Create free account
hub / github.com/ROCm/clr / capturehipMemcpy2DToArrayAsync

Function capturehipMemcpy2DToArrayAsync

hipamd/src/hip_graph.cpp:579–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579hipError_t capturehipMemcpy2DToArrayAsync(hipStream_t& stream, hipArray_t& dst, size_t& wOffset,
580 size_t& hOffset, const void*& src, size_t& spitch,
581 size_t& width, size_t& height, hipMemcpyKind& kind) {
582 ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_API,
583 "[hipGraph] Current capture node Memcpy2DFromArray on stream : %p", stream);
584
585 // Skip zero-sized copies
586 if (width == 0 || height == 0) {
587 return hipSuccess;
588 }
589
590 HIP_RETURN_ONFAIL(hipMemcpy2DValidateArray(dst, wOffset, hOffset, width, height));
591 HIP_RETURN_ONFAIL(hipMemcpy2DValidateBuffer(src, spitch, width));
592
593 if (!hip::isValid(stream)) {
594 return hipErrorContextIsDestroyed;
595 }
596 hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
597 hip::GraphNode* pGraphNode;
598 hipMemcpy3DParms p = {};
599 memset(&p, 0, sizeof(p));
600 p.dstPos = {wOffset, hOffset, 0};
601 p.kind = kind;
602 p.dstPtr.ptr = nullptr;
603 p.dstArray = dst; // Ignored.
604
605 p.kind = kind;
606 p.srcPtr.ptr = const_cast<void*>(src);
607 p.srcArray = nullptr; // Ignored.
608 p.srcPtr.pitch = spitch;
609 p.extent = {width / hip::getElementSize(p.dstArray), height, 1};
610 hipError_t status =
611 ihipGraphAddMemcpyNode(&pGraphNode, s->GetCaptureGraph(), s->GetLastCapturedNodes().data(),
612 s->GetLastCapturedNodes().size(), &p, true, s->DeviceId());
613 if (status != hipSuccess) {
614 return status;
615 }
616 s->SetLastCapturedNode(pGraphNode);
617 return hipSuccess;
618}
619
620hipError_t capturehipMemcpyParam2DAsync(hipStream_t& stream, const hip_Memcpy2D*& pCopy) {
621 ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_API,

Callers

nothing calls this directly

Calls 11

hipMemcpy2DValidateArrayFunction · 0.85
memsetFunction · 0.85
getElementSizeFunction · 0.85
ihipGraphAddMemcpyNodeFunction · 0.85
GetCaptureGraphMethod · 0.80
DeviceIdMethod · 0.80
SetLastCapturedNodeMethod · 0.80
isValidFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected