mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
[NFC] clang-format mem_host_flags (#1607)
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
committed by
GitHub
parent
8066e69b11
commit
4278d544dc
@@ -22,8 +22,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
template < class T> class C_host_memory_block
|
||||
{
|
||||
template <class T> class C_host_memory_block {
|
||||
public:
|
||||
int num_elements;
|
||||
int element_size;
|
||||
@@ -38,43 +37,33 @@ public:
|
||||
bool Equal_to(T &val);
|
||||
size_t Count(T &val);
|
||||
bool Equal(C_host_memory_block<T> &another);
|
||||
bool Equal_rect(C_host_memory_block < T > & another,
|
||||
size_t * host_origin,
|
||||
size_t * region,
|
||||
size_t host_row_pitch,
|
||||
bool Equal_rect(C_host_memory_block<T> &another, size_t *host_origin,
|
||||
size_t *region, size_t host_row_pitch,
|
||||
size_t host_slice_pitch);
|
||||
bool Equal(T *pData, int num_elements);
|
||||
|
||||
bool Equal_rect_from_orig(C_host_memory_block < T > & another,
|
||||
size_t * soffset,
|
||||
size_t * region,
|
||||
size_t host_row_pitch,
|
||||
bool Equal_rect_from_orig(C_host_memory_block<T> &another, size_t *soffset,
|
||||
size_t *region, size_t host_row_pitch,
|
||||
size_t host_slice_pitch);
|
||||
|
||||
bool Equal_rect_from_orig(T* another_pdata,
|
||||
size_t * soffset,
|
||||
size_t * region,
|
||||
size_t host_row_pitch,
|
||||
size_t host_slice_pitch);
|
||||
bool Equal_rect_from_orig(T *another_pdata, size_t *soffset, size_t *region,
|
||||
size_t host_row_pitch, size_t host_slice_pitch);
|
||||
};
|
||||
|
||||
template < class T >
|
||||
C_host_memory_block<T>::C_host_memory_block()
|
||||
template <class T> C_host_memory_block<T>::C_host_memory_block()
|
||||
{
|
||||
pData = NULL;
|
||||
element_size = sizeof(T);
|
||||
num_elements = 0;
|
||||
}
|
||||
|
||||
template < class T>
|
||||
C_host_memory_block<T>::~C_host_memory_block()
|
||||
template <class T> C_host_memory_block<T>::~C_host_memory_block()
|
||||
{
|
||||
if (pData != NULL) delete[] pData;
|
||||
num_elements = 0;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
void C_host_memory_block<T>::Init(int num_elem, T & value)
|
||||
template <class T> void C_host_memory_block<T>::Init(int num_elem, T &value)
|
||||
{
|
||||
if (pData != NULL) delete[] pData;
|
||||
pData = new T[num_elem];
|
||||
@@ -83,8 +72,7 @@ void C_host_memory_block<T>::Init(int num_elem, T & value)
|
||||
num_elements = num_elem;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
void C_host_memory_block<T>::Init(int num_elem)
|
||||
template <class T> void C_host_memory_block<T>::Init(int num_elem)
|
||||
{
|
||||
if (pData != NULL) delete[] pData;
|
||||
pData = new T[num_elem];
|
||||
@@ -92,28 +80,24 @@ void C_host_memory_block<T>::Init(int num_elem)
|
||||
|
||||
num_elements = num_elem;
|
||||
}
|
||||
template < class T >
|
||||
void C_host_memory_block<T>::Set_to_zero()
|
||||
template <class T> void C_host_memory_block<T>::Set_to_zero()
|
||||
{
|
||||
T v = 0;
|
||||
Set_to(v);
|
||||
}
|
||||
|
||||
template < class T >
|
||||
void C_host_memory_block<T>::Set_to(T &val)
|
||||
template <class T> void C_host_memory_block<T>::Set_to(T &val)
|
||||
{
|
||||
for (int i=0; i<num_elements; i++)
|
||||
pData[i] = val;
|
||||
for (int i = 0; i < num_elements; i++) pData[i] = val;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
bool C_host_memory_block<T>::Equal_to(T &val)
|
||||
template <class T> bool C_host_memory_block<T>::Equal_to(T &val)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i=0; i<num_elements; i++) {
|
||||
if (pData[i] == val)
|
||||
count++;
|
||||
for (int i = 0; i < num_elements; i++)
|
||||
{
|
||||
if (pData[i] == val) count++;
|
||||
}
|
||||
|
||||
return (count == num_elements);
|
||||
@@ -124,9 +108,9 @@ bool C_host_memory_block<T>::Equal(C_host_memory_block < T > & another)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i=0; i<num_elements; i++) {
|
||||
if (pData[i] == another.pData[i])
|
||||
count++;
|
||||
for (int i = 0; i < num_elements; i++)
|
||||
{
|
||||
if (pData[i] == another.pData[i]) count++;
|
||||
}
|
||||
|
||||
return (count == num_elements);
|
||||
@@ -135,26 +119,24 @@ bool C_host_memory_block<T>::Equal(C_host_memory_block < T > & another)
|
||||
template <class T>
|
||||
bool C_host_memory_block<T>::Equal(T *pIn_Data, int Innum_elements)
|
||||
{
|
||||
if (this->num_elements!= Innum_elements)
|
||||
return false;
|
||||
if (this->num_elements != Innum_elements) return false;
|
||||
|
||||
int count = 0;
|
||||
|
||||
for (int i=0; i<num_elements ; i++ ) {
|
||||
if (pData[i] == pIn_Data[i])
|
||||
count++;
|
||||
for (int i = 0; i < num_elements; i++)
|
||||
{
|
||||
if (pData[i] == pIn_Data[i]) count++;
|
||||
}
|
||||
|
||||
return (count == num_elements);
|
||||
}
|
||||
|
||||
template < class T >
|
||||
size_t C_host_memory_block<T>::Count(T &val)
|
||||
template <class T> size_t C_host_memory_block<T>::Count(T &val)
|
||||
{
|
||||
size_t count = 0;
|
||||
for (int i=0; i<num_elements; i++) {
|
||||
if (pData[i] == val)
|
||||
count++;
|
||||
for (int i = 0; i < num_elements; i++)
|
||||
{
|
||||
if (pData[i] == val) count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
@@ -162,8 +144,7 @@ size_t C_host_memory_block<T>::Count(T &val)
|
||||
|
||||
template <class T>
|
||||
bool C_host_memory_block<T>::Equal_rect(C_host_memory_block<T> &another,
|
||||
size_t * soffset,
|
||||
size_t * region,
|
||||
size_t *soffset, size_t *region,
|
||||
size_t host_row_pitch,
|
||||
size_t host_slice_pitch)
|
||||
{
|
||||
@@ -175,25 +156,23 @@ bool C_host_memory_block<T>::Equal_rect(C_host_memory_block < T > & another,
|
||||
size_t total = region[0] * region[1] * region[2];
|
||||
|
||||
size_t x, y, z;
|
||||
size_t orig = (size_t)(soffset[0] + row_pitch*soffset[1] + slice_pitch * soffset[2]);
|
||||
size_t orig = (size_t)(soffset[0] + row_pitch * soffset[1]
|
||||
+ slice_pitch * soffset[2]);
|
||||
for (z = 0; z < region[2]; z++)
|
||||
for (y = 0; y < region[1]; y++)
|
||||
for (x = 0; x < region[0]; x++)
|
||||
{
|
||||
int p1 = (int)(x + row_pitch * y + slice_pitch * z + orig);
|
||||
if (pData[p1] == another.pData[p1])
|
||||
count++;
|
||||
if (pData[p1] == another.pData[p1]) count++;
|
||||
}
|
||||
|
||||
return (count == total);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool C_host_memory_block<T>::Equal_rect_from_orig(C_host_memory_block < T > & another,
|
||||
size_t * soffset,
|
||||
size_t * region,
|
||||
size_t host_row_pitch,
|
||||
size_t host_slice_pitch)
|
||||
bool C_host_memory_block<T>::Equal_rect_from_orig(
|
||||
C_host_memory_block<T> &another, size_t *soffset, size_t *region,
|
||||
size_t host_row_pitch, size_t host_slice_pitch)
|
||||
{
|
||||
size_t row_pitch = host_row_pitch ? host_row_pitch : region[0];
|
||||
size_t slice_pitch = host_slice_pitch ? host_row_pitch : region[1];
|
||||
@@ -203,15 +182,15 @@ bool C_host_memory_block<T>::Equal_rect_from_orig(C_host_memory_block < T > & an
|
||||
size_t total = region[0] * region[1] * region[2];
|
||||
|
||||
size_t x, y, z;
|
||||
size_t orig = soffset[0] + row_pitch * soffset[1] + slice_pitch * soffset[2];
|
||||
size_t orig =
|
||||
soffset[0] + row_pitch * soffset[1] + slice_pitch * soffset[2];
|
||||
for (z = 0; z < region[2]; z++)
|
||||
for (y = 0; y < region[1]; y++)
|
||||
for (x = 0; x < region[0]; x++)
|
||||
{
|
||||
size_t p1 = x + (row_pitch * y) + (slice_pitch * z);
|
||||
size_t p2 = p1 + orig;
|
||||
if (pData[p2] == another.pData[p1])
|
||||
count++;
|
||||
if (pData[p2] == another.pData[p1]) count++;
|
||||
}
|
||||
|
||||
return (count == total);
|
||||
@@ -232,15 +211,15 @@ bool C_host_memory_block<T>::Equal_rect_from_orig(T* another_pdata,
|
||||
size_t total = region[0] * region[1] * region[2];
|
||||
|
||||
size_t x, y, z;
|
||||
size_t orig = soffset[0] + row_pitch*soffset[1] + slice_pitch * soffset[2];
|
||||
size_t orig =
|
||||
soffset[0] + row_pitch * soffset[1] + slice_pitch * soffset[2];
|
||||
for (z = 0; z < region[2]; z++)
|
||||
for (y = 0; y < region[1]; y++)
|
||||
for (x = 0; x < region[0]; x++)
|
||||
{
|
||||
size_t p1 = x + (row_pitch * y) + (slice_pitch * z);
|
||||
size_t p2 = p1 + orig;
|
||||
if (pData[p2] == another_pdata[p1])
|
||||
count++;
|
||||
if (pData[p2] == another_pdata[p1]) count++;
|
||||
}
|
||||
|
||||
return (count == total);
|
||||
|
||||
@@ -27,14 +27,21 @@
|
||||
#define TEST_VALUE 5
|
||||
typedef cl_char TEST_ELEMENT_TYPE;
|
||||
|
||||
enum {SUCCESS, FAILURE=-1000};
|
||||
enum
|
||||
{
|
||||
SUCCESS,
|
||||
FAILURE = -1000
|
||||
};
|
||||
|
||||
extern const char *buffer_write_kernel_code[];
|
||||
|
||||
enum BUFFER_TYPE {_BUFFER, _Sub_BUFFER};
|
||||
|
||||
template < class T > class cBuffer_checker
|
||||
enum BUFFER_TYPE
|
||||
{
|
||||
_BUFFER,
|
||||
_Sub_BUFFER
|
||||
};
|
||||
|
||||
template <class T> class cBuffer_checker {
|
||||
public:
|
||||
cBuffer_checker(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue);
|
||||
@@ -77,7 +84,10 @@ public:
|
||||
size_t host_slice_pitch_bytes;
|
||||
|
||||
cl_int CreateBuffer(cl_mem_flags buffer_mem_flag, void *pdata);
|
||||
int get_block_size_bytes() { return (int)(m_nNumber_elements * sizeof(T)); };
|
||||
int get_block_size_bytes()
|
||||
{
|
||||
return (int)(m_nNumber_elements * sizeof(T));
|
||||
};
|
||||
virtual cl_int SetupBuffer() = 0;
|
||||
|
||||
virtual cl_int Setup_Test_Environment();
|
||||
@@ -116,9 +126,11 @@ cBuffer_checker<T>::cBuffer_checker(cl_device_id deviceID, cl_context context,
|
||||
buffer_origin[0] = buffer_origin[1] = buffer_origin[2] = 0;
|
||||
host_origin[0] = host_origin[1] = host_origin[2] = 0;
|
||||
region[0] = region[1] = region[2] = 0;
|
||||
buffer_row_pitch = buffer_slice_pitch = host_row_pitch = host_slice_pitch = 0;
|
||||
buffer_row_pitch = buffer_slice_pitch = host_row_pitch = host_slice_pitch =
|
||||
0;
|
||||
|
||||
buffer_origin_bytes[0] = buffer_origin_bytes[1] = buffer_origin_bytes[2] = 0;
|
||||
buffer_origin_bytes[0] = buffer_origin_bytes[1] = buffer_origin_bytes[2] =
|
||||
0;
|
||||
host_origin_bytes[0] = host_origin_bytes[1] = host_origin_bytes[2] = 0;
|
||||
region_bytes[0] = region_bytes[1] = region_bytes[2] = 0;
|
||||
buffer_row_pitch_bytes = buffer_slice_pitch_bytes = 0;
|
||||
@@ -127,21 +139,16 @@ cBuffer_checker<T>::cBuffer_checker(cl_device_id deviceID, cl_context context,
|
||||
pHost_ptr = NULL;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
cBuffer_checker<T>::~cBuffer_checker()
|
||||
{
|
||||
}
|
||||
template <class T> cBuffer_checker<T>::~cBuffer_checker() {}
|
||||
|
||||
|
||||
template < class T >
|
||||
cl_int cBuffer_checker<T>::SetupBuffer()
|
||||
template <class T> cl_int cBuffer_checker<T>::SetupBuffer()
|
||||
{
|
||||
m_buffer_type = _BUFFER;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
cl_int cBuffer_checker<T>::Setup_Test_Environment()
|
||||
template <class T> cl_int cBuffer_checker<T>::Setup_Test_Environment()
|
||||
{
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
@@ -159,14 +166,17 @@ cl_int cBuffer_checker<T>::SetupASSubBuffer(cl_mem_flags parent_buffer_flag)
|
||||
|
||||
this->host_m_0.Init(supersize);
|
||||
|
||||
m_buffer_parent = clCreateBuffer(this->m_context, parent_buffer_flag,
|
||||
block_size_in_byte, this->host_m_0.pData, &err);
|
||||
m_buffer_parent =
|
||||
clCreateBuffer(this->m_context, parent_buffer_flag, block_size_in_byte,
|
||||
this->host_m_0.pData, &err);
|
||||
test_error(err, "clCreateBuffer error");
|
||||
|
||||
int size = this->m_nNumber_elements; // the size of subbuffer in elements
|
||||
|
||||
cl_uint base_addr_align_bits;
|
||||
err = clGetDeviceInfo(m_deviceID, CL_DEVICE_MEM_BASE_ADDR_ALIGN, sizeof base_addr_align_bits, &base_addr_align_bits, NULL);
|
||||
err = clGetDeviceInfo(m_deviceID, CL_DEVICE_MEM_BASE_ADDR_ALIGN,
|
||||
sizeof base_addr_align_bits, &base_addr_align_bits,
|
||||
NULL);
|
||||
test_error(err, "clGetDeviceInfo for CL_DEVICE_MEM_BASE_ADDR_ALIGN");
|
||||
|
||||
int base_addr_align_bytes = base_addr_align_bits / 8;
|
||||
@@ -176,7 +186,8 @@ cl_int cBuffer_checker<T>::SetupASSubBuffer(cl_mem_flags parent_buffer_flag)
|
||||
int region[3] = { size, 1, 1 };
|
||||
int buffer_pitch[2] = { 0, 0 };
|
||||
int host_pitch[2] = { 0, 0 };
|
||||
this->Init_rect(buffer_origin, host_origin, region, buffer_pitch, host_pitch);
|
||||
this->Init_rect(buffer_origin, host_origin, region, buffer_pitch,
|
||||
host_pitch);
|
||||
|
||||
this->m_nNumber_elements = size; // the size of subbuffer in elements
|
||||
this->host_m_1.Init(this->m_nNumber_elements, vv1);
|
||||
@@ -187,16 +198,24 @@ cl_int cBuffer_checker<T>::SetupASSubBuffer(cl_mem_flags parent_buffer_flag)
|
||||
cl_int err = CL_SUCCESS;
|
||||
err = clEnqueueReadBufferRect(
|
||||
this->m_queue, m_buffer_parent, CL_TRUE, this->buffer_origin_bytes,
|
||||
this->host_origin_bytes, this->region_bytes, this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes, this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes, this->host_m_1.pData, 0, NULL,
|
||||
this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
this->host_m_1.pData, 0, NULL,
|
||||
NULL); // update the mem_1
|
||||
|
||||
if (err == CL_SUCCESS && (parent_buffer_flag & (CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_NO_ACCESS))) {
|
||||
log_error("Calling clEnqueueReadBufferRect on a memory object created with the CL_MEM_HOST_WRITE_ONLY flag or the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS
|
||||
&& (parent_buffer_flag
|
||||
& (CL_MEM_HOST_WRITE_ONLY | CL_MEM_HOST_NO_ACCESS)))
|
||||
{
|
||||
log_error("Calling clEnqueueReadBufferRect on a memory object created "
|
||||
"with the CL_MEM_HOST_WRITE_ONLY flag or the "
|
||||
"CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return err;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -208,13 +227,15 @@ cl_int cBuffer_checker<T>::SetupASSubBuffer(cl_mem_flags parent_buffer_flag)
|
||||
else if (parent_buffer_flag & CL_MEM_HOST_NO_ACCESS)
|
||||
f = CL_MEM_HOST_NO_ACCESS;
|
||||
|
||||
m_buffer = clCreateSubBuffer(m_buffer_parent, f, CL_BUFFER_CREATE_TYPE_REGION,
|
||||
m_buffer =
|
||||
clCreateSubBuffer(m_buffer_parent, f, CL_BUFFER_CREATE_TYPE_REGION,
|
||||
&(this->m_sub_buffer_region), &err);
|
||||
test_error(err, "clCreateSubBuffer error");
|
||||
|
||||
if (parent_buffer_flag | CL_MEM_USE_HOST_PTR)
|
||||
{
|
||||
this->pHost_ptr = (this->host_m_0.pData + this->m_sub_buffer_region.origin/sizeof(T));
|
||||
this->pHost_ptr = (this->host_m_0.pData
|
||||
+ this->m_sub_buffer_region.origin / sizeof(T));
|
||||
}
|
||||
|
||||
T vv2 = 0;
|
||||
@@ -230,12 +251,14 @@ cl_int cBuffer_checker<T>::verify(cl_int err, cl_event & event)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cBuffer_checker<T>::CreateBuffer(cl_mem_flags buffer_mem_flag, void *pdata)
|
||||
cl_int cBuffer_checker<T>::CreateBuffer(cl_mem_flags buffer_mem_flag,
|
||||
void *pdata)
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
int block_size_in_byte = m_nNumber_elements * sizeof(T);
|
||||
|
||||
m_buffer = clCreateBuffer(m_context, buffer_mem_flag, block_size_in_byte, pdata, &err);
|
||||
m_buffer = clCreateBuffer(m_context, buffer_mem_flag, block_size_in_byte,
|
||||
pdata, &err);
|
||||
|
||||
return err;
|
||||
};
|
||||
@@ -248,8 +271,10 @@ cl_int cBuffer_checker<T>::Check_GetMemObjectInfo(cl_mem_flags buffer_mem_flag)
|
||||
err = clGetMemObjectInfo(this->m_buffer, CL_MEM_FLAGS, sizeof(cl_mem_flags),
|
||||
&buffer_mem_flag_Check, NULL);
|
||||
|
||||
if (buffer_mem_flag_Check != buffer_mem_flag) {
|
||||
log_error("clGetMemObjectInfo result differs from the specified result\n");
|
||||
if (buffer_mem_flag_Check != buffer_mem_flag)
|
||||
{
|
||||
log_error(
|
||||
"clGetMemObjectInfo result differs from the specified result\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -257,16 +282,14 @@ cl_int cBuffer_checker<T>::Check_GetMemObjectInfo(cl_mem_flags buffer_mem_flag)
|
||||
err = clGetMemObjectInfo(this->m_buffer, CL_MEM_REFERENCE_COUNT,
|
||||
sizeof(cl_uint), &count, NULL);
|
||||
|
||||
if (count > 1)
|
||||
log_info("========= buffer count %d\n", count);
|
||||
if (count > 1) log_info("========= buffer count %d\n", count);
|
||||
|
||||
test_error(err, "clGetMemObjectInfo failed");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
void cBuffer_checker<T>::Init_rect ()
|
||||
template <class T> void cBuffer_checker<T>::Init_rect()
|
||||
{
|
||||
int buffer_origin[3] = { 10, 0, 0 };
|
||||
int host_origin[3] = { 10, 0, 0 };
|
||||
@@ -274,12 +297,14 @@ void cBuffer_checker<T>::Init_rect ()
|
||||
int buffer_pitch[2] = { 0, 0 };
|
||||
int host_pitch[2] = { 0, 0 };
|
||||
|
||||
this->Init_rect(buffer_origin, host_origin, region, buffer_pitch, host_pitch);
|
||||
this->Init_rect(buffer_origin, host_origin, region, buffer_pitch,
|
||||
host_pitch);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void cBuffer_checker<T>::Init_rect(int bufforg[3], int host_org[3],
|
||||
int region_in[3], int buffer_pitch[2], int host_pitch[2])
|
||||
int region_in[3], int buffer_pitch[2],
|
||||
int host_pitch[2])
|
||||
{
|
||||
buffer_origin[0] = bufforg[0];
|
||||
buffer_origin[1] = bufforg[1];
|
||||
|
||||
@@ -19,13 +19,13 @@
|
||||
#include "checker_image_mem_host_write_only.hpp"
|
||||
|
||||
template <class T>
|
||||
class cImage_check_mem_host_no_access : public cImage_check_mem_host_write_only<T>
|
||||
{
|
||||
class cImage_check_mem_host_no_access
|
||||
: public cImage_check_mem_host_write_only<T> {
|
||||
public:
|
||||
cImage_check_mem_host_no_access (cl_device_id deviceID, cl_context context, cl_command_queue queue)
|
||||
cImage_check_mem_host_no_access(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue)
|
||||
: cImage_check_mem_host_write_only<T>(deviceID, context, queue)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
~cImage_check_mem_host_no_access(){};
|
||||
|
||||
@@ -33,8 +33,7 @@ public:
|
||||
cl_int verify_RW_Image_Mapping();
|
||||
};
|
||||
|
||||
template < class T>
|
||||
cl_int cImage_check_mem_host_no_access<T>:: verify_RW_Image()
|
||||
template <class T> cl_int cImage_check_mem_host_no_access<T>::verify_RW_Image()
|
||||
{
|
||||
this->Init_rect();
|
||||
|
||||
@@ -47,13 +46,12 @@ cl_int cImage_check_mem_host_no_access<T>:: verify_RW_Image()
|
||||
|
||||
int color[4] = { 0xFF, 0xFF, 0xFF, 0xFF };
|
||||
cl_int err = CL_SUCCESS;
|
||||
err = clEnqueueFillImage(this->m_queue, this->m_Image,
|
||||
&color,
|
||||
img_orig, img_region,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueFillImage(this->m_queue, this->m_Image, &color, img_orig,
|
||||
img_region, 0, NULL, &event);
|
||||
test_error(err, "clEnqueueFillImage error");
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
@@ -67,39 +65,48 @@ cl_int cImage_check_mem_host_no_access<T>:: verify_RW_Image()
|
||||
|
||||
T v = 0xFFFFFFFF;
|
||||
int tot = (int)(this->host_m_2.Count(v));
|
||||
if(tot != total){
|
||||
if (tot != total)
|
||||
{
|
||||
log_error("Buffer data content difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
err = clEnqueueWriteImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
this->buffer_origin, this->region,
|
||||
this-> buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_m_1.pData, 0, NULL, &event);
|
||||
err = clEnqueueWriteImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, this->buffer_origin,
|
||||
this->region, this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes, this->host_m_1.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteImage on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteImage on a memory object created with the "
|
||||
"CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return err;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
v = 0;
|
||||
this->host_m_2.Set_to(v);
|
||||
err = clEnqueueReadImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
this->buffer_origin, this->region,
|
||||
this-> buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
err = clEnqueueReadImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, this->buffer_origin,
|
||||
this->region, this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes, this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueReadImage on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueReadImage on a memory object created with the "
|
||||
"CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return err;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -115,36 +122,40 @@ cl_int cImage_check_mem_host_no_access<T>::verify_RW_Image_Mapping()
|
||||
cl_event event;
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
T * dataPtr = (T*) clEnqueueMapImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
CL_MAP_WRITE,
|
||||
this->buffer_origin, this->region,
|
||||
&(this-> buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes),
|
||||
0, NULL, &event, &err);
|
||||
T* dataPtr = (T*)clEnqueueMapImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, CL_MAP_WRITE,
|
||||
this->buffer_origin, this->region, &(this->buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes), 0, NULL, &event, &err);
|
||||
|
||||
if ( err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapImage (CL_MAP_WRITE) on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapImage (CL_MAP_WRITE) on a memory object "
|
||||
"created with the CL_MEM_HOST_NO_ACCESS flag should not "
|
||||
"return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return err;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
dataPtr = (T*) clEnqueueMapImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
CL_MAP_READ,
|
||||
this->buffer_origin, this->region,
|
||||
&(this-> buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes),
|
||||
0, NULL, &event, &err);
|
||||
dataPtr = (T*)clEnqueueMapImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, CL_MAP_READ,
|
||||
this->buffer_origin, this->region, &(this->buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes), 0, NULL, &event, &err);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapImage (CL_MAP_READ) on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapImage (CL_MAP_READ) on a memory object "
|
||||
"created with the CL_MEM_HOST_NO_ACCESS flag should not "
|
||||
"return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return err;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,11 @@
|
||||
|
||||
#include "checker.h"
|
||||
|
||||
template < class T> class cImage_check_mem_host_read_only : public cBuffer_checker<T>
|
||||
{
|
||||
template <class T>
|
||||
class cImage_check_mem_host_read_only : public cBuffer_checker<T> {
|
||||
public:
|
||||
cImage_check_mem_host_read_only(cl_device_id deviceID, cl_context context, cl_command_queue queue)
|
||||
cImage_check_mem_host_read_only(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue)
|
||||
: cBuffer_checker<T>(deviceID, context, queue)
|
||||
{
|
||||
m_cl_image_format.image_channel_order = CL_RGBA;
|
||||
@@ -41,9 +42,7 @@ public:
|
||||
m_Image = NULL;
|
||||
};
|
||||
|
||||
~cImage_check_mem_host_read_only()
|
||||
{
|
||||
};
|
||||
~cImage_check_mem_host_read_only(){};
|
||||
|
||||
cl_int get_image_elements();
|
||||
|
||||
@@ -71,9 +70,11 @@ public:
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only<T>::verify_mapping_ptr(T *dataPtr)
|
||||
{
|
||||
int offset_pixel = (int)(this->buffer_origin[0] + this->buffer_origin[1] *
|
||||
this->buffer_row_pitch_bytes/ sizeof(T) + this->buffer_origin[2] *
|
||||
this->buffer_slice_pitch_bytes/sizeof(T));
|
||||
int offset_pixel = (int)(this->buffer_origin[0]
|
||||
+ this->buffer_origin[1]
|
||||
* this->buffer_row_pitch_bytes / sizeof(T)
|
||||
+ this->buffer_origin[2]
|
||||
* this->buffer_slice_pitch_bytes / sizeof(T));
|
||||
|
||||
dataPtr = dataPtr - offset_pixel;
|
||||
|
||||
@@ -97,17 +98,24 @@ cl_int cImage_check_mem_host_read_only< T >::verify_mapping_ptr( T* dataPtr)
|
||||
return err;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
cl_int cImage_check_mem_host_read_only< T >::verify_RW_Buffer() { return CL_SUCCESS; };
|
||||
template <class T> cl_int cImage_check_mem_host_read_only<T>::verify_RW_Buffer()
|
||||
{
|
||||
return CL_SUCCESS;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only< T >::verify_RW_Buffer_rect() { return CL_SUCCESS; };
|
||||
cl_int cImage_check_mem_host_read_only<T>::verify_RW_Buffer_rect()
|
||||
{
|
||||
return CL_SUCCESS;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only< T >::verify_RW_Buffer_mapping() { return CL_SUCCESS; };
|
||||
cl_int cImage_check_mem_host_read_only<T>::verify_RW_Buffer_mapping()
|
||||
{
|
||||
return CL_SUCCESS;
|
||||
};
|
||||
|
||||
template < class T >
|
||||
cl_int cImage_check_mem_host_read_only< T >::SetupBuffer()
|
||||
template <class T> cl_int cImage_check_mem_host_read_only<T>::SetupBuffer()
|
||||
{
|
||||
return cBuffer_checker<T>::SetupBuffer();
|
||||
}
|
||||
@@ -115,38 +123,42 @@ cl_int cImage_check_mem_host_read_only< T >::SetupBuffer()
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only<T>::get_image_content_size()
|
||||
{
|
||||
return ((cl_int)(m_cl_Image_desc.image_width*m_cl_Image_desc.image_height *
|
||||
m_cl_Image_desc.image_depth * m_cl_Image_desc.image_array_size));
|
||||
return ((cl_int)(m_cl_Image_desc.image_width * m_cl_Image_desc.image_height
|
||||
* m_cl_Image_desc.image_depth
|
||||
* m_cl_Image_desc.image_array_size));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only<T>::get_image_data_size()
|
||||
{
|
||||
size_t slice_pitch = m_cl_Image_desc.image_slice_pitch ? m_cl_Image_desc.image_slice_pitch :
|
||||
(m_cl_Image_desc.image_height * m_cl_Image_desc.image_width);
|
||||
return (slice_pitch * m_cl_Image_desc.image_depth * m_cl_Image_desc.image_array_size);
|
||||
size_t slice_pitch = m_cl_Image_desc.image_slice_pitch
|
||||
? m_cl_Image_desc.image_slice_pitch
|
||||
: (m_cl_Image_desc.image_height * m_cl_Image_desc.image_width);
|
||||
return (slice_pitch * m_cl_Image_desc.image_depth
|
||||
* m_cl_Image_desc.image_array_size);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only<T>::get_image_elements()
|
||||
{
|
||||
return ((cl_int)(m_cl_Image_desc.image_width*m_cl_Image_desc.image_height *
|
||||
m_cl_Image_desc.image_depth * m_cl_Image_desc.image_array_size));
|
||||
return ((cl_int)(m_cl_Image_desc.image_width * m_cl_Image_desc.image_height
|
||||
* m_cl_Image_desc.image_depth
|
||||
* m_cl_Image_desc.image_array_size));
|
||||
}
|
||||
|
||||
template < class T >
|
||||
cl_int cImage_check_mem_host_read_only< T >::SetupImage()
|
||||
template <class T> cl_int cImage_check_mem_host_read_only<T>::SetupImage()
|
||||
{
|
||||
int all = (int)(m_cl_Image_desc.image_width * m_cl_Image_desc.image_height *
|
||||
m_cl_Image_desc.image_depth * m_cl_Image_desc.image_array_size);
|
||||
int all =
|
||||
(int)(m_cl_Image_desc.image_width * m_cl_Image_desc.image_height
|
||||
* m_cl_Image_desc.image_depth * m_cl_Image_desc.image_array_size);
|
||||
|
||||
T v = TEST_VALUE;
|
||||
this->host_m_1.Init(all, v);
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
this-> m_Image = clCreateImage(this->m_context, this->buffer_mem_flag,
|
||||
&( this-> m_cl_image_format), &(this-> m_cl_Image_desc),
|
||||
this->host_m_1.pData, &err);
|
||||
this->m_Image = clCreateImage(
|
||||
this->m_context, this->buffer_mem_flag, &(this->m_cl_image_format),
|
||||
&(this->m_cl_Image_desc), this->host_m_1.pData, &err);
|
||||
test_error(err, "clCreateImage error");
|
||||
|
||||
this->pHost_ptr = (void *)(this->host_m_1.pData);
|
||||
@@ -160,7 +172,8 @@ cl_int cImage_check_mem_host_read_only< T >::verify_data(T *pDataIN)
|
||||
cl_int err = CL_SUCCESS;
|
||||
if (!this->host_m_1.Equal_rect_from_orig(pDataIN, this->buffer_origin,
|
||||
this->region, this->host_row_pitch,
|
||||
this->host_slice_pitch)) {
|
||||
this->host_slice_pitch))
|
||||
{
|
||||
log_error("Buffer data difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -169,13 +182,15 @@ cl_int cImage_check_mem_host_read_only< T >::verify_data(T *pDataIN)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cImage_check_mem_host_read_only< T >::verify_data_with_offset(T *pDataIN,
|
||||
cl_int
|
||||
cImage_check_mem_host_read_only<T>::verify_data_with_offset(T *pDataIN,
|
||||
size_t *offset)
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
if (!this->host_m_2.Equal_rect_from_orig(pDataIN, offset, this->region,
|
||||
this->host_row_pitch,
|
||||
this->host_slice_pitch)) {
|
||||
this->host_slice_pitch))
|
||||
{
|
||||
log_error("Buffer data difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -183,8 +198,7 @@ cl_int cImage_check_mem_host_read_only< T >::verify_data_with_offset(T *pDataIN,
|
||||
return err;
|
||||
}
|
||||
|
||||
template < class T >
|
||||
cl_int cImage_check_mem_host_read_only< T >::verify_RW_Image()
|
||||
template <class T> cl_int cImage_check_mem_host_read_only<T>::verify_RW_Image()
|
||||
{
|
||||
this->Init_rect();
|
||||
|
||||
@@ -194,14 +208,15 @@ cl_int cImage_check_mem_host_read_only< T >::verify_RW_Image()
|
||||
|
||||
cl_event event;
|
||||
cl_int err = CL_SUCCESS;
|
||||
err = clEnqueueReadImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
this->buffer_origin, this->region,
|
||||
this-> buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
err = clEnqueueReadImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, this->buffer_origin,
|
||||
this->region, this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes, this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
test_error(err, "clEnqueueReadImage error");
|
||||
|
||||
if ( !this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
@@ -212,17 +227,21 @@ cl_int cImage_check_mem_host_read_only< T >::verify_RW_Image()
|
||||
err = this->verify_data(this->host_m_2.pData);
|
||||
test_error(err, "verify_data error");
|
||||
|
||||
err = clEnqueueWriteImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
this->buffer_origin, this->region,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
err = clEnqueueWriteImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, this->buffer_origin,
|
||||
this->region, this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes, this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteImage on a memory object created with the CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteImage on a memory object created with the "
|
||||
"CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -236,14 +255,13 @@ cl_int cImage_check_mem_host_read_only< T >::verify_RW_Image_Mapping()
|
||||
cl_event event;
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
T * dataPtr = (T*) clEnqueueMapImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
CL_MAP_READ,
|
||||
this->buffer_origin, this->region,
|
||||
&(this-> buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes),
|
||||
0, NULL, &event, &err);
|
||||
T *dataPtr = (T *)clEnqueueMapImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, CL_MAP_READ,
|
||||
this->buffer_origin, this->region, &(this->buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes), 0, NULL, &event, &err);
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
@@ -257,7 +275,8 @@ cl_int cImage_check_mem_host_read_only< T >::verify_RW_Image_Mapping()
|
||||
err = this->verify_data(dataPtr);
|
||||
test_error(err, "verify_data error");
|
||||
|
||||
err= clEnqueueUnmapMemObject (this->m_queue, this->m_Image, dataPtr, 0, NULL, &event);
|
||||
err = clEnqueueUnmapMemObject(this->m_queue, this->m_Image, dataPtr, 0,
|
||||
NULL, &event);
|
||||
test_error(err, "clEnqueueUnmapMemObject error");
|
||||
|
||||
err = clWaitForEvents(1, &event);
|
||||
@@ -266,20 +285,21 @@ cl_int cImage_check_mem_host_read_only< T >::verify_RW_Image_Mapping()
|
||||
err = clReleaseEvent(event);
|
||||
test_error(err, "clReleaseEvent error");
|
||||
|
||||
dataPtr = (T*) clEnqueueMapImage(this->m_queue, this->m_Image, this->m_blocking,
|
||||
CL_MAP_WRITE,
|
||||
this->buffer_origin,
|
||||
this->region,
|
||||
&(this-> buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes),
|
||||
0, NULL, &event, &err);
|
||||
dataPtr = (T *)clEnqueueMapImage(
|
||||
this->m_queue, this->m_Image, this->m_blocking, CL_MAP_WRITE,
|
||||
this->buffer_origin, this->region, &(this->buffer_row_pitch_bytes),
|
||||
&(this->buffer_slice_pitch_bytes), 0, NULL, &event, &err);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapImage (CL_MAP_WRITE) on a memory object created with the CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapImage (CL_MAP_WRITE) on a memory object "
|
||||
"created with the CL_MEM_HOST_READ_ONLY flag should not "
|
||||
"return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,17 +19,15 @@
|
||||
|
||||
#include "checker_mem_host_write_only.hpp"
|
||||
|
||||
template < class T> class cBuffer_check_mem_host_no_access : public cBuffer_check_mem_host_write_only< T >
|
||||
{
|
||||
template <class T>
|
||||
class cBuffer_check_mem_host_no_access
|
||||
: public cBuffer_check_mem_host_write_only<T> {
|
||||
public:
|
||||
cBuffer_check_mem_host_no_access(cl_device_id deviceID, cl_context context, cl_command_queue queue)
|
||||
: cBuffer_check_mem_host_write_only < T > (deviceID, context, queue)
|
||||
{
|
||||
};
|
||||
cBuffer_check_mem_host_no_access(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue)
|
||||
: cBuffer_check_mem_host_write_only<T>(deviceID, context, queue){};
|
||||
|
||||
cBuffer_check_mem_host_no_access()
|
||||
{
|
||||
};
|
||||
cBuffer_check_mem_host_no_access(){};
|
||||
|
||||
virtual cl_int SetupBuffer();
|
||||
virtual cl_int SetupASSubBuffer(cl_mem_flags parent_buffer_flag);
|
||||
@@ -40,8 +38,7 @@ public:
|
||||
cl_int verify_RW_Buffer_mapping();
|
||||
};
|
||||
|
||||
template < class T >
|
||||
cl_int cBuffer_check_mem_host_no_access< T >::SetupBuffer()
|
||||
template <class T> cl_int cBuffer_check_mem_host_no_access<T>::SetupBuffer()
|
||||
{
|
||||
this->m_nNumber_elements = 1000;
|
||||
T vv1 = TEST_VALUE;
|
||||
@@ -52,7 +49,8 @@ cl_int cBuffer_check_mem_host_no_access< T >::SetupBuffer()
|
||||
|
||||
cl_int err;
|
||||
int block_size_in_byte = this->get_block_size_bytes();
|
||||
this->m_buffer = clCreateBuffer(this->m_context, this->buffer_mem_flag,
|
||||
this->m_buffer =
|
||||
clCreateBuffer(this->m_context, this->buffer_mem_flag,
|
||||
block_size_in_byte, this->host_m_1.pData, &err);
|
||||
test_error(err, "clCreateBuffer error");
|
||||
err = this->Check_GetMemObjectInfo(this->buffer_mem_flag);
|
||||
@@ -66,7 +64,8 @@ cl_int cBuffer_check_mem_host_no_access< T >::SetupBuffer()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cBuffer_check_mem_host_no_access< T >::SetupASSubBuffer(cl_mem_flags parent_buffer_flag)
|
||||
cl_int cBuffer_check_mem_host_no_access<T>::SetupASSubBuffer(
|
||||
cl_mem_flags parent_buffer_flag)
|
||||
{
|
||||
return cBuffer_checker<T>::SetupASSubBuffer(parent_buffer_flag);
|
||||
}
|
||||
@@ -83,30 +82,38 @@ template < class T>
|
||||
cl_int cBuffer_check_mem_host_no_access<T>::verify_RW_Buffer()
|
||||
{
|
||||
cl_event event;
|
||||
cl_int err = clEnqueueReadBuffer(this->m_queue, this->m_buffer, this->m_blocking, 0,
|
||||
this->get_block_size_bytes(), this->host_m_1.pData,
|
||||
0, NULL, &event);
|
||||
cl_int err = clEnqueueReadBuffer(
|
||||
this->m_queue, this->m_buffer, this->m_blocking, 0,
|
||||
this->get_block_size_bytes(), this->host_m_1.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteBuffer on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteBuffer on a memory object created with the "
|
||||
"CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
err = clEnqueueWriteBuffer(this->m_queue, this->m_buffer, this->m_blocking, 0,
|
||||
this->get_block_size_bytes(), this->host_m_1.pData,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueWriteBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
0, this->get_block_size_bytes(),
|
||||
this->host_m_1.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteBuffer on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteBuffer on a memory object created with the "
|
||||
"CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -120,44 +127,44 @@ cl_int cBuffer_check_mem_host_no_access< T >::verify_RW_Buffer_rect()
|
||||
this->Init_rect();
|
||||
cl_event event;
|
||||
cl_int err = CL_SUCCESS;
|
||||
err = clEnqueueReadBufferRect(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes,
|
||||
this->host_origin_bytes,
|
||||
this->region_bytes,
|
||||
this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueReadBufferRect(
|
||||
this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes, this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueReadBufferRect on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueReadBufferRect on a memory object created with "
|
||||
"the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
err = clEnqueueWriteBufferRect(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes ,
|
||||
this->host_origin_bytes,
|
||||
this->region_bytes,
|
||||
this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueWriteBufferRect(
|
||||
this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes, this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteBufferRect on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteBufferRect on a memory object created with "
|
||||
"the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -172,26 +179,36 @@ cl_int cBuffer_check_mem_host_no_access< T >::verify_RW_Buffer_mapping()
|
||||
cl_int err;
|
||||
|
||||
void *dataPtr;
|
||||
dataPtr = clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking, CL_MAP_READ,
|
||||
0, this->get_block_size_bytes(), 0, NULL, &event, &err);
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_READ) on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
dataPtr = clEnqueueMapBuffer(
|
||||
this->m_queue, this->m_buffer, this->m_blocking, CL_MAP_READ, 0,
|
||||
this->get_block_size_bytes(), 0, NULL, &event, &err);
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_READ) on a memory object "
|
||||
"created with the CL_MEM_HOST_NO_ACCESS flag should not "
|
||||
"return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
dataPtr = clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking, CL_MAP_WRITE,
|
||||
0, this->get_block_size_bytes(), 0, NULL, &event, &err);
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_WRITE) on a memory object created with the CL_MEM_HOST_NO_ACCESS flag should not return CL_SUCCESS\n");
|
||||
dataPtr = clEnqueueMapBuffer(
|
||||
this->m_queue, this->m_buffer, this->m_blocking, CL_MAP_WRITE, 0,
|
||||
this->get_block_size_bytes(), 0, NULL, &event, &err);
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_WRITE) on a memory "
|
||||
"object created with the CL_MEM_HOST_NO_ACCESS flag should "
|
||||
"not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -18,17 +18,14 @@
|
||||
|
||||
#include "checker.h"
|
||||
|
||||
template < class T> class cBuffer_check_mem_host_read_only : public cBuffer_checker<T>
|
||||
{
|
||||
template <class T>
|
||||
class cBuffer_check_mem_host_read_only : public cBuffer_checker<T> {
|
||||
public:
|
||||
cBuffer_check_mem_host_read_only(cl_device_id deviceID, cl_context context, cl_command_queue queue)
|
||||
: cBuffer_checker <T> (deviceID, context, queue)
|
||||
{
|
||||
};
|
||||
cBuffer_check_mem_host_read_only(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue)
|
||||
: cBuffer_checker<T>(deviceID, context, queue){};
|
||||
|
||||
~cBuffer_check_mem_host_read_only()
|
||||
{
|
||||
};
|
||||
~cBuffer_check_mem_host_read_only(){};
|
||||
|
||||
virtual cl_int Check_GetMemObjectInfo(cl_mem_flags buffer_mem_flag);
|
||||
virtual cl_int SetupBuffer();
|
||||
@@ -41,8 +38,7 @@ public:
|
||||
cl_int verify_RW_Buffer_mapping();
|
||||
};
|
||||
|
||||
template < class T >
|
||||
cl_int cBuffer_check_mem_host_read_only< T >::SetupBuffer()
|
||||
template <class T> cl_int cBuffer_check_mem_host_read_only<T>::SetupBuffer()
|
||||
{
|
||||
this->m_buffer_type = _BUFFER;
|
||||
|
||||
@@ -53,7 +49,8 @@ cl_int cBuffer_check_mem_host_read_only< T >::SetupBuffer()
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
int block_size_in_byte = (int)(this->m_nNumber_elements * sizeof(T));
|
||||
this->m_buffer = clCreateBuffer(this->m_context, this->buffer_mem_flag,
|
||||
this->m_buffer =
|
||||
clCreateBuffer(this->m_context, this->buffer_mem_flag,
|
||||
block_size_in_byte, this->host_m_1.pData, &err);
|
||||
test_error(err, "clCreateBuffer error");
|
||||
|
||||
@@ -66,7 +63,8 @@ cl_int cBuffer_check_mem_host_read_only< T >::SetupBuffer()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cBuffer_check_mem_host_read_only<T>::SetupASSubBuffer(cl_mem_flags flag_p)
|
||||
cl_int
|
||||
cBuffer_check_mem_host_read_only<T>::SetupASSubBuffer(cl_mem_flags flag_p)
|
||||
{
|
||||
return cBuffer_checker<T>::SetupASSubBuffer(flag_p);
|
||||
}
|
||||
@@ -82,7 +80,8 @@ cl_int cBuffer_check_mem_host_read_only<T>::Setup_Test_Environment()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cBuffer_check_mem_host_read_only< T >::Check_GetMemObjectInfo(cl_mem_flags buffer_mem_flag)
|
||||
cl_int cBuffer_check_mem_host_read_only<T>::Check_GetMemObjectInfo(
|
||||
cl_mem_flags buffer_mem_flag)
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
cBuffer_checker<T>::Check_GetMemObjectInfo(buffer_mem_flag);
|
||||
@@ -90,11 +89,14 @@ cl_int cBuffer_check_mem_host_read_only< T >::Check_GetMemObjectInfo(cl_mem_flag
|
||||
if (buffer_mem_flag & CL_MEM_ALLOC_HOST_PTR)
|
||||
{
|
||||
size_t size = 0;
|
||||
err = clGetMemObjectInfo(this->m_buffer, CL_MEM_SIZE, sizeof(size), &size, NULL);
|
||||
err = clGetMemObjectInfo(this->m_buffer, CL_MEM_SIZE, sizeof(size),
|
||||
&size, NULL);
|
||||
void *pp = NULL;
|
||||
err = clGetMemObjectInfo(this->m_buffer, CL_MEM_HOST_PTR, sizeof( pp ), &pp, NULL);
|
||||
err = clGetMemObjectInfo(this->m_buffer, CL_MEM_HOST_PTR, sizeof(pp),
|
||||
&pp, NULL);
|
||||
|
||||
if (!this->host_m_1.Equal( (T*) (this->pData), this->m_nNumber_elements )) {
|
||||
if (!this->host_m_1.Equal((T *)(this->pData), this->m_nNumber_elements))
|
||||
{
|
||||
log_error("Buffer data difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -104,14 +106,17 @@ cl_int cBuffer_check_mem_host_read_only< T >::Check_GetMemObjectInfo(cl_mem_flag
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cBuffer_check_mem_host_read_only< T >::verifyData( cl_int err, cl_event & event )
|
||||
cl_int cBuffer_check_mem_host_read_only<T>::verifyData(cl_int err,
|
||||
cl_event &event)
|
||||
{
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
if (err != CL_SUCCESS) {
|
||||
err = this->m_nERROR_RETURN_CODE;
|
||||
test_error(err, "clEnqueueReadBuffer error");
|
||||
}
|
||||
|
||||
if (!this->host_m_1.Equal(this->host_m_2)) {
|
||||
if (!this->host_m_1.Equal(this->host_m_2))
|
||||
{
|
||||
err = this->m_nERROR_RETURN_CODE;
|
||||
test_error(err, "clEnqueueReadBuffer data difference found");
|
||||
}
|
||||
@@ -126,16 +131,18 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer()
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
err = clEnqueueReadBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
0, this->get_block_size_bytes(), this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
0, this->get_block_size_bytes(),
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
test_error(err, "clEnqueueReadBuffer error");
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
|
||||
if (!this->host_m_1.Equal(this->host_m_2)) {
|
||||
if (!this->host_m_1.Equal(this->host_m_2))
|
||||
{
|
||||
log_error("Buffer data difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -144,15 +151,19 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer()
|
||||
|
||||
// test write
|
||||
err = clEnqueueWriteBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
0, this->get_block_size_bytes(), this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
0, this->get_block_size_bytes(),
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteBuffer on a memory object created with the CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteBuffer on a memory object created with the "
|
||||
"CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -170,25 +181,24 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer_rect()
|
||||
cl_event event;
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
err = clEnqueueReadBufferRect(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes,
|
||||
this->host_origin_bytes,
|
||||
this->region_bytes,
|
||||
this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueReadBufferRect(
|
||||
this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes, this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
test_error(err, "clEnqueueReadBufferRect error");
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
|
||||
if (! this->host_m_1.Equal_rect(this->host_m_2, this->host_origin, this->region,
|
||||
this->host_row_pitch, this->host_slice_pitch)) {
|
||||
if (!this->host_m_1.Equal_rect(this->host_m_2, this->host_origin,
|
||||
this->region, this->host_row_pitch,
|
||||
this->host_slice_pitch))
|
||||
{
|
||||
log_error("Buffer data diffeence found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -196,23 +206,23 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer_rect()
|
||||
test_error(err, "clReleaseEvent error");
|
||||
|
||||
// test blocking write rect
|
||||
err = clEnqueueWriteBufferRect(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes,
|
||||
this->host_origin_bytes,
|
||||
this->region_bytes,
|
||||
this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueWriteBufferRect(
|
||||
this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes, this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueWriteBufferRect on a memory object created with the CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueWriteBufferRect on a memory object created with "
|
||||
"the CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -226,23 +236,26 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer_mapping()
|
||||
cl_int err = CL_SUCCESS;
|
||||
cl_event event;
|
||||
void *dataPtr;
|
||||
dataPtr = clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
CL_MAP_READ,
|
||||
0, this->get_block_size_bytes(),
|
||||
0, NULL, &event, &err);
|
||||
dataPtr = clEnqueueMapBuffer(
|
||||
this->m_queue, this->m_buffer, this->m_blocking, CL_MAP_READ, 0,
|
||||
this->get_block_size_bytes(), 0, NULL, &event, &err);
|
||||
test_error(err, "clEnqueueMapBuffer error");
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
|
||||
if ((this->buffer_mem_flag & CL_MEM_USE_HOST_PTR) && dataPtr != this->pHost_ptr ) {
|
||||
if ((this->buffer_mem_flag & CL_MEM_USE_HOST_PTR)
|
||||
&& dataPtr != this->pHost_ptr)
|
||||
{
|
||||
log_error("Mapped host pointer difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if(!this->host_m_1.Equal((T*)dataPtr, this->m_nNumber_elements)) {
|
||||
if (!this->host_m_1.Equal((T *)dataPtr, this->m_nNumber_elements))
|
||||
{
|
||||
log_error("Buffer content difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -256,16 +269,19 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer_mapping()
|
||||
|
||||
// test blocking map read
|
||||
clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
CL_MAP_WRITE,
|
||||
0, this->get_block_size_bytes(),
|
||||
0, NULL, &event, &err);
|
||||
CL_MAP_WRITE, 0, this->get_block_size_bytes(), 0, NULL,
|
||||
&event, &err);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_WRITE) on a memory object created with the CL_MEM_HOST_READ_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_WRITE) on a memory "
|
||||
"object created with the CL_MEM_HOST_READ_ONLY flag should "
|
||||
"not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -18,18 +18,17 @@
|
||||
|
||||
#include "checker.h"
|
||||
|
||||
template < class T> class cBuffer_check_mem_host_write_only : public cBuffer_checker<T>
|
||||
{
|
||||
template <class T>
|
||||
class cBuffer_check_mem_host_write_only : public cBuffer_checker<T> {
|
||||
public:
|
||||
cBuffer_check_mem_host_write_only(cl_device_id deviceID, cl_context context, cl_command_queue queue)
|
||||
cBuffer_check_mem_host_write_only(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue)
|
||||
: cBuffer_checker<T>(deviceID, context, queue)
|
||||
{
|
||||
this->m_nNumber_elements = 1000;
|
||||
};
|
||||
|
||||
~cBuffer_check_mem_host_write_only()
|
||||
{
|
||||
};
|
||||
~cBuffer_check_mem_host_write_only(){};
|
||||
|
||||
cl_program program;
|
||||
cl_kernel kernel;
|
||||
@@ -53,8 +52,7 @@ public:
|
||||
virtual cl_int verify_Buffer_initialization();
|
||||
};
|
||||
|
||||
template < class T >
|
||||
cl_int cBuffer_check_mem_host_write_only< T >::SetupBuffer()
|
||||
template <class T> cl_int cBuffer_check_mem_host_write_only<T>::SetupBuffer()
|
||||
{
|
||||
T vv1 = 0;
|
||||
this->host_m_1.Init(this->m_nNumber_elements, vv1); // zero out buffer
|
||||
@@ -63,7 +61,8 @@ cl_int cBuffer_check_mem_host_write_only< T >::SetupBuffer()
|
||||
cl_int err;
|
||||
int block_size_in_byte = this->get_block_size_bytes();
|
||||
|
||||
this->m_buffer = clCreateBuffer(this->m_context, this->buffer_mem_flag,
|
||||
this->m_buffer =
|
||||
clCreateBuffer(this->m_context, this->buffer_mem_flag,
|
||||
block_size_in_byte, this->host_m_1.pData, &err);
|
||||
test_error(err, "clCreateBuffer error");
|
||||
|
||||
@@ -78,7 +77,8 @@ cl_int cBuffer_check_mem_host_write_only< T >::SetupBuffer()
|
||||
}
|
||||
|
||||
template <class T>
|
||||
cl_int cBuffer_check_mem_host_write_only<T>::SetupASSubBuffer(cl_mem_flags flag_p)
|
||||
cl_int
|
||||
cBuffer_check_mem_host_write_only<T>::SetupASSubBuffer(cl_mem_flags flag_p)
|
||||
{
|
||||
return cBuffer_checker<T>::SetupASSubBuffer(flag_p);
|
||||
}
|
||||
@@ -91,9 +91,11 @@ cl_int cBuffer_check_mem_host_write_only< T >::Setup_Test_Environment()
|
||||
this->host_m_2.Init(this->m_nNumber_elements, vv2);
|
||||
|
||||
// init buffer2 to 0
|
||||
cl_mem_flags buffer_mem_flag2 = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_READ_ONLY;
|
||||
cl_mem_flags buffer_mem_flag2 =
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_READ_ONLY;
|
||||
this->m_buffer2 = clCreateBuffer(this->m_context, buffer_mem_flag2,
|
||||
this->get_block_size_bytes(), this->host_m_2.pData, &err);
|
||||
this->get_block_size_bytes(),
|
||||
this->host_m_2.pData, &err);
|
||||
test_error(err, "clCreateBuffer error\n");
|
||||
|
||||
return err;
|
||||
@@ -104,14 +106,16 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_Buffer_initialization()
|
||||
{
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
if (this->host_m_1.pData == NULL || this->host_m_2.pData == NULL) {
|
||||
if (this->host_m_1.pData == NULL || this->host_m_2.pData == NULL)
|
||||
{
|
||||
log_error("Data not ready\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
update_host_mem_2();
|
||||
|
||||
if (!this->host_m_1.Equal(this->host_m_2)){
|
||||
if (!this->host_m_1.Equal(this->host_m_2))
|
||||
{
|
||||
log_error("Buffer content difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -130,14 +134,16 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer()
|
||||
|
||||
cl_event event;
|
||||
cl_int err = CL_SUCCESS;
|
||||
err = clEnqueueWriteBuffer(this->m_queue, this->m_buffer, this->m_blocking, 0,
|
||||
this->get_block_size_bytes(), tmp_host_m.pData,
|
||||
0, NULL, &event);
|
||||
if (err != CL_SUCCESS ) {
|
||||
err = clEnqueueWriteBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
0, this->get_block_size_bytes(),
|
||||
tmp_host_m.pData, 0, NULL, &event);
|
||||
if (err != CL_SUCCESS)
|
||||
{
|
||||
test_error(err, "clEnqueueWriteBuffer error");
|
||||
}
|
||||
|
||||
if (!this->m_blocking){
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error")
|
||||
}
|
||||
@@ -145,28 +151,34 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer()
|
||||
err = clReleaseEvent(event);
|
||||
test_error(err, "clReleaseEvent error");
|
||||
|
||||
if (tmp_host_m.Equal(this->host_m_2)){
|
||||
if (tmp_host_m.Equal(this->host_m_2))
|
||||
{
|
||||
log_error("Test data should be different\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
update_host_mem_2();
|
||||
|
||||
if (!tmp_host_m.Equal(this->host_m_2)){
|
||||
if (!tmp_host_m.Equal(this->host_m_2))
|
||||
{
|
||||
log_error("Buffer content difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
err = clEnqueueReadBuffer(this->m_queue, this->m_buffer, CL_TRUE, 0,
|
||||
this->get_block_size_bytes(), this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
this->get_block_size_bytes(),
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if ( err == CL_SUCCESS ) {
|
||||
log_error("Calling clEnqueueReadBuffer on a memory object created with the CL_MEM_HOST_WRITE_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueReadBuffer on a memory object created with the "
|
||||
"CL_MEM_HOST_WRITE_ONLY flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -199,24 +211,22 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_rect()
|
||||
|
||||
vv1 = TEST_VALUE;
|
||||
tmp_host_m.Set_to(vv1);
|
||||
err = clEnqueueWriteBufferRect(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes,
|
||||
this->host_origin_bytes,
|
||||
this->region_bytes,
|
||||
this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes,
|
||||
tmp_host_m.pData,
|
||||
1, &event_1, &event);
|
||||
err = clEnqueueWriteBufferRect(
|
||||
this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes, this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
tmp_host_m.pData, 1, &event_1, &event);
|
||||
test_error(err, "clEnqueueWriteBufferRect error");
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error")
|
||||
}
|
||||
|
||||
if (tmp_host_m.Equal(this->host_m_2)) {
|
||||
if (tmp_host_m.Equal(this->host_m_2))
|
||||
{
|
||||
log_error("Test data should be different\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -230,7 +240,8 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_rect()
|
||||
|
||||
size_t tot_in_reg = this->region[0] * this->region[1] * this->region[2];
|
||||
if (!tmp_host_m.Equal_rect(this->host_m_2, this->host_origin, this->region,
|
||||
this->host_row_pitch, this->host_slice_pitch)) {
|
||||
this->host_row_pitch, this->host_slice_pitch))
|
||||
{
|
||||
log_error("Buffer rect content difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -241,23 +252,23 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_rect()
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
err = clEnqueueReadBufferRect(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes,
|
||||
this->host_origin_bytes,
|
||||
this->region_bytes,
|
||||
this->buffer_row_pitch_bytes,
|
||||
this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes,
|
||||
this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData,
|
||||
0, NULL, &event);
|
||||
err = clEnqueueReadBufferRect(
|
||||
this->m_queue, this->m_buffer, this->m_blocking,
|
||||
this->buffer_origin_bytes, this->host_origin_bytes, this->region_bytes,
|
||||
this->buffer_row_pitch_bytes, this->buffer_slice_pitch_bytes,
|
||||
this->host_row_pitch_bytes, this->host_slice_pitch_bytes,
|
||||
this->host_m_2.pData, 0, NULL, &event);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueReadBufferRect on a memory object created with the CL_MEM_HOST_WRITE_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error(
|
||||
"Calling clEnqueueReadBufferRect on a memory object created with "
|
||||
"the CL_MEM_HOST_WRITE_ONLY flag should not return CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
return FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
@@ -272,14 +283,15 @@ cl_int cBuffer_check_mem_host_write_only< T >::update_host_mem_2()
|
||||
global_work_size[0] = this->get_block_size_bytes();
|
||||
|
||||
cl_event event, event_2;
|
||||
cl_int err = clEnqueueCopyBuffer(this->m_queue, this->m_buffer, this->m_buffer2, 0, 0,
|
||||
cl_int err = clEnqueueCopyBuffer(
|
||||
this->m_queue, this->m_buffer, this->m_buffer2, 0, 0,
|
||||
this->m_nNumber_elements * sizeof(T), 0, NULL, &event);
|
||||
test_error(err, "clEnqueueCopyBuffer error");
|
||||
|
||||
this->host_m_2.Set_to_zero();
|
||||
err = clEnqueueReadBuffer(this->m_queue, this->m_buffer2, CL_TRUE, 0,
|
||||
this->get_block_size_bytes(), this->host_m_2.pData,
|
||||
1, &event, &event_2);
|
||||
this->get_block_size_bytes(),
|
||||
this->host_m_2.pData, 1, &event, &event_2);
|
||||
test_error(err, "clEnqueueReadBuffer error");
|
||||
|
||||
clWaitForEvents(1, &event_2);
|
||||
@@ -304,13 +316,13 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_mapping()
|
||||
|
||||
void *dataPtr;
|
||||
int size = this->get_block_size_bytes();
|
||||
dataPtr = clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
CL_MAP_WRITE,
|
||||
0, size,
|
||||
0, NULL, &event, &err);
|
||||
dataPtr =
|
||||
clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
CL_MAP_WRITE, 0, size, 0, NULL, &event, &err);
|
||||
test_error(err, "clEnqueueMapBuffer error");
|
||||
|
||||
if (!this->m_blocking) {
|
||||
if (!this->m_blocking)
|
||||
{
|
||||
err = clWaitForEvents(1, &event);
|
||||
test_error(err, "clWaitForEvents error");
|
||||
}
|
||||
@@ -320,12 +332,15 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_mapping()
|
||||
|
||||
update_host_mem_2();
|
||||
|
||||
if ((this->buffer_mem_flag & CL_MEM_USE_HOST_PTR) && dataPtr != this->pHost_ptr){
|
||||
if ((this->buffer_mem_flag & CL_MEM_USE_HOST_PTR)
|
||||
&& dataPtr != this->pHost_ptr)
|
||||
{
|
||||
log_error("Mapped host pointer difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if(!this->host_m_2.Equal((T*)dataPtr, this->m_nNumber_elements)) {
|
||||
if (!this->host_m_2.Equal((T *)dataPtr, this->m_nNumber_elements))
|
||||
{
|
||||
log_error("Buffer content difference found\n");
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -336,15 +351,18 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_mapping()
|
||||
|
||||
// test map read
|
||||
clEnqueueMapBuffer(this->m_queue, this->m_buffer, this->m_blocking,
|
||||
CL_MAP_READ,
|
||||
0, this->get_block_size_bytes(),
|
||||
0, NULL, &event, &err);
|
||||
CL_MAP_READ, 0, this->get_block_size_bytes(), 0, NULL,
|
||||
&event, &err);
|
||||
|
||||
if (err == CL_SUCCESS) {
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_READ) on a memory object created with the MEM_HOST_WRITE_ONLY flag should not return CL_SUCCESS\n");
|
||||
if (err == CL_SUCCESS)
|
||||
{
|
||||
log_error("Calling clEnqueueMapBuffer (CL_MAP_READ) on a memory object "
|
||||
"created with the MEM_HOST_WRITE_ONLY flag should not return "
|
||||
"CL_SUCCESS\n");
|
||||
err = FAILURE;
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
log_info("Test succeeded\n\n");
|
||||
err = CL_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -26,21 +26,20 @@
|
||||
#include "checker_mem_host_write_only.hpp"
|
||||
#include "checker_mem_host_no_access.hpp"
|
||||
|
||||
static int test_mem_host_read_only_buffer_RW(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static int test_mem_host_read_only_buffer_RW(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
cBuffer_check_mem_host_read_only< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_read_only<TEST_ELEMENT_TYPE> checker(deviceID,
|
||||
context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err = checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -55,22 +54,21 @@ static int test_mem_host_read_only_buffer_RW(cl_device_id deviceID, cl_context c
|
||||
return err;
|
||||
}
|
||||
|
||||
static int test_mem_host_read_only_buffer_RW_Rect(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static int test_mem_host_read_only_buffer_RW_Rect(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_read_only< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_read_only<TEST_ELEMENT_TYPE> checker(deviceID,
|
||||
context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -85,22 +83,21 @@ static int test_mem_host_read_only_buffer_RW_Rect(cl_device_id deviceID, cl_cont
|
||||
return err;
|
||||
}
|
||||
|
||||
static int test_mem_host_read_only_buffer_RW_Mapping(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static int test_mem_host_read_only_buffer_RW_Mapping(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_read_only< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_read_only<TEST_ELEMENT_TYPE> checker(deviceID,
|
||||
context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -118,8 +115,10 @@ static int test_mem_host_read_only_buffer_RW_Mapping(cl_device_id deviceID, cl_c
|
||||
int test_mem_host_read_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
cl_mem_flags buffer_mem_flags[2] = {CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_READ_ONLY,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_READ_ONLY};
|
||||
cl_mem_flags buffer_mem_flags[2] = {
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_READ_ONLY,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_READ_ONLY
|
||||
};
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
@@ -128,16 +127,19 @@ int test_mem_host_read_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
|
||||
err = test_mem_host_read_only_buffer_RW(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], 0, _BUFFER);
|
||||
err = test_mem_host_read_only_buffer_RW(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_read_only_buffer_RW_Rect(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k],0, _BUFFER);
|
||||
err = test_mem_host_read_only_buffer_RW_Rect(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_read_only_buffer_RW_Mapping(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k],0, _BUFFER);
|
||||
err = test_mem_host_read_only_buffer_RW_Mapping(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
}
|
||||
|
||||
@@ -147,30 +149,38 @@ int test_mem_host_read_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
int test_mem_host_read_only_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
cl_mem_flags parent_buffer_mem_flags[1] = {CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_READ_ONLY};
|
||||
cl_mem_flags parent_buffer_mem_flags[1] = { CL_MEM_READ_WRITE
|
||||
| CL_MEM_USE_HOST_PTR
|
||||
| CL_MEM_HOST_READ_ONLY };
|
||||
|
||||
cl_mem_flags buffer_mem_flags[4] = {0, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
cl_mem_flags buffer_mem_flags[4] = {
|
||||
0, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR};
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR
|
||||
};
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
cl_bool blocking[2] = { CL_TRUE, CL_FALSE };
|
||||
|
||||
for (int p=0; p<1; p++) {
|
||||
for (int p = 0; p < 1; p++)
|
||||
{
|
||||
for (int k = 0; k < 4; k++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
err = test_mem_host_read_only_buffer_RW(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err = test_mem_host_read_only_buffer_RW(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_read_only_buffer_RW_Rect(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err = test_mem_host_read_only_buffer_RW_Rect(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_read_only_buffer_RW_Mapping(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err = test_mem_host_read_only_buffer_RW_Mapping(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
@@ -180,23 +190,22 @@ int test_mem_host_read_only_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
|
||||
//=============================== Write only
|
||||
|
||||
static cl_int test_mem_host_write_only_buffer_RW(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static cl_int test_mem_host_write_only_buffer_RW(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_write_only< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_write_only<TEST_ELEMENT_TYPE> checker(
|
||||
deviceID, context, queue);
|
||||
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err = checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -211,22 +220,21 @@ static cl_int test_mem_host_write_only_buffer_RW(cl_device_id deviceID, cl_conte
|
||||
return err;
|
||||
}
|
||||
|
||||
static cl_int test_mem_host_write_only_buffer_RW_Rect(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static cl_int test_mem_host_write_only_buffer_RW_Rect(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_write_only< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_write_only<TEST_ELEMENT_TYPE> checker(
|
||||
deviceID, context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -241,22 +249,21 @@ static cl_int test_mem_host_write_only_buffer_RW_Rect(cl_device_id deviceID, cl_
|
||||
return err;
|
||||
}
|
||||
|
||||
static cl_int test_mem_host_write_only_buffer_RW_Mapping(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static cl_int test_mem_host_write_only_buffer_RW_Mapping(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_write_only< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_write_only<TEST_ELEMENT_TYPE> checker(
|
||||
deviceID, context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -274,8 +281,10 @@ static cl_int test_mem_host_write_only_buffer_RW_Mapping(cl_device_id deviceID,
|
||||
int test_mem_host_write_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
cl_mem_flags buffer_mem_flags[2] = {CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_WRITE_ONLY,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY};
|
||||
cl_mem_flags buffer_mem_flags[2] = {
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_WRITE_ONLY,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_WRITE_ONLY
|
||||
};
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
@@ -283,49 +292,62 @@ int test_mem_host_write_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
for (int k = 0; k < 2; k++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
err = test_mem_host_write_only_buffer_RW(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], 0, _BUFFER);
|
||||
err = test_mem_host_write_only_buffer_RW(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_write_only_buffer_RW_Rect(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], 0, _BUFFER);
|
||||
err = test_mem_host_write_only_buffer_RW_Rect(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_write_only_buffer_RW_Mapping(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], 0, _BUFFER);
|
||||
err = test_mem_host_write_only_buffer_RW_Mapping(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int test_mem_host_write_only_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
int test_mem_host_write_only_subbuffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
cl_mem_flags parent_buffer_mem_flags[1] = {CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_WRITE_ONLY};
|
||||
cl_mem_flags parent_buffer_mem_flags[1] = { CL_MEM_READ_WRITE
|
||||
| CL_MEM_USE_HOST_PTR
|
||||
| CL_MEM_HOST_WRITE_ONLY };
|
||||
|
||||
cl_mem_flags buffer_mem_flags[4] = {0, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
cl_mem_flags buffer_mem_flags[4] = {
|
||||
0, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR};
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR
|
||||
};
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
cl_bool blocking[2] = { CL_TRUE, CL_FALSE };
|
||||
|
||||
for (int p=0; p<1; p++) {
|
||||
for (int m=0; m<4; m++) {
|
||||
for (int p = 0; p < 1; p++)
|
||||
{
|
||||
for (int m = 0; m < 4; m++)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
err = test_mem_host_write_only_buffer_RW(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[m], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err = test_mem_host_write_only_buffer_RW(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[m],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_write_only_buffer_RW_Rect(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[m], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err = test_mem_host_write_only_buffer_RW_Rect(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[m],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_write_only_buffer_RW_Mapping(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[m] , parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err = test_mem_host_write_only_buffer_RW_Mapping(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[m],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
}
|
||||
}
|
||||
@@ -336,23 +358,22 @@ int test_mem_host_write_only_subbuffer(cl_device_id deviceID, cl_context context
|
||||
|
||||
//===================== NO ACCESS
|
||||
|
||||
static cl_int test_mem_host_no_access_buffer_RW(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static cl_int test_mem_host_no_access_buffer_RW(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_no_access< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_no_access<TEST_ELEMENT_TYPE> checker(deviceID,
|
||||
context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -367,22 +388,21 @@ static cl_int test_mem_host_no_access_buffer_RW(cl_device_id deviceID, cl_contex
|
||||
return err;
|
||||
}
|
||||
|
||||
static cl_int test_mem_host_no_access_buffer_RW_Rect(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static cl_int test_mem_host_no_access_buffer_RW_Rect(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_no_access< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_no_access<TEST_ELEMENT_TYPE> checker(deviceID,
|
||||
context, queue);
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -397,23 +417,22 @@ static cl_int test_mem_host_no_access_buffer_RW_Rect(cl_device_id deviceID, cl_c
|
||||
return err;
|
||||
}
|
||||
|
||||
static cl_int test_mem_host_no_access_buffer_RW_Mapping(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, cl_bool blocking,
|
||||
cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag,
|
||||
enum BUFFER_TYPE buffer_type)
|
||||
static cl_int test_mem_host_no_access_buffer_RW_Mapping(
|
||||
cl_device_id deviceID, cl_context context, cl_command_queue queue,
|
||||
cl_bool blocking, cl_mem_flags buffer_mem_flag,
|
||||
cl_mem_flags parent_buffer_flag, enum BUFFER_TYPE buffer_type)
|
||||
{
|
||||
log_info("%s\n", __FUNCTION__);
|
||||
|
||||
cBuffer_check_mem_host_no_access< TEST_ELEMENT_TYPE > checker(deviceID, context, queue);
|
||||
cBuffer_check_mem_host_no_access<TEST_ELEMENT_TYPE> checker(deviceID,
|
||||
context, queue);
|
||||
|
||||
checker.m_blocking = blocking;
|
||||
checker.buffer_mem_flag = buffer_mem_flag;
|
||||
cl_int err;
|
||||
switch (buffer_type) {
|
||||
case _BUFFER:
|
||||
err= checker.SetupBuffer();
|
||||
break;
|
||||
switch (buffer_type)
|
||||
{
|
||||
case _BUFFER: err = checker.SetupBuffer(); break;
|
||||
case _Sub_BUFFER:
|
||||
err = checker.SetupASSubBuffer(parent_buffer_flag);
|
||||
break;
|
||||
@@ -431,24 +450,30 @@ static cl_int test_mem_host_no_access_buffer_RW_Mapping(cl_device_id deviceID, c
|
||||
int test_mem_host_no_access_buffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
cl_mem_flags buffer_mem_flag[2] = {CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_NO_ACCESS};
|
||||
cl_mem_flags buffer_mem_flag[2] = {
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR | CL_MEM_HOST_NO_ACCESS
|
||||
};
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
cl_bool blocking[2] = { CL_TRUE, CL_FALSE };
|
||||
for (int k = 0; k < 2; k++)
|
||||
for (int i=0; i<2; i++) {
|
||||
err = test_mem_host_no_access_buffer_RW(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flag[k], 0, _BUFFER);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
err = test_mem_host_no_access_buffer_RW(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flag[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_no_access_buffer_RW_Rect(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flag[k], 0, _BUFFER);
|
||||
err = test_mem_host_no_access_buffer_RW_Rect(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flag[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
|
||||
err = test_mem_host_no_access_buffer_RW_Mapping(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flag[k], 0, _BUFFER);
|
||||
err = test_mem_host_no_access_buffer_RW_Mapping(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flag[k], 0,
|
||||
_BUFFER);
|
||||
test_error(err, __FUNCTION__);
|
||||
}
|
||||
|
||||
@@ -458,28 +483,38 @@ int test_mem_host_no_access_buffer(cl_device_id deviceID, cl_context context,
|
||||
int test_mem_host_no_access_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements)
|
||||
{
|
||||
cl_mem_flags parent_buffer_mem_flags[3] = { CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS,
|
||||
cl_mem_flags parent_buffer_mem_flags[3] = {
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS,
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS};
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS,
|
||||
CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR | CL_MEM_HOST_NO_ACCESS
|
||||
};
|
||||
|
||||
cl_mem_flags buffer_mem_flags[4] = {0, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
cl_mem_flags buffer_mem_flags[4] = {
|
||||
0, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR,
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR};
|
||||
CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR
|
||||
};
|
||||
|
||||
cl_int err = CL_SUCCESS;
|
||||
|
||||
cl_bool blocking[2] = { CL_TRUE, CL_FALSE };
|
||||
for (int p=0; p<3; p++) {
|
||||
for (int k=0; k<4; k++) {
|
||||
for (int i=0; i<2; i++) {
|
||||
err += test_mem_host_no_access_buffer_RW(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
for (int p = 0; p < 3; p++)
|
||||
{
|
||||
for (int k = 0; k < 4; k++)
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
err += test_mem_host_no_access_buffer_RW(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
|
||||
err += test_mem_host_no_access_buffer_RW_Rect(deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err += test_mem_host_no_access_buffer_RW_Rect(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
|
||||
err += test_mem_host_no_access_buffer_RW_Mapping( deviceID, context, queue, blocking[i],
|
||||
buffer_mem_flags[k], parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
err += test_mem_host_no_access_buffer_RW_Mapping(
|
||||
deviceID, context, queue, blocking[i], buffer_mem_flags[k],
|
||||
parent_buffer_mem_flags[p], _Sub_BUFFER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,26 +20,44 @@
|
||||
|
||||
#define NUM_FLAGS 4
|
||||
|
||||
extern int test_mem_host_read_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_read_only_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_read_only_buffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_mem_host_read_only_subbuffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
|
||||
extern int test_mem_host_write_only_buffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_write_only_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_write_only_buffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_mem_host_write_only_subbuffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
|
||||
extern int test_mem_host_no_access_buffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_no_access_subbuffer(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_no_access_buffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_mem_host_no_access_subbuffer(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
|
||||
extern int test_mem_host_read_only_image(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_write_only_image(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_no_access_image(cl_device_id deviceID, cl_context context,
|
||||
cl_command_queue queue, int num_elements);
|
||||
extern int test_mem_host_read_only_image(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_mem_host_write_only_image(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
extern int test_mem_host_no_access_image(cl_device_id deviceID,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
int num_elements);
|
||||
|
||||
#endif // #ifndef __PROCS_H__
|
||||
|
||||
Reference in New Issue
Block a user