P4 to Git Change 1136853 by yaxunl@yaxunl_stg_win50 on 2015/04/01 19:36:09

ECR #304775 - Implement profile driven wave limiter Part 2/2: OCL changes.

	Profile driven wave limiter measures kernel execution time in real time and adaptively limits the number of waves per SH. This is to mitigate cache thrashing issues.

Affected files ...

... //depot/stg/opencl/drivers/opencl/compiler/llvm32/include/llvm/Transforms/IPO/AMDKernelPerfHint.h#2 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Target/AMDIL/AMDILKernelManager.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/compiler/llvm32/lib/Transforms/IPO/AMDKernelPerfHint.cpp#2 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/device.hpp#244 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.cpp#281 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpukernel.hpp#108 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuwavelimiter.cpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gpuwavelimiter.hpp#1 add
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/include/cal/cal.h#35 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.cpp#71 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLContext.h#44 edit
... //depot/stg/opencl/drivers/opencl/runtime/device/gpu/gslbe/src/rt/GSLDevice.cpp#114 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.cpp#68 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/command.hpp#74 edit
... //depot/stg/opencl/drivers/opencl/runtime/utils/flags.hpp#228 edit


[ROCm/clr commit: 493d26db66]
This commit is contained in:
foreman
2015-04-01 19:45:26 -04:00
parent 677fb5e614
commit b847455bae
12 changed files with 375 additions and 7 deletions
@@ -58,6 +58,7 @@ const MetaDataConst ArgState[ArgStateTotal] =
{ "printfid:", KernelArg::PrintfBufId, { 0, 0, 0, 0, 0, 0, 0 } },
{ "wsh:", KernelArg::GroupingHint, { 0, 0, 0, 0, 0, 0, 0 } },
{ "vth:", KernelArg::VecTypeHint, { 0, 0, 0, 0, 0, 0, 0 } },
{ "limitwave:", KernelArg::LimitWave, { 0, 0, 0, 0, 0, 0, 0 } },
};
const DataTypeConst DataType[] =
@@ -829,6 +830,10 @@ Kernel::create(
}
}
// Wave limiter needs to be initialized after kernel metadata is parsed
// Since it depends on it.
waveLimiter_.enable();
if (result) {
buildError_ = CL_SUCCESS;
}
@@ -846,6 +851,7 @@ Kernel::Kernel(
const InitData* initData)
: NullKernel(name, gpuDev, prog)
, blitKernelHack_(false)
, waveLimiter_(this)
{
hwPrivateSize_ = 0;
if (NULL != initData) {
@@ -1671,6 +1677,7 @@ Kernel::run(VirtualGPU& gpu, GpuEvent* calEvent, bool lastRun) const
}
}
gpu.setWavesPerSH(gpu.gslKernelDesc()->func_, waveLimiter_.getWavesPerSH());
if (!gpu.runProgramGrid(*calEvent,
const_cast<ProgramGrid*>(&gpu.cal()->progGrid_), gpu.vmMems(), gpu.cal_.memCount_)) {
LogError("Failed to execute the program!");
@@ -2711,6 +2718,15 @@ NullKernel::parseArguments(const std::string& metaData, uint* uavRefCount)
}
// Process next ...
continue;
case KernelArg::LimitWave:
{
uint tmp;
if (!getuint(metaData, &pos, &tmp)) {
return false;
}
workGroupInfo_.limitWave_ = tmp!=0;
}
continue;
default:
break;
}