From 7acdb2390f8451ce716c2af97874dca27130c818 Mon Sep 17 00:00:00 2001 From: foreman Date: Thu, 2 Jun 2016 14:15:36 -0400 Subject: [PATCH] P4 to Git Change 1275749 by wchau@wchau_WIN_OCL_HSA on 2016/06/02 13:38:16 SWDEV-89502 - [OCL] Support AMD DVR Core functionalities. Add OCL support for DOPP for desktop and present texture (OCL RT changes) Affected files ... ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_gl.cpp#50 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_svm.cpp#17 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl1.2/CL/cl_ext.h#11 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#25 edit ... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.1/CL/cl_ext.h#4 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#316 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#124 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#403 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/platform/kernel.hpp#16 edit --- rocclr/runtime/device/gpu/gpukernel.cpp | 12 ++++++++--- rocclr/runtime/device/gpu/gpukernel.hpp | 3 ++- rocclr/runtime/device/gpu/gpuvirtual.cpp | 20 +++++++++++++++---- .../device/gpu/gslbe/src/rt/GSLDeviceGL.cpp | 11 ++++++++++ rocclr/runtime/platform/kernel.hpp | 11 +++++++++- 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/rocclr/runtime/device/gpu/gpukernel.cpp b/rocclr/runtime/device/gpu/gpukernel.cpp index 4aa8b539ae..50b5d5c827 100644 --- a/rocclr/runtime/device/gpu/gpukernel.cpp +++ b/rocclr/runtime/device/gpu/gpukernel.cpp @@ -1567,7 +1567,7 @@ Kernel::loadParameters( } bool -Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun) const +Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun, bool lastDoppCmd) const { const VirtualGPU::CalVirtualDesc* dispatch = gpu.cal(); @@ -1576,7 +1576,7 @@ Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun) const gpu.eventBegin(MainEngine); gpu.rs()->Dispatch(gpu.cs(), &dispatch->gridBlock, &dispatch->partialGridBlock, - &dispatch->gridSize, dispatch->localSize, gpu.vmMems(), dispatch->memCount_); + &dispatch->gridSize, dispatch->localSize, gpu.vmMems(), dispatch->memCount_, lastDoppCmd); gpu.eventEnd(MainEngine, *calEvent); // Unbind all resources @@ -1889,6 +1889,12 @@ Kernel::setArgument( copyImageConstants(gpuMem->owner()->asImage(), reinterpret_cast(memory + arg->cbPos_)); } + + // Handle DOPP texture resource + gslMemObject gslMem = gpuMem->gslResource(); + if (gslMem->getAttribs().isDOPPDesktopTexture) { + gpu.addVmMemory(gpuMem); + } } break; case KernelArg::Sampler: @@ -3458,7 +3464,7 @@ HSAILKernel::init(amd::hsa::loader::Symbol *sym, bool finalize) // Copy wavefront size workGroupInfo_.wavefrontSize_ = prog().isNull() ? 64 : dev().getAttribs().wavefrontSize; - + // Find total workgroup size if (workGroupInfo_.compileSize_[0] != 0) { workGroupInfo_.size_ = diff --git a/rocclr/runtime/device/gpu/gpukernel.hpp b/rocclr/runtime/device/gpu/gpukernel.hpp index bdb5455ef6..fd383d757a 100644 --- a/rocclr/runtime/device/gpu/gpukernel.hpp +++ b/rocclr/runtime/device/gpu/gpukernel.hpp @@ -620,7 +620,8 @@ public: bool run( VirtualGPU& gpu, //!< virtual GPU device object GpuEvent* gpuEvent, //!< Pointer to the GPU event - bool lastRun //!< Last run in the split execution + bool lastRun, //!< Last run in the split execution + bool lastDoppCmd //!< info for kernel dispatch ) const; //! Help function to debug the kernel output diff --git a/rocclr/runtime/device/gpu/gpuvirtual.cpp b/rocclr/runtime/device/gpu/gpuvirtual.cpp index 2ec9386fae..a5a8757b42 100644 --- a/rocclr/runtime/device/gpu/gpuvirtual.cpp +++ b/rocclr/runtime/device/gpu/gpuvirtual.cpp @@ -472,7 +472,7 @@ VirtualGPU::create(bool profiling, uint rtCUs, uint deviceQueueSize, } //!@todo This is not a generic solution and // may have issues with > 8 queues - idx = index() % (dev().engines().numComputeRings() + + idx = index() % (dev().engines().numComputeRings() + dev().engines().numComputeRingsRT()); } // hwRing_ should be set 0 if forced to have single scratch buffer @@ -1839,11 +1839,23 @@ VirtualGPU::submitKernelInternalHSA( pKernelInfo = &kernelInfo; } + // Set up the dispatch information + KernelDispatchInfo dispatchInfo; + dispatchInfo.aqlPacket = aqlPkt; + dispatchInfo.mems = vmMems(); + dispatchInfo.numMems = cal_.memCount_; + dispatchInfo.scratch = scratch; + dispatchInfo.scratchOffset = scratchOffset; + dispatchInfo.cpuAqlCode = hsaKernel.cpuAqlCode(); + dispatchInfo.hsaQueueVA = hsaQueueMem_->vmAddress(); + dispatchInfo.kernelInfo = pKernelInfo; + dispatchInfo.wavesPerSH = hsaKernel.getWavesPerSH(this); + dispatchInfo.lastDoppSubmission = kernel.parameters().getExecNewVcop(); + GpuEvent gpuEvent; // Run AQL dispatch in HW eventBegin(MainEngine); - cs()->AqlDispatch(aqlPkt, vmMems(), cal_.memCount_, scratch, scratchOffset, - hsaKernel.cpuAqlCode(), hsaQueueMem_->vmAddress(), pKernelInfo, hsaKernel.getWavesPerSH(this)); + cs()->AqlDispatch(&dispatchInfo); eventEnd(MainEngine, gpuEvent); if (dbgManager && (NULL != dbgManager->postDispatchCallBackFunc())) { @@ -2143,7 +2155,7 @@ VirtualGPU::submitKernelInternal( } // Execute the kernel - if (gpuKernel.run(*this, &gpuEvent, lastRun)) { + if (gpuKernel.run(*this, &gpuEvent, lastRun, kernel.parameters().getExecNewVcop())) { //! @todo A flush is necessary to make sure // that 2 consecutive runs won't access to the same // private/local memory. CAL has to generate cache flush diff --git a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp index ef8b14070e..a8bdf336c1 100644 --- a/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp +++ b/rocclr/runtime/device/gpu/gslbe/src/rt/GSLDeviceGL.cpp @@ -745,6 +745,17 @@ CALGSLDevice::resGLAssociate(GLResAssociate & resData) const attribs.cpu_address = (void*)hData->handle; attribs.alias_subtile = hData->tilingMode; attribs.mcaddress = hData->cardAddr; + if (hData->isDoppDesktopTexture == GL_TRUE) + { + attribs.isDOPPDesktopTexture = ATIGL_TRUE; + attribs.displayable = GSL_MOA_DISPLAYABLE_LAYOUT; + } + if (hData->isDoppPresentTexture == GL_TRUE) + { + attribs.displayable = GSL_MOA_DISPLAYABLE_LAYOUT; + } + + // VBOs are hardcoded to have a UINT8 type format if (hRes.type == GL_RESOURCE_ATTACH_VERTEXBUFFER_AMD) { diff --git a/rocclr/runtime/platform/kernel.hpp b/rocclr/runtime/platform/kernel.hpp index cf679e83bf..86293b3135 100644 --- a/rocclr/runtime/platform/kernel.hpp +++ b/rocclr/runtime/platform/kernel.hpp @@ -83,11 +83,13 @@ private: std::vector execSvmPtr_; //!< The non argument svm pointers for kernel FGSStatus svmSystemPointersSupport_; //!< The flag for the status of the kernel // support of fine-grain system sharing. + bool execNewVcop_; //!< special new VCOP for kernel execution public: //! Construct a new instance of parameters for the given signature. KernelParameters(const KernelSignature& signature) : - signature_(signature), validated_(false), execInfoOffset_(0), svmSystemPointersSupport_(FGS_DEFAULT) + signature_(signature), validated_(false), execInfoOffset_(0), svmSystemPointersSupport_(FGS_DEFAULT), + execNewVcop_(false) { values_ = (address) this + alignUp(sizeof(KernelParameters), 16); defined_ = (bool*) (values_ + signature.paramsSize()); @@ -166,6 +168,13 @@ public: //! return the status of kernel support fine-grained SVM system pointer sharing FGSStatus getSvmSystemPointersSupport() const { return svmSystemPointersSupport_; } + + //! set the new VCOP in the execInfo container + void setExecNewVcop(const bool newVcop) { execNewVcop_ = newVcop; } + + //! get the new VCOP in the execInfo container + bool getExecNewVcop() const { return execNewVcop_; } + }; /*! \brief Encapsulates a __kernel function and the argument values