From fab3c896255746d160604a24c9cf593a598501f8 Mon Sep 17 00:00:00 2001 From: Andrzej Swierczynski Date: Tue, 11 Jun 2019 13:43:51 +0200 Subject: [PATCH] Changed performance hint message pointers to be constant Change-Id: If9c4882ff3a99c561dbe3ea8780da6d5a4b45f77 Signed-off-by: Andrzej Swierczynski --- runtime/context/driver_diagnostics.cpp | 2 +- runtime/context/driver_diagnostics.h | 2 +- runtime/mem_obj/image.cpp | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/runtime/context/driver_diagnostics.cpp b/runtime/context/driver_diagnostics.cpp index d136c46de9..857efc1500 100644 --- a/runtime/context/driver_diagnostics.cpp +++ b/runtime/context/driver_diagnostics.cpp @@ -19,7 +19,7 @@ bool DriverDiagnostics::validFlags(cl_diagnostics_verbose_level flags) const { return !!(verboseLevel & flags); } -const char *DriverDiagnostics::hintFormat[] = { +const char *const 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 diff --git a/runtime/context/driver_diagnostics.h b/runtime/context/driver_diagnostics.h index f7457f8af7..e18a0be46a 100644 --- a/runtime/context/driver_diagnostics.h +++ b/runtime/context/driver_diagnostics.h @@ -55,7 +55,7 @@ class DriverDiagnostics { DriverDiagnostics(cl_diagnostics_verbose_level level); bool validFlags(cl_diagnostics_verbose_level flags) const; ~DriverDiagnostics() = default; - static const char *hintFormat[]; + static const char *const hintFormat[]; static const cl_int maxHintStringSize = 1024; PerformanceHints obtainHintForTransferOperation(cl_command_type commandType, bool transferRequired); diff --git a/runtime/mem_obj/image.cpp b/runtime/mem_obj/image.cpp index 292aaeab95..fe352dddd6 100644 --- a/runtime/mem_obj/image.cpp +++ b/runtime/mem_obj/image.cpp @@ -1015,14 +1015,13 @@ Image *Image::validateAndCreateImage(Context *context, errcodeRet = CL_INVALID_OPERATION; return nullptr; } - SurfaceFormatInfo *surfaceFormat = nullptr; Image *image = nullptr; do { errcodeRet = Image::validateImageFormat(imageFormat); if (CL_SUCCESS != errcodeRet) { break; } - surfaceFormat = (SurfaceFormatInfo *)Image::getSurfaceFormatFromTable(flags, imageFormat); + auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, imageFormat); errcodeRet = Image::validate(context, flags, surfaceFormat, imageDesc, hostPtr); if (CL_SUCCESS != errcodeRet) { break;