From 5ec0342e6a5b0caa168605cb0242887628b9e2a8 Mon Sep 17 00:00:00 2001
From: foreman
Date: Tue, 5 Jan 2016 02:06:10 -0500
Subject: [PATCH] P4 to Git Change 1224643 by tcohen@tcohen_TLV-TZACHI-OCL on
2016/01/05 01:59:28
SWDEV-78467 - Adding 'CL_FILE_SIZE_AMD' queriable property for file objects.
While validating the LF extension we noticed a common use case in which the programmer has to query the size of the file being processed.
This enhancement will save the programming overhead of opening and closing files using some other API just in order to query their size.
This feature is being integrated from LF dev branch 15.30.1023.
Affected files ...
... //depot/stg/opencl/drivers/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp#12 edit
... //depot/stg/opencl/drivers/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h#23 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/memory.hpp#95 integrate
---
opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp | 13 +++++++++++--
.../opencl/khronos/headers/opencl2.0/CL/cl_ext.h | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp b/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp
index 4c4981be35..e6f6540160 100644
--- a/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp
+++ b/opencl/api/opencl/amdocl/cl_lqdflash_amd.cpp
@@ -50,6 +50,10 @@ LiquidFlashFile::open()
if (lfGetFileBlockSize((lf_file)handle_, &blockSize_) != lf_success) {
return false;
}
+
+ if (lfGetFileSize((lf_file)handle_, &fileSize_) != lf_success) {
+ return false;
+ }
return true;
#else
return false;
@@ -136,9 +140,14 @@ RUNTIME_ENTRY(cl_int, clGetFileObjectInfoAMD, (
switch (param_name) {
case CL_FILE_BLOCK_SIZE_AMD: {
- cl_uint size = as_amd(file)->blockSize();
+ cl_uint blockSize = as_amd(file)->blockSize();
return amd::clGetInfo(
- size, param_value_size, param_value, param_value_size_ret);
+ blockSize, param_value_size, param_value, param_value_size_ret);
+ }
+ case CL_FILE_SIZE_AMD: {
+ cl_ulong fileSize = as_amd(file)->fileSize();
+ return amd::clGetInfo(
+ fileSize, param_value_size, param_value, param_value_size_ret);
}
default:
break;
diff --git a/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h b/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h
index ee1af60d93..87ff3e11e9 100644
--- a/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h
+++ b/opencl/api/opencl/khronos/headers/opencl2.0/CL/cl_ext.h
@@ -469,6 +469,7 @@ typedef cl_uint cl_file_flags_amd;
typedef cl_uint cl_file_info_amd;
#define CL_FILE_BLOCK_SIZE_AMD 0x4085
+#define CL_FILE_SIZE_AMD 0x4086
typedef CL_API_ENTRY cl_file_amd
(CL_API_CALL * clCreateFileObjectAMD_fn)( cl_context /*context*/,