From cd967155c94e18dd24750f422d16658e1583df83 Mon Sep 17 00:00:00 2001 From: foreman Date: Tue, 25 Aug 2015 13:22:29 -0400 Subject: [PATCH] P4 to Git Change 1184379 by gandryey@gera-dev-w7 on 2015/08/25 13:11:13 ECR #304775 - Remove the passthrough interfaces from CALGSLContext Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpucounters.cpp#11 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#293 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#114 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuresource.cpp#224 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputhreadtrace.cpp#8 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputhreadtrace.hpp#6 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gputimestamp.cpp#26 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.cpp#374 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuvirtual.hpp#132 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#77 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#49 edit ... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/backend.h#9 edit [ROCm/clr commit: 727fc38bbbbd6e6b94038a70bb479c523d8ba0f1] --- .../rocclr/runtime/device/gpu/gpucounters.cpp | 7 +- .../rocclr/runtime/device/gpu/gpukernel.cpp | 29 +- .../rocclr/runtime/device/gpu/gpukernel.hpp | 1 + .../rocclr/runtime/device/gpu/gpuresource.cpp | 4 +- .../runtime/device/gpu/gputhreadtrace.cpp | 7 +- .../runtime/device/gpu/gputhreadtrace.hpp | 3 +- .../runtime/device/gpu/gputimestamp.cpp | 4 +- .../rocclr/runtime/device/gpu/gpuvirtual.cpp | 156 ++++---- .../rocclr/runtime/device/gpu/gpuvirtual.hpp | 1 - .../device/gpu/gslbe/src/rt/GSLContext.cpp | 360 +----------------- .../device/gpu/gslbe/src/rt/GSLContext.h | 52 +-- .../runtime/device/gpu/gslbe/src/rt/backend.h | 22 -- 12 files changed, 139 insertions(+), 507 deletions(-) diff --git a/projects/clr/rocclr/runtime/device/gpu/gpucounters.cpp b/projects/clr/rocclr/runtime/device/gpu/gpucounters.cpp index d5acc0403c..5ca7f82c2e 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpucounters.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpucounters.cpp @@ -5,6 +5,7 @@ #include "device/gpu/gpudefs.hpp" #include "device/gpu/gpucounters.hpp" #include "device/gpu/gpuvirtual.hpp" +#include "query/PerformanceQueryObject.h" namespace gpu { @@ -14,7 +15,7 @@ CalCounterReference::~CalCounterReference() { amd::ScopedLock lock(gpu_.execution()); if (0 != counter_) { - gpu().destroyCounter(gslCounter()); + gpu().cs()->destroyQuery(gslCounter()); } } @@ -52,7 +53,7 @@ PerfCounter::create( calRef->growResultArray(index_); // Initialize the counter - gpu().configPerformanceCounter(gslCounter(), + gslCounter()->getAsPerformanceQueryObject()->setCounterState( info()->blockIndex_, info()->counterIndex_, info()->eventIndex_); return true; @@ -75,7 +76,7 @@ PerfCounter::getInfo(uint64_t infoType) const return info()->eventIndex_; } case CL_PERFCOUNTER_DATA: { - gpu().getCounter(reinterpret_cast(calRef_->results()), gslCounter()); + gslCounter()->GetResult(gpu().cs(), reinterpret_cast(calRef_->results())); return calRef_->results()[index_]; } default: diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp index da6a8b5f17..bf67766046 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.cpp @@ -8,6 +8,7 @@ #include "device/gpu/gpuconstbuf.hpp" #include "device/gpu/gpusched.hpp" #include "platform/commandqueue.hpp" +#include "shader/ComputeProgramObject.h" #include "utils/options.hpp" #include "acl.h" @@ -769,6 +770,7 @@ NullKernel::create( workGroupInfo_.usedLDSSize_ = calFuncInfo.LDSSizeUsed; workGroupInfo_.availableStackSize_ = calFuncInfo.stackSizeAvailable; workGroupInfo_.usedStackSize_ = calFuncInfo.stackSizeUsed; + setBufferForNumGroup_ = calFuncInfo.setBufferForNumGroup; device::Kernel::parameters_t params; if (!createSignature(params)) { @@ -1655,7 +1657,7 @@ bool Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun) const { // 8xx workaround for the number of groups limit in HW - if (gpu.gslKernelDesc()->funcInfo_.setBufferForNumGroup) { + if (setBufferForNumGroup_) { const ProgramGrid* programGrid = &gpu.cal()->progGrid_; ConstBuffer* cb = gpu.numGrpCb(); assert((cb != NULL) && "Runtime must have the constant buffer"); @@ -1682,12 +1684,13 @@ Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun) const } } - gpu.setWavesPerSH(gpu.gslKernelDesc()->func_, waveLimiter_.getWavesPerSH(&gpu)); - if (!gpu.runProgramGrid(*calEvent, - const_cast(&gpu.cal()->progGrid_), gpu.vmMems(), gpu.cal_.memCount_)) { - LogError("Failed to execute the program!"); - return false; - } + auto compProg = static_cast(gpu.gslKernelDesc()->func_); + compProg->setWavesPerSH(waveLimiter_.getWavesPerSH(&gpu)); + + gpu.eventBegin(MainEngine); + gpu.rs()->Dispatch(gpu.cs(), &gpu.cal()->progGrid_.gridBlock, &gpu.cal()->progGrid_.partialGridBlock, + &gpu.cal()->progGrid_.gridSize, gpu.cal()->progGrid_.localSize, gpu.vmMems(), gpu.cal_.memCount_); + gpu.eventEnd(MainEngine, *calEvent); // Unbind all resources unbindResources(gpu, *calEvent, lastRun); @@ -2331,11 +2334,13 @@ Kernel::bindResource( GpuEvent calEvent; // Bind memory with atomic counter - gpu.bindAtomicCounter(argument(paramIdx)->index_, + gpu.cs()->bindAtomicCounter(argument(paramIdx)->index_, memory->gslResource()); // Copy the counter value into GDS - gpu.syncAtomicCounter(calEvent, argument(paramIdx)->index_, false); + gpu.eventBegin(MainEngine); + gpu.cs()->syncAtomicCounter(argument(paramIdx)->index_, false); + gpu.eventEnd(MainEngine, calEvent); // Mark resource as busy memory->setBusy(gpu, calEvent); @@ -2455,7 +2460,9 @@ Kernel::unbindResources( if (KernelArg::Counter == argument(i)->type_) { // Copy the counter value from GDS - gpu.syncAtomicCounter(calEventTmp, argument(i)->index_, true); + gpu.eventBegin(MainEngine); + gpu.cs()->syncAtomicCounter(argument(i)->index_, true); + gpu.eventEnd(MainEngine, calEventTmp); } else if (!(gpu.slots_[i].state_.constant_ || argument(i)->memory_.readOnly_)) { @@ -2487,7 +2494,7 @@ Kernel::unbindResources( } // 8xx workaround for the number of groups limit in HW - if (gpu.gslKernelDesc()->funcInfo_.setBufferForNumGroup) { + if (setBufferForNumGroup_) { ConstBuffer* cb = gpu.numGrpCb(); assert((cb != NULL) && "Runtime must have the constant buffer"); cb->setBusy(gpu, calEvent); diff --git a/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp b/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp index 2c008c2087..0bf06ffd38 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpukernel.hpp @@ -505,6 +505,7 @@ protected: uint uavArena_; //!< UAV used for arena access bool rwAttributes_; //!< backend provides RW attributes for arguments + bool setBufferForNumGroup_; uint instructionCnt_;//!< Instruction count diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp index eb6739d52c..802525f20f 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpuresource.cpp @@ -1181,7 +1181,9 @@ Resource::writeRawData( // Write data size bytes to surface // size needs to be DWORD aligned assert((size & 3) == 0); - gpu.writeSurfRaw(event, gslResource(), size, data); + gpu.eventBegin(MainEngine); + gslResource()->writeDataRaw(gpu.cs(), size, data, true); + gpu.eventEnd(MainEngine, event); setBusy(gpu, event); // Update the global GPU event diff --git a/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.cpp b/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.cpp index 13dae52cf8..ea006902ef 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.cpp @@ -13,7 +13,7 @@ CalThreadTraceReference::~CalThreadTraceReference() { amd::ScopedLock lock(gpu_.execution()); if (0 != threadTrace_) { - //gpu().destroyThreadTrace(gslThreadTrace()); + //gpu().cs()->destroyQuery(gslThreadTrace()); } } @@ -24,7 +24,8 @@ ThreadTrace::~ThreadTrace() return; } for(uint i = 0; i < amdThreadTraceMemObjsNum_;++i) { - gpu().DestroyThreadTraceBuffer(threadTraceBufferObjs_[i],i); + threadTraceBufferObjs_[i]->attachMemObject(gpu().cs(), NULL, 0, 0, 0, i); + gpu().cs()->destroyShaderTraceBuffer(threadTraceBufferObjs_[i]); } // Release the thread trace reference object @@ -52,7 +53,7 @@ ThreadTrace::info(uint infoType, uint* info, uint infoSize) const return false; } else { - gpu().getThreadTraceQueryRes(gslThreadTrace(), info); + gslThreadTrace()->GetResultAll(gpu().cs(), info); } break; } diff --git a/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.hpp b/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.hpp index 6b220fb116..2554bbc848 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.hpp +++ b/projects/clr/rocclr/runtime/device/gpu/gputhreadtrace.hpp @@ -7,6 +7,7 @@ #include "top.hpp" #include "device/device.hpp" #include "device/gpu/gpudevice.hpp" +#include "shadertracebuffer/ShaderTraceBufferObject.h" #include namespace gpu { @@ -76,7 +77,7 @@ public: { threadTraceBufferObjs_ = new gslShaderTraceBufferObject[amdThreadTraceMemObjsNum]; for (uint i = 0; i < amdThreadTraceMemObjsNum;++i) { - threadTraceBufferObjs_[i] = gpu.CreateThreadTraceBuffer(); + threadTraceBufferObjs_[i] = gpu.cs()->createShaderTraceBuffer(); } } diff --git a/projects/clr/rocclr/runtime/device/gpu/gputimestamp.cpp b/projects/clr/rocclr/runtime/device/gpu/gputimestamp.cpp index d4db046208..9ab4981e7d 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gputimestamp.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gputimestamp.cpp @@ -31,7 +31,7 @@ void TimeStamp::begin(bool sdma) { if (!flags_.beginIssued_) { - gpu().writeTimer(sdma, gslMem_, + gpu().rs()->writeTimer(gpu().cs(), sdma, gslMem_, memOffset_ + CommandStartTime * sizeof(uint64_t)); flags_.beginIssued_ = true; } @@ -41,7 +41,7 @@ void TimeStamp::end(bool sdma) { CondLog(!flags_.beginIssued_, "We didn't issue a begin operation!"); - gpu().writeTimer(sdma, gslMem_, + gpu().rs()->writeTimer(gpu().cs(), sdma, gslMem_, memOffset_ + CommandEndTime * sizeof(uint64_t)); flags_.endIssued_ = true; flags_.sdma_ = sdma; diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp b/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp index 19a591e4e8..7002d5c196 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.cpp @@ -15,6 +15,7 @@ #include "device/gpu/gputimestamp.hpp" #include "device/gpu/gpublit.hpp" #include "device/gpu/gpudebugger.hpp" +#include "shader/ComputeProgramObject.h" #include "hsa.h" #include "amd_hsa_kernel_code.h" #include "amd_hsa_queue.h" @@ -1807,8 +1808,10 @@ VirtualGPU::submitKernelInternalHSA( GpuEvent gpuEvent; // Run AQL dispatch in HW - runAqlDispatch(gpuEvent, aqlPkt, vmMems(), cal_.memCount_, - scratch, scratchOffset, hsaKernel.cpuAqlCode(), hsaQueueMem_->vmAddress(), pKernelInfo); + eventBegin(MainEngine); + cs()->AqlDispatch(aqlPkt, vmMems(), cal_.memCount_, scratch, scratchOffset, + hsaKernel.cpuAqlCode(), hsaQueueMem_->vmAddress(), pKernelInfo); + eventEnd(MainEngine, gpuEvent); if (dbgManager && (NULL != dbgManager->postDispatchCallBackFunc())) { dbgManager->executePostDispatchCallBack(); @@ -1908,14 +1911,16 @@ VirtualGPU::submitKernelInternalHSA( if (!dev().settings().useDeviceQueue_) { // Add the termination handshake to the host queue - virtualQueueHandshake(gpuEvent, gpuDefQueue->schedParams_->gslResource(), + eventBegin(MainEngine); + cs()->VirtualQueueHandshake(gpuDefQueue->schedParams_->gslResource(), vmParentWrap + offsetof(AmdAqlWrap, state), AQL_WRAP_DONE, vmParentWrap + offsetof(AmdAqlWrap, child_counter), 0, dev().settings().useDeviceQueue_); + eventEnd(MainEngine, gpuEvent); } // Get the global loop start before the scheduler - mcaddr loopStart = gpuDefQueue->virtualQueueDispatcherStart(); + mcaddr loopStart = gpuDefQueue->cs()->VirtualQueueDispatcherStart(); static_cast(gpuDefQueue->blitMgr()).runScheduler( *gpuDefQueue->virtualQueue_, *gpuDefQueue->schedParams_, gpuDefQueue->schedParamIdx_, @@ -1925,7 +1930,7 @@ VirtualGPU::submitKernelInternalHSA( // Get the address of PM4 template and add write it to params //! @note DMA flush must not occur between patch and the scheduler - mcaddr patchStart = gpuDefQueue->virtualQueueDispatcherStart(); + mcaddr patchStart = gpuDefQueue->cs()->VirtualQueueDispatcherStart(); // Program parameters for the scheduler SchedulerParam* param = &reinterpret_cast @@ -1967,10 +1972,12 @@ VirtualGPU::submitKernelInternalHSA( mcaddr signalAddr = gpuDefQueue->schedParams_->vmAddress() + gpuDefQueue->schedParamIdx_ * sizeof(SchedulerParam); - gpuDefQueue->virtualQueueDispatcherEnd(gpuEvent, + gpuDefQueue->eventBegin(MainEngine); + gpuDefQueue->cs()->VirtualQueueDispatcherEnd( gpuDefQueue->vmMems(), gpuDefQueue->cal_.memCount_, signalAddr, loopStart, gpuDefQueue->vqHeader_->aql_slot_num / (DeviceQueueMaskSize * maskGroups_)); + gpuDefQueue->eventEnd(MainEngine, gpuEvent); // Set GPU event for the used resources for (uint i = 0; i < memList.size(); ++i) { @@ -1979,10 +1986,12 @@ VirtualGPU::submitKernelInternalHSA( if (dev().settings().useDeviceQueue_) { // Add the termination handshake to the host queue - virtualQueueHandshake(gpuEvent, gpuDefQueue->schedParams_->gslResource(), + eventBegin(MainEngine); + cs()->VirtualQueueHandshake(gpuDefQueue->schedParams_->gslResource(), vmParentWrap + offsetof(AmdAqlWrap, state), AQL_WRAP_DONE, vmParentWrap + offsetof(AmdAqlWrap, child_counter), signalAddr, dev().settings().useDeviceQueue_); + eventEnd(MainEngine, gpuEvent); } ++gpuDefQueue->schedParamIdx_ %= @@ -2275,7 +2284,7 @@ VirtualGPU::submitPerfCounter(amd::PerfCounterCommand& vcmd) const amd::PerfCounterCommand::PerfCounterList counters = vcmd.getCounters(); // Create a HW counter - gslCounter = createCounter(GSL_PERFORMANCE_COUNTERS_ATI); + gslCounter = cs()->createQuery(GSL_PERFORMANCE_COUNTERS_ATI); if (0 == gslCounter) { LogError("We failed to allocate memory for the GPU perfcounter"); vcmd.setStatus(CL_INVALID_OPERATION); @@ -2338,11 +2347,13 @@ VirtualGPU::submitPerfCounter(amd::PerfCounterCommand& vcmd) gslCounter = counter->gslCounter(); // Find the state and sends the command to CAL if (vcmd.getState() == amd::PerfCounterCommand::Begin) { - beginCounter(gslCounter, GSL_PERFORMANCE_COUNTERS_ATI); + gslCounter->BeginQuery(cs(), GSL_PERFORMANCE_COUNTERS_ATI, 0); } else if (vcmd.getState() == amd::PerfCounterCommand::End) { GpuEvent event; - endCounter(gslCounter, event); + eventBegin(MainEngine); + gslCounter->EndQuery(cs(), 0); + eventEnd(MainEngine, event); setGpuEvent(event); } else { @@ -2371,7 +2382,7 @@ VirtualGPU::submitThreadTraceMemObjects(amd::ThreadTraceMemObjectsCommand& cmd) if (threadTrace == NULL) { gslQueryObject gslThreadTrace; // Create a HW thread trace query object - gslThreadTrace = createThreadTrace(); + gslThreadTrace = cs()->createQuery(GSL_SHADER_TRACE_BYTES_WRITTEN); if (0 == gslThreadTrace) { LogError("Failure in memory allocation for the GPU threadtrace"); cmd.setStatus(CL_INVALID_OPERATION); @@ -2414,7 +2425,7 @@ VirtualGPU::submitThreadTraceMemObjects(amd::ThreadTraceMemObjectsCommand& cmd) gslMemObject gslMemObj = dev().getGpuMemory(*itMemObj)->gslResource(); // Bind GSL MemObject to the appropriate SE Thread Trace Buffer Object - configMemThreadTrace(threadTraceBufferObjects[se],gslMemObj,se,memObjSize); + threadTraceBufferObjects[se]->attachMemObject(cs(), gslMemObj, 0, 0, memObjSize, se); } break; } @@ -2448,45 +2459,47 @@ VirtualGPU::submitThreadTrace(amd::ThreadTraceCommand& cmd) else { gslQueryObject gslThreadTrace; gslThreadTrace = threadTrace->gslThreadTrace(); - // Find the state and sends the command to CAL - if (cmd.getState() == amd::ThreadTraceCommand::Begin) { - size_t amdMemObjsNumThreadTrace = amdThreadTrace->deviceSeNumThreadTrace(); - amd::ThreadTrace::ThreadTraceConfig* amdThreadTraceConfig = - static_cast(cmd.threadTraceConfig()); - CALthreadTraceConfig calTthreadTraceConfig; + uint32_t seNum = amdThreadTrace->deviceSeNumThreadTrace(); - calTthreadTraceConfig.cu = amdThreadTraceConfig->cu_; - calTthreadTraceConfig.sh = amdThreadTraceConfig->sh_; - calTthreadTraceConfig.simd_mask = amdThreadTraceConfig->simdMask_; - calTthreadTraceConfig.vm_id_mask = amdThreadTraceConfig->vmIdMask_; - calTthreadTraceConfig.token_mask = amdThreadTraceConfig->tokenMask_; - calTthreadTraceConfig.reg_mask = amdThreadTraceConfig->regMask_; - calTthreadTraceConfig.inst_mask = amdThreadTraceConfig->instMask_; - calTthreadTraceConfig.random_seed = amdThreadTraceConfig->randomSeed_; - calTthreadTraceConfig.user_data = amdThreadTraceConfig->userData_; - calTthreadTraceConfig.capture_mode = amdThreadTraceConfig->captureMode_; - if (amdThreadTraceConfig->isUserData_) { - calTthreadTraceConfig.is_user_data = CAL_TRUE; + // Find the state and sends the commands to GSL + if (cmd.getState() == amd::ThreadTraceCommand::Begin) { + amd::ThreadTrace::ThreadTraceConfig* traceCfg = + static_cast(cmd.threadTraceConfig()); + const gslErrorCode ec = gslThreadTrace->BeginQuery(cs(), + GSL_SHADER_TRACE_BYTES_WRITTEN, 0); + assert(ec == GSL_NO_ERROR); + + for (uint32_t idx = 0; idx < seNum; ++idx) { + rs()->enableShaderTrace(cs(), idx, true); + rs()->setShaderTraceComputeUnit (idx, traceCfg->cu_); + rs()->setShaderTraceShaderArray (idx, traceCfg->sh_); + rs()->setShaderTraceSIMDMask (idx, traceCfg->simdMask_); + rs()->setShaderTraceVmIdMask (idx, traceCfg->vmIdMask_); + rs()->setShaderTraceTokenMask (idx, traceCfg->tokenMask_); + rs()->setShaderTraceRegisterMask(idx, traceCfg->regMask_); + rs()->setShaderTraceIssueMask (idx, traceCfg->instMask_); + rs()->setShaderTraceRandomSeed (idx, traceCfg->randomSeed_); + rs()->setShaderTraceCaptureMode (idx, traceCfg->captureMode_); + rs()->setShaderTraceWrap (idx, traceCfg->isWrapped_); + rs()->setShaderTraceUserData (idx, + (traceCfg->isUserData_) ? traceCfg->userData_ : 0); } - else { - calTthreadTraceConfig.is_user_data = CAL_FALSE; - } - if (amdThreadTraceConfig->isWrapped_) { - calTthreadTraceConfig.is_wrapped = CAL_TRUE; - } - else { - calTthreadTraceConfig.is_wrapped = CAL_FALSE; - } - beginThreadTrace(gslThreadTrace,0,GSL_SHADER_TRACE_BYTES_WRITTEN,amdMemObjsNumThreadTrace,calTthreadTraceConfig); } else if (cmd.getState() == amd::ThreadTraceCommand::End) { - endThreadTrace(gslThreadTrace,2); + for (uint32_t idx = 0; idx < seNum; ++idx) { + rs()->enableShaderTrace(cs(), idx, false); + } + gslThreadTrace->EndQuery(cs(), 0); } else if (cmd.getState() == amd::ThreadTraceCommand::Pause) { - pauseThreadTrace(2); + for (uint32_t idx = 0; idx < seNum; ++idx) { + rs()->setShaderTraceIsPaused(cs(), idx, true); + } } else if (cmd.getState() == amd::ThreadTraceCommand::Resume) { - resumeThreadTrace(2); + for (uint32_t idx = 0; idx < seNum; ++idx) { + rs()->setShaderTraceIsPaused(cs(), idx, false); + } } } break; @@ -2584,20 +2597,32 @@ VirtualGPU::submitReleaseExtObjects(amd::ReleaseExtObjectsCommand& vcmd) void VirtualGPU::submitSignal(amd::SignalCommand & vcmd) { - bool res = true; amd::ScopedLock lock(execution()); profilingBegin(vcmd); gpu::Memory* gpuMemory = dev().getGpuMemory(&vcmd.memory()); if (vcmd.type() == CL_COMMAND_WAIT_SIGNAL_AMD) { - res = WaitSignal(gpuMemory->gslResource(), vcmd.markerValue()); - } - else if (vcmd.type() == CL_COMMAND_WRITE_SIGNAL_AMD) { - res = WriteSignal(gpuMemory->gslResource(), vcmd.markerValue(), - vcmd.markerOffset()); - } - if(res != true) { + uint64_t surfAddr = gpuMemory->gslResource()->getPhysicalAddress(cs()); + uint64_t markerAddr = gpuMemory->gslResource()->getMarkerAddress(cs()); + uint64_t markerOffset = markerAddr - surfAddr; +/* @todo this logic doesn't make any sense + if((markerAddr + markerOffset) == 0) { LogError("submitSignal failed"); vcmd.setStatus(CL_INVALID_OPERATION); + } +*/ + cs()->p2pMarkerOp(gpuMemory->gslResource(), vcmd.markerValue(), + markerOffset, false); + } + else if (vcmd.type() == CL_COMMAND_WRITE_SIGNAL_AMD) { + GpuEvent gpuEvent; + eventBegin(MainEngine); + cs()->p2pMarkerOp(gpuMemory->gslResource(), vcmd.markerValue(), vcmd.markerOffset(), true); + //! @todo We don't need flush if an event is tracked. + cs()->Flush(); + eventEnd(MainEngine, gpuEvent); + gpuMemory->setBusy(*this, gpuEvent); + // Update the global GPU event + setGpuEvent(gpuEvent); } profilingEnd(vcmd); } @@ -2618,14 +2643,11 @@ VirtualGPU::submitMakeBuffersResident(amd::MakeBuffersResidentCommand & vcmd) gpuMemory->syncCacheFromHost(*this); } - cl_ulong* surfBusAddr = new cl_ulong[numObjects]; - cl_ulong* markerBusAddr = new cl_ulong[numObjects]; - bool res = MakeBuffersResident( - numObjects, - pGSLMemObjects, - (CALuint64*)surfBusAddr, - (CALuint64*)markerBusAddr); - if(res != true) { + uint64* surfBusAddr = new uint64[numObjects]; + uint64* markerBusAddr = new uint64[numObjects]; + gslErrorCode res = cs()->makeBuffersResident(numObjects, pGSLMemObjects, + surfBusAddr, markerBusAddr); + if(res != GSL_NO_ERROR) { LogError("MakeBuffersResident failed"); vcmd.setStatus(CL_INVALID_OPERATION); } @@ -2972,11 +2994,11 @@ VirtualGPU::setActiveKernelDesc( if (result) { // Set program in GSL - setProgram(desc->func_); + rs()->setCurrentProgramObject(GSL_COMPUTE_PROGRAM, desc->func_); // Update internal constant buffer if (desc->intCb_ != 0) { - setConstants(desc->intCb_); + cs()->setIntConstants(GSL_COMPUTE_PROGRAM, desc->intCb_); } } @@ -3045,11 +3067,6 @@ VirtualGPU::allocKernelDesc(const Kernel* kernel, CALimage calImage) delete desc; return NULL; } - - // - // prime the func info in the func object. - // - getFuncInfo(desc->func_, GSL_COMPUTE_PROGRAM, &desc->funcInfo_); } if (kernel->argSize() > slots_.size()) { @@ -3066,7 +3083,7 @@ VirtualGPU::freeKernelDesc(VirtualGPU::GslKernelDesc* desc) if (gslKernelDesc() == desc) { // Clear active kernel desc activeKernelDesc_ = NULL; - setProgram(0); + rs()->setCurrentProgramObject(GSL_COMPUTE_PROGRAM, 0); } if (desc->image_ != 0) { @@ -3076,9 +3093,10 @@ VirtualGPU::freeKernelDesc(VirtualGPU::GslKernelDesc* desc) if (desc->func_ != 0) { if (desc->intCb_ != 0) { - destroyConstants(desc->intCb_); + cs()->setIntConstants(GSL_COMPUTE_PROGRAM, 0); + cs()->destroyMemObject(desc->intCb_); } - destroyProgramObject(desc->func_); + cs()->destroyProgramObject(desc->func_); } delete desc; diff --git a/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.hpp b/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.hpp index 07b2fefa04..e839b03ee6 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.hpp +++ b/projects/clr/rocclr/runtime/device/gpu/gpuvirtual.hpp @@ -96,7 +96,6 @@ public: gslProgramObject func_; //!< GSL program object gslMemObject intCb_; //!< Internal constant buffer CALUavMask uavMask_; //!< UAV mask, unclear if necessary - CALfuncInfo funcInfo_; //!< CAL function info }; struct ResourceSlot diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp index 550fd6e69a..75b7523749 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp @@ -388,29 +388,6 @@ CALGSLContext::setUAVChannelOrder(uint32 physUnit, gslMemObject mem) } } -void -CALGSLContext::setProgram(gslProgramObject func) -{ - m_rs->setCurrentProgramObject(GSL_COMPUTE_PROGRAM, func); -} - -void -CALGSLContext::setWavesPerSH(gslProgramObject func, uint32 wavesPerSH)const -{ - auto compProg = static_cast(func); - compProg->setWavesPerSH(wavesPerSH); -} - -bool -CALGSLContext::runProgramGrid(GpuEvent& event, const ProgramGrid* pProgramGrid, const gslMemObject* mems, uint32 numMems) -{ - eventBegin(MainEngine); - m_rs->Dispatch(m_cs, &pProgramGrid->gridBlock, &pProgramGrid->partialGridBlock, - &pProgramGrid->gridSize, pProgramGrid->localSize, mems, numMems); - eventEnd(MainEngine, event); - return true; -} - bool CALGSLContext::isDone(GpuEvent* event) { @@ -438,24 +415,12 @@ CALGSLContext::waitForEvent(GpuEvent* event) } } -void -CALGSLContext::flushIOCaches() const -{ - m_cs->FlushIOCaches(); -} - void CALGSLContext::flushCUCaches(bool flushL2) const { m_cs->FlushCUCaches(flushL2); } -gslProgramObject -CALGSLContext::createProgramObject(CALuint type) -{ - return m_cs->createProgramObject(GSL_COMPUTE_PROGRAM); -} - void CALGSLContext::setScratchBuffer(gslMemObject mem, int32 engineId) { @@ -472,20 +437,6 @@ CALGSLContext::setScratchBuffer(gslMemObject mem, int32 engineId) m_scratchBuffers->setMemObject(m_cs, mem, engineId); } -void -CALGSLContext::destroyProgramObject(gslProgramObject func) -{ - m_cs->destroyProgramObject(func); -} - -void -CALGSLContext::writeSurfRaw(GpuEvent& event, gslMemObject mem, size_t size, const void* data) -{ - eventBegin(MainEngine); - mem->writeDataRaw(m_cs, size, data, true); - eventEnd(MainEngine, event); -} - bool CALGSLContext::copyPartial(GpuEvent& event, gslMemObject srcMem, @@ -631,169 +582,6 @@ CALGSLContext::setSamplerParameter(uint32 sampler, gslTexParameterPname param, v } } -gslQueryObject CALGSLContext::createCounter(gslQueryTarget target) const -{ - return m_cs->createQuery(target); -} - -void CALGSLContext::destroyCounter(gslQueryObject counter) const -{ - m_cs->destroyQuery(counter); -} - -void CALGSLContext::beginCounter(gslQueryObject counter, gslQueryTarget target) const -{ - // This should never be called for UVD/VCE Sync queries in case it is - // Please correctly pass on EngineMask else queries may be messed up - assert(target != GSL_UVD_SYNC_ATI || target != GSL_VCE_SYNC_ATI); - counter->BeginQuery(m_cs, target, 0); -} - -void CALGSLContext::endCounter(gslQueryObject counter, GpuEvent& event) -{ - eventBegin(MainEngine); - counter->EndQuery(m_cs, 0); - eventEnd(MainEngine, event); -} - -void CALGSLContext::getCounter(uint64* result, gslQueryObject counter) const -{ - counter->GetResult(m_cs, result); -} - -void CALGSLContext::configPerformanceCounter(gslQueryObject counter, CALuint block, CALuint index, CALuint event) const -{ - counter->getAsPerformanceQueryObject()->setCounterState(block, index, event); -} - -gslMemObject -CALGSLContext::createConstants(uint32 count) const -{ - assert(m_cs != 0); - - const gslMemObjectAttribs attribs( - GSL_MOA_CONSTANT_STORE, // type - GSL_MOA_MEMORY_CARD, // location - GSL_MOA_TILING_LINEAR, // tiling - GSL_MOA_DISPLAYABLE_NO, // displayable - ATIGL_FALSE, // mipmap - 1, // samples - 0, // cpu_address - GSL_MOA_SIGNED_NO, // signed_format - GSL_MOA_FORMAT_NORM, // numFormat - DRIVER_MODULE_GLL, // module - GSL_ALLOCATION_INSTANCED // alloc_type - ); - - return m_cs->createMemObject1D(CM_SURF_FMT_RGBX8, count, &attribs); -} - -void -CALGSLContext::setConstants(gslMemObject constants) const -{ - m_cs->setIntConstants(GSL_COMPUTE_PROGRAM, constants); -} - -void -CALGSLContext::destroyConstants(gslMemObject constants) const -{ - assert(m_cs != 0); - assert(constants != 0); - - m_cs->setIntConstants(GSL_COMPUTE_PROGRAM, 0); - m_cs->destroyMemObject(constants); -} - -void -CALGSLContext::getFuncInfo(gslProgramObject func, gslProgramTarget target, CALfuncInfo *pInfo) -{ - assert(m_cs!= 0); - assert(func!= 0); - - gsl::gsProgramInfo* pProgramResource = func->getProgramResourceInfo(); - - pInfo->maxScratchRegsNeeded = pProgramResource->elfInfo._maxScratchRegsNeeded; - pInfo->numSharedGPRUser = pProgramResource->elfInfo._numSharedGPRUser; - pInfo->numSharedGPRTotal = pProgramResource->elfInfo._numSharedGPRTotal; - pInfo->eCsSetupMode = (CALboolean)pProgramResource->elfInfo._eCsSetupMode; - pInfo->numThreadPerGroup = pProgramResource->elfInfo._numThreadPerGroup; - pInfo->numThreadPerGroupX = pProgramResource->elfInfo._numThreadPerGroupX; - pInfo->numThreadPerGroupY = pProgramResource->elfInfo._numThreadPerGroupY; - pInfo->numThreadPerGroupZ = pProgramResource->elfInfo._numThreadPerGroupZ; - pInfo->totalNumThreadGroup = pProgramResource->elfInfo._totalNumThreadGroup; - pInfo->numWavefrontPerSIMD = pProgramResource->elfInfo._NumWavefrontPerSIMD; - pInfo->isMaxNumWavePerSIMD = (CALboolean)pProgramResource->elfInfo._IsMaxNumWavePerSIMD; - pInfo->setBufferForNumGroup = (CALboolean)pProgramResource->elfInfo._SetBufferForNumGroup; - pInfo->wavefrontSize = pProgramResource->wavefrontSize; - pInfo->numGPRsAvailable = pProgramResource->numGPRsAvailable; - pInfo->numGPRsUsed = pProgramResource->numGPRsUsed; - pInfo->numSGPRsAvailable = pProgramResource->numSGPRsAvailable; - pInfo->numSGPRsUsed = pProgramResource->numSGPRsUsed; - pInfo->numVGPRsAvailable = pProgramResource->numVGPRsAvailable; - pInfo->numVGPRsUsed = pProgramResource->numVGPRsUsed; - pInfo->LDSSizeAvailable = pProgramResource->LDSSizeAvailable; - pInfo->LDSSizeUsed = pProgramResource->LDSSizeUsed; - pInfo->stackSizeAvailable = pProgramResource->stackSizeAvailable; - pInfo->stackSizeUsed = pProgramResource->stackSizeUsed; -} - -bool -CALGSLContext::WaitSignal(gslMemObject mem, CALuint value) -{ - uint64 surfAddr = mem->getPhysicalAddress(m_cs); - uint64 markerAddr = mem->getMarkerAddress(m_cs); - - uint64 markerOffset = markerAddr - surfAddr; - - if((markerAddr + markerOffset) == 0) - return false; - - - m_cs->p2pMarkerOp(mem, value, markerOffset, false); - - return true; -} - -bool -CALGSLContext::WriteSignal(gslMemObject mem, CALuint value, CALuint64 offset) -{ - m_cs->p2pMarkerOp(mem, value,offset, true); - m_cs->Flush(); - return true; -} - -bool -CALGSLContext::MakeBuffersResident(CALuint numObjects, gslMemObject* pMemObjects, - CALuint64* surfBusAddress, CALuint64* markerBusAddress) -{ - bool res = true; - - res = (m_cs->makeBuffersResident(numObjects, pMemObjects, surfBusAddress, - markerBusAddress) == GSL_NO_ERROR) ? true:false; - - return res; -} - -void -CALGSLContext::bindAtomicCounter(uint32 index, gslMemObject obj) -{ - m_cs->bindAtomicCounter(index, obj); -} - -void -CALGSLContext::setGWSResource(uint32 index, uint32 value) -{ - m_cs->setGWSResource(index, value); -} - -void -CALGSLContext::syncAtomicCounter(GpuEvent& event, uint32 index, bool read) -{ - eventBegin(MainEngine); - m_cs->syncAtomicCounter(index, read); - eventEnd(MainEngine, event); -} - bool CALGSLContext::moduleLoad(CALimage image, gslProgramObject* func, gslMemObject* constants, CALUavMask* uavMask) @@ -824,7 +612,7 @@ CALGSLContext::moduleLoad(CALimage image, return false; } - *func = createProgramObject((CALuint)ED_ATI_CAL_TYPE_COMPUTE); + *func = m_cs->createProgramObject(GSL_COMPUTE_PROGRAM); if (*func == 0) { amuABIMultiBinaryDestroy(binary); @@ -852,7 +640,21 @@ CALGSLContext::moduleLoad(CALimage image, if (numConstants > 0) { - *constants = createConstants(++maxPhysical); + const gslMemObjectAttribs attribs( + GSL_MOA_CONSTANT_STORE, // type + GSL_MOA_MEMORY_CARD, // location + GSL_MOA_TILING_LINEAR, // tiling + GSL_MOA_DISPLAYABLE_NO, // displayable + ATIGL_FALSE, // mipmap + 1, // samples + 0, // cpu_address + GSL_MOA_SIGNED_NO, // signed_format + GSL_MOA_FORMAT_NORM, // numFormat + DRIVER_MODULE_GLL, // module + GSL_ALLOCATION_INSTANCED // alloc_type + ); + + *constants = m_cs->createMemObject1D(CM_SURF_FMT_RGBX8, ++maxPhysical, &attribs); CALuint* ptr = static_cast((*constants)->map(m_cs, GSL_MAP_READ_WRITE)); assert(ptr != 0 && "gslMapMemImage failed!"); @@ -874,136 +676,6 @@ CALGSLContext::moduleLoad(CALimage image, return true; } -gslQueryObject CALGSLContext::createThreadTrace(void) const -{ - return m_cs->createQuery(GSL_SHADER_TRACE_BYTES_WRITTEN); -} - -void CALGSLContext::destroyThreadTrace(gslQueryObject threadTrace) const -{ - m_cs->destroyQuery(threadTrace); -} - - -gslShaderTraceBufferObject -CALGSLContext::CreateThreadTraceBuffer(void) const -{ - return m_cs->createShaderTraceBuffer(); -} - -void -CALGSLContext::DestroyThreadTraceBuffer(gslShaderTraceBufferObject shaderTraceBuffer,uint32 index) const -{ - shaderTraceBuffer->attachMemObject(m_cs, NULL, 0, 0, 0, index); - m_cs->destroyShaderTraceBuffer(shaderTraceBuffer); -} - -void -CALGSLContext::configMemThreadTrace(gslShaderTraceBufferObject shaderTraceBuffer,gslMemObject memObject,uint32 index,uint32 size) const -{ - shaderTraceBuffer->attachMemObject(m_cs, memObject, 0, 0, size,index); -} - -void -CALGSLContext::beginThreadTrace(gslQueryObject threadTrace,gslQueryObject threadTrace2, gslQueryTarget target,uint32 seNum,CALthreadTraceConfig& threadTraceConfig) const -{ - // This should never be called for UVD/VCE Sync queries in case it is - // Please correctly pass on EngineMask else queries may be messed up - assert(target != GSL_UVD_SYNC_ATI || target != GSL_VCE_SYNC_ATI); - const gslErrorCode ec = threadTrace->BeginQuery(m_cs, target, 0); - assert(ec == GSL_NO_ERROR); - - for (uint32 index = 0;index < seNum;++index) { - m_rs->enableShaderTrace(m_cs,index,true); - m_rs->setShaderTraceComputeUnit(index,threadTraceConfig.cu); - m_rs->setShaderTraceShaderArray(index,threadTraceConfig.sh); - m_rs->setShaderTraceSIMDMask(index,threadTraceConfig.simd_mask); - m_rs->setShaderTraceVmIdMask(index,threadTraceConfig.vm_id_mask); - m_rs->setShaderTraceTokenMask(index,threadTraceConfig.token_mask); - m_rs->setShaderTraceRegisterMask(index,threadTraceConfig.reg_mask); - m_rs->setShaderTraceIssueMask(index,threadTraceConfig.inst_mask); - m_rs->setShaderTraceRandomSeed(index,threadTraceConfig.random_seed); - if (threadTraceConfig.is_user_data) { - m_rs->setShaderTraceUserData(index,threadTraceConfig.user_data); - } - m_rs->setShaderTraceCaptureMode(index,threadTraceConfig.capture_mode); - if (threadTraceConfig.is_wrapped) { - m_rs->setShaderTraceWrap(index,true); - } - } -} - -void -CALGSLContext::endThreadTrace(gslQueryObject threadTrace,uint32 seNum) const -{ - for (uint32 index = 0;index < seNum;++index) { - m_rs->enableShaderTrace(m_cs,index,false); - } - threadTrace->EndQuery(m_cs, 0); -} - -void -CALGSLContext::pauseThreadTrace(uint32 seNum) const -{ - for (uint32 index = 0;index < seNum;++index) { - m_rs->setShaderTraceIsPaused(m_cs,index,(bool32)true); - } -} - -void -CALGSLContext::resumeThreadTrace(uint32 seNum) const -{ - for (uint32 index = 0;index < seNum;++index) { - m_rs->setShaderTraceIsPaused(m_cs,index,(bool32)false); - } -} - -void -CALGSLContext::getThreadTraceQueryRes(gslQueryObject threadTrace, uint32* info) const -{ - threadTrace->GetResultAll(m_cs, info); -} - -void -CALGSLContext::writeTimer(bool sdma, const gslMemObject mem, uint32 offset) const -{ - m_rs->writeTimer(m_cs, sdma, mem, offset); -} - -void -CALGSLContext::runAqlDispatch(GpuEvent& event, const void* aqlPacket, - const gslMemObject* mems, uint32 numMems, gslMemObject scratch, uint32 scratchOffset, - const void* cpuKernelCode, uint64 hsaQueueVA, const void* kernelInfo) -{ - eventBegin(MainEngine); - m_cs->AqlDispatch(aqlPacket, mems, numMems, scratch, scratchOffset, cpuKernelCode, hsaQueueVA, kernelInfo); - eventEnd(MainEngine, event); -} - -mcaddr -CALGSLContext::virtualQueueDispatcherStart() -{ - return m_cs->VirtualQueueDispatcherStart(); -} - -void -CALGSLContext::virtualQueueDispatcherEnd(GpuEvent& event, const gslMemObject* mems, - uint32 numMems, mcaddr signal, mcaddr loopStart, uint32 numTemplates) -{ - eventBegin(MainEngine); - m_cs->VirtualQueueDispatcherEnd(mems, numMems, signal, loopStart, numTemplates); - eventEnd(MainEngine, event); -} - -void -CALGSLContext::virtualQueueHandshake(GpuEvent& event, const gslMemObject mem, mcaddr parentState, - uint32 newStateValue, mcaddr parentChildCounter, mcaddr signal, bool dedicatedQueue) -{ - eventBegin(MainEngine); - m_cs->VirtualQueueHandshake(mem, parentState, newStateValue, parentChildCounter, signal, dedicatedQueue); - eventEnd(MainEngine, event); -} - void CALGSLContext::InvalidateSqCaches(bool instInvalidate, bool dataInvalidate, bool tcL1, bool tcL2) { diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.h b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.h index 40868d5cb2..5cdc873b25 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.h +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/GSLContext.h @@ -39,20 +39,8 @@ public: bool setUAVBuffer(uint32 physUnit, gslMemObject mem, gslUAVType uavType); void setUavMask(const CALUavMask& uavMask); void setUAVChannelOrder(uint32 physUnit, gslMemObject mem); - void setProgram(gslProgramObject func); - void setWavesPerSH(gslProgramObject func, uint32 wavesPerSH)const; - bool runProgramGrid(GpuEvent& event, const ProgramGrid* pProgramGrid, const gslMemObject* mems, uint32 numMems); - void runAqlDispatch(GpuEvent& event, const void* aqlPacket, const gslMemObject* mems, - uint32 numMems, gslMemObject scratch, uint32 scratchOffset, const void* cpuKernelCode, - uint64 hsaQueueVA, const void* kernelInfo); - mcaddr virtualQueueDispatcherStart(); - void virtualQueueDispatcherEnd(GpuEvent& event, const gslMemObject* mems, uint32 numMems, - mcaddr signal, mcaddr loopStart, uint32 numTemplates); - void virtualQueueHandshake(GpuEvent& event, const gslMemObject mem, mcaddr parentState, - uint32 newStateValue, mcaddr parentChildCounter, mcaddr signal, bool dedicatedQueue); bool isDone(GpuEvent* event); void waitForEvent(GpuEvent* event); - void flushIOCaches() const; void flushCUCaches(bool flushL2 = false) const; void eventBegin(EngineType engId) { @@ -68,53 +56,18 @@ public: event.engineId_ = engId; } - gslProgramObject createProgramObject(uint32 type); - void destroyProgramObject(gslProgramObject func); - bool copyPartial(GpuEvent& event, gslMemObject srcMem, size_t* srcOffset, gslMemObject destMem, size_t* destOffset, size_t* size, CALmemcopyflags flags, bool enableCopyRect, uint32 bytesPerElement); void setSamplerParameter(uint32 sampler, gslTexParameterPname param, CALvoid* vals); - gslQueryObject createCounter(gslQueryTarget target) const; - void configPerformanceCounter(gslQueryObject counter, CALuint block, CALuint index, CALuint event) const; - void destroyCounter(gslQueryObject counter) const; - void beginCounter(gslQueryObject counter, gslQueryTarget target) const; - void endCounter(gslQueryObject counter, GpuEvent& event); - void getCounter(uint64* result, gslQueryObject counter) const; - - gslMemObject createConstants(uint32 count) const; - void setConstants(gslMemObject constants) const; - void destroyConstants(gslMemObject constants) const; - bool recompileShader(CALimage srcImage, CALimage* newImage, const CALuint type); bool getMachineType(CALuint* pMachine, CALuint* pType, CALimage image); - void getFuncInfo(gslProgramObject func, gslProgramTarget target, CALfuncInfo* pInfo); - - void bindAtomicCounter(uint32 index, gslMemObject obj); - void syncAtomicCounter(GpuEvent& event, uint32 index, bool read); - - void setGWSResource(uint32 index, uint32 value); - - void ReleaseOutputResource(CALuint taskID, CALuint flags); bool moduleLoad(CALimage image, gslProgramObject* func, gslMemObject* constants, CALUavMask* uavMask); - bool WaitSignal(gslMemObject mem, CALuint value); - bool WriteSignal(gslMemObject mem, CALuint value, CALuint64 offset); - bool MakeBuffersResident(CALuint numObjects, gslMemObject* pMemObjects, CALuint64* surfBusAddress, CALuint64* markerBusAddress); - gslQueryObject createThreadTrace(void) const; - void destroyThreadTrace(gslQueryObject) const; - gslShaderTraceBufferObject CreateThreadTraceBuffer(void) const; - void DestroyThreadTraceBuffer(gslShaderTraceBufferObject,uint32) const; - void getThreadTraceQueryRes(gslQueryObject, uint32* info) const; - void configMemThreadTrace(gslShaderTraceBufferObject,gslMemObject,uint32,uint32) const; - void beginThreadTrace(gslQueryObject,gslQueryObject, gslQueryTarget,uint32,CALthreadTraceConfig&) const; - void endThreadTrace(gslQueryObject,uint32) const; - void pauseThreadTrace(uint32) const; - void resumeThreadTrace(uint32) const; - void writeTimer(bool sdma, const gslMemObject mem, uint32 offset) const; - void writeSurfRaw(GpuEvent& event, gslMemObject mem, size_t size, const void* data); + gsl::gsCtx* cs() const { return m_cs; } + gslRenderState rs() const { return m_rs; } /// HW Debug support functions void InvalidateSqCaches(bool instInvalidate = true, bool dataInvalidate = true, bool tcL1 = true, bool tcL2 = true); @@ -142,7 +95,6 @@ private: gsl::gsCtx* m_cs; gslRenderState m_rs; - gslConstantBufferObject m_constantBuffers[MAX_CONSTANTBUFFERS]; gslUAVObject m_uavResources[MAX_UAVS]; gslTextureResourceObject m_textureResources[MAX_RESOURCES]; diff --git a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/backend.h b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/backend.h index 762c380d6b..8e28228bb7 100644 --- a/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/backend.h +++ b/projects/clr/rocclr/runtime/device/gpu/gslbe/src/rt/backend.h @@ -191,28 +191,6 @@ typedef enum CALresallocsliceviewflagsRec { CAL_RESALLOCSLICEVIEW_LEVEL_AND_LAYER = CAL_RESALLOCSLICEVIEW_LEVEL | CAL_RESALLOCSLICEVIEW_LAYER, } CALresallocsliceviewflags; -// -// Thread Trace Extension -// - -typedef struct CALthreadTraceConfigRec CALthreadTraceConfig; - -struct CALthreadTraceConfigRec -{ - CALuint cu; // target compute unit [cu] - CALuint sh; // target shader array [sh],that contains target cu - CALuint simd_mask; // bitmask to enable or disable target tokens for different SIMDs - CALuint vm_id_mask; // virtual memory [vm] IDs to capture - CALuint token_mask; // bitmask indicating which trace token IDs will be included in the trace - CALuint reg_mask; // bitmask indicating which register types should be included in the trace - CALuint inst_mask; // types of instruction scheduling updates which should be recorded - CALuint random_seed; // linear feedback shift register [LFSR] seed - CALuint user_data; // user data ,which is written as payload - CALuint capture_mode; // indicator for the way how THREAD_TRACE_START / STOP events affect token collection - CALboolean is_user_data; // indicator if user_data is set - CALboolean is_wrapped; // indicator if the memory buffer should be wrapped around instead of stopping at the end -}; - typedef enum CALmemcopyflagsEnum { CAL_MEMCOPY_DEFAULT = 0, /**< default CAL behavior of partial sync */