From a958ec0cddbe1178dab49c9105fe9268b1d6f3ef Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 3 Oct 2017 21:40:52 -0400 Subject: [PATCH] P4 to Git Change 1466145 by todli@todli-ubuntu on 2017/10/03 21:32:44 SWDEV-126904 - rocm Pipe: fill device info for Pipe, and initialize Pipe memory object according to clk_pipe_t structure Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/rocm/rocdevice.cpp#67 edit [ROCm/clr commit: 55a4b40473a75333c3a140ae5c6234fd8494594c] --- .../clr/rocclr/runtime/device/rocm/rocdevice.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp index 8deb1789cf..34d78a2581 100644 --- a/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/runtime/device/rocm/rocdevice.cpp @@ -1126,6 +1126,10 @@ bool Device::populateOCLDeviceConstants() { info_.threadTraceEnable_ = false; } + info_.maxPipePacketSize_ = info_.maxMemAllocSize_; + info_.maxPipeActiveReservations_ = 16; + info_.maxPipeArgs_ = 16; + return true; } @@ -1316,6 +1320,14 @@ device::Memory* Device::createMemory(amd::Memory& owner) const { return nullptr; } + // Initialize if the memory is a pipe object + if (owner.getType() == CL_MEM_OBJECT_PIPE) { + // Pipe initialize in order read_idx, write_idx, end_idx. Refer clk_pipe_t structure. + // Init with 3 DWORDS for 32bit addressing and 6 DWORDS for 64bit + size_t pipeInit[3] = { 0, 0, owner.asPipe()->getMaxNumPackets() }; + xferMgr().writeBuffer((void *)pipeInit, *memory, amd::Coord3D(0), amd::Coord3D(sizeof(pipeInit))); + } + // Transfer data only if OCL context has one device. // Cache coherency layer will update data for multiple devices if (!memory->isHostMemDirectAccess() && owner.asImage() && (owner.parent() == nullptr) &&