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

Function capturehipMemcpy2DFromArrayAsync

hipamd/src/hip_graph.cpp:537–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537hipError_t capturehipMemcpy2DFromArrayAsync(hipStream_t& stream, void*& dst, size_t& dpitch,
538 hipArray_const_t& src, size_t& wOffsetSrc,
539 size_t& hOffsetSrc, size_t& width, size_t& height,
540 hipMemcpyKind& kind) {
541 ClPrint(amd::LOG_DETAIL_DEBUG, amd::LOG_API,
542 "[hipGraph] Current capture node Memcpy2DFromArray on stream : %p", stream);
543
544 // Skip zero-sized copies
545 if (width == 0 || height == 0) {
546 return hipSuccess;
547 }
548
549 HIP_RETURN_ONFAIL(hipMemcpy2DValidateArray(src, wOffsetSrc, hOffsetSrc, width, height));
550 HIP_RETURN_ONFAIL(hipMemcpy2DValidateBuffer(dst, dpitch, width));
551
552 if (!hip::isValid(stream)) {
553 return hipErrorContextIsDestroyed;
554 }
555 hip::Stream* s = reinterpret_cast<hip::Stream*>(stream);
556 hip::GraphNode* pGraphNode;
557 hipMemcpy3DParms p = {};
558 memset(&p, 0, sizeof(p));
559 p.srcPos = {wOffsetSrc, hOffsetSrc, 0};
560 p.kind = kind;
561 p.srcPtr.ptr = nullptr;
562 p.srcArray = const_cast<hipArray*>(src); // Ignored.
563
564 p.kind = kind;
565 p.dstPtr.ptr = dst;
566 p.dstArray = nullptr; // Ignored.
567 p.dstPtr.pitch = dpitch;
568 p.extent = {width / hip::getElementSize(p.srcArray), height, 1};
569 hipError_t status =
570 ihipGraphAddMemcpyNode(&pGraphNode, s->GetCaptureGraph(), s->GetLastCapturedNodes().data(),
571 s->GetLastCapturedNodes().size(), &p, true, s->DeviceId());
572 if (status != hipSuccess) {
573 return status;
574 }
575 s->SetLastCapturedNode(pGraphNode);
576 return hipSuccess;
577}
578
579hipError_t capturehipMemcpy2DToArrayAsync(hipStream_t& stream, hipArray_t& dst, size_t& wOffset,
580 size_t& hOffset, const void*& src, size_t& spitch,

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