A few error handling and flag test fixes for mem_host_flags (#485)

- Add missing error checks
- Add missing return
- Fix flag check

Signed-off-by: Kévin Petit <kpet@free.fr>
This commit is contained in:
Kévin Petit
2019-11-15 13:12:48 +00:00
committed by GitHub
parent 1bffbbe3e4
commit 35bc51e51a
3 changed files with 6 additions and 2 deletions

View File

@@ -51,6 +51,7 @@ cl_int cImage_check_mem_host_no_access<T>:: verify_RW_Image()
&color,
img_orig, img_region,
0, NULL, &event);
test_error(err, "clEnqueueFillImage error");
if (!this->m_blocking) {
err = clWaitForEvents(1, &event);

View File

@@ -57,7 +57,7 @@ cl_int cBuffer_check_mem_host_read_only< T >::SetupBuffer()
block_size_in_byte, this->host_m_1.pData, &err);
test_error(err, "clCreateBuffer error");
if (this->buffer_mem_flag | CL_MEM_USE_HOST_PTR)
if (this->buffer_mem_flag & CL_MEM_USE_HOST_PTR)
{
this->pHost_ptr = (void *)this->host_m_1.pData;
}
@@ -235,6 +235,7 @@ cl_int cBuffer_check_mem_host_read_only< T >::verify_RW_Buffer_mapping()
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)) {

View File

@@ -192,6 +192,7 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_rect()
err = clEnqueueWriteBuffer(this->m_queue, this->m_buffer, CL_TRUE, 0,
this->get_block_size_bytes(), tmp_host_m.pData,
0, NULL, &event_1);
test_error(err, "clEnqueueWriteBuffer error");
vv1 = TEST_VALUE;
tmp_host_m.Set_to(vv1);
@@ -205,7 +206,7 @@ cl_int cBuffer_check_mem_host_write_only< T >::verify_RW_Buffer_rect()
this->host_slice_pitch_bytes,
tmp_host_m.pData,
1, &event_1, &event);
test_error(err, "clEnqueueWriteBuffer error");
test_error(err, "clEnqueueWriteBufferRect error");
if (!this->m_blocking) {
err = clWaitForEvents(1, &event);
@@ -265,6 +266,7 @@ cl_int cBuffer_check_mem_host_write_only< T >::update_host_mem_2()
cl_event event, event_2;
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,