Provide hint when create zero copy image

Change-Id: I526a81e0d14daba98574575e8c945214b0bda810
This commit is contained in:
mplewka
2018-02-08 17:30:44 +01:00
committed by sys_ocldev
parent 92198537a6
commit 94c996a452
4 changed files with 23 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ const char *DriverDiagnostics::hintFormat[] = {
"Performance hint: clCreateBuffer with pointer %p and size %u doesn't meet alignment restrictions. Size should be aligned to %u bytes and pointer should be aligned to %u. Buffer is not sharing the same physical memory with CPU.", //CL_BUFFER_DOESNT_MEET_ALIGNMENT_RESTRICTIONS
"Performance hint: clCreateBuffer with pointer %p and size %u meets alignment restrictions and buffer will share the same physical memory with CPU.", //CL_BUFFER_MEETS_ALIGNMENT_RESTRICTIONS
"Performance hint: clCreateBuffer needs to allocate memory for buffer. For subsequent operations the buffer will share the same physical memory with CPU.", //CL_BUFFER_NEEDS_ALLOCATE_MEMORY
"Performance hint: clCreateImage with pointer %p meets alignment restrictions and image will share the same physical memory with CPU.", //CL_IMAGE_MEETS_ALIGNMENT_RESTRICTIONS
"Performance hint: Driver calls internal clFlush on the command queue each time 1 command is enqueued.", //DRIVER_CALLS_INTERNAL_CL_FLUSH
"Performance hint: Profiling adds overhead on all enqueue commands with events.", //PROFILING_ENABLED
"Performance hint: Profiled kernels will be executed with disabled preemption.", //PROFILING_ENABLED_WITH_DISABLED_PREEMPTION

View File

@@ -29,6 +29,7 @@ enum PerformanceHints {
CL_BUFFER_DOESNT_MEET_ALIGNMENT_RESTRICTIONS,
CL_BUFFER_MEETS_ALIGNMENT_RESTRICTIONS,
CL_BUFFER_NEEDS_ALLOCATE_MEMORY,
CL_IMAGE_MEETS_ALIGNMENT_RESTRICTIONS,
DRIVER_CALLS_INTERNAL_CL_FLUSH,
PROFILING_ENABLED,
PROFILING_ENABLED_WITH_DISABLED_PREEMPTION,

View File

@@ -325,7 +325,9 @@ Image *Image::create(Context *context,
image->setParentSharingHandler(parentBuffer->getSharingHandler());
}
errcodeRet = CL_SUCCESS;
if (context->isProvidingPerformanceHints() && image->isMemObjZeroCopy()) {
context->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL, CL_IMAGE_MEETS_ALIGNMENT_RESTRICTIONS, static_cast<cl_mem>(image));
}
if (transferNeeded) {
std::array<size_t, 3> copyOrigin = {{0, 0, 0}};
std::array<size_t, 3> copyRegion = {{imageWidth, imageHeight, std::max(imageDepth, imageCount)}};