@@ -2026,14 +2026,14 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImageIntelFPGA(
2026
2026
" Pointer argument cannot be NULL" );
2027
2027
}
2028
2028
2029
- if (image ! = NULL ) {
2030
- src_element_size = acl_get_image_element_size (
2031
- image-> context , image-> fields . image_objs . image_format , &errcode_ret);
2032
- if (errcode_ret != CL_SUCCESS) {
2033
- return errcode_ret;
2034
- }
2035
- } else {
2036
- src_element_size = 0 ;
2029
+ if (image = = NULL ) {
2030
+ return CL_INVALID_MEM_OBJECT;
2031
+ }
2032
+
2033
+ src_element_size = acl_get_image_element_size (
2034
+ image-> context , image-> fields . image_objs . image_format , &errcode_ret);
2035
+ if (errcode_ret != CL_SUCCESS) {
2036
+ return errcode_ret ;
2037
2037
}
2038
2038
2039
2039
tmp_src_offset[0 ] = origin[0 ];
@@ -2123,16 +2123,16 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImageIntelFPGA(
2123
2123
size_t dst_element_size;
2124
2124
std::scoped_lock lock{acl_mutex_wrapper};
2125
2125
2126
- if (image != NULL ) {
2127
- dst_element_size = acl_get_image_element_size (
2128
- image->context , image->fields .image_objs .image_format , &errcode_ret);
2129
- if (errcode_ret != CL_SUCCESS) {
2130
- return errcode_ret;
2131
- }
2132
- } else {
2126
+ if (image == NULL ) {
2133
2127
return CL_INVALID_MEM_OBJECT;
2134
2128
}
2135
2129
2130
+ dst_element_size = acl_get_image_element_size (
2131
+ image->context , image->fields .image_objs .image_format , &errcode_ret);
2132
+ if (errcode_ret != CL_SUCCESS) {
2133
+ return errcode_ret;
2134
+ }
2135
+
2136
2136
if (!acl_command_queue_is_valid (command_queue)) {
2137
2137
return CL_INVALID_COMMAND_QUEUE;
2138
2138
}
@@ -2227,16 +2227,16 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillImageIntelFPGA(
2227
2227
cl_event tmp_event;
2228
2228
std::scoped_lock lock{acl_mutex_wrapper};
2229
2229
2230
- if (image != NULL ) {
2231
- dst_element_size = acl_get_image_element_size (
2232
- image->context , image->fields .image_objs .image_format , &errcode_ret);
2233
- if (errcode_ret != CL_SUCCESS) {
2234
- return errcode_ret;
2235
- }
2236
- } else {
2230
+ if (image == NULL ) {
2237
2231
return CL_INVALID_MEM_OBJECT;
2238
2232
}
2239
2233
2234
+ dst_element_size = acl_get_image_element_size (
2235
+ image->context , image->fields .image_objs .image_format , &errcode_ret);
2236
+ if (errcode_ret != CL_SUCCESS) {
2237
+ return errcode_ret;
2238
+ }
2239
+
2240
2240
if (!acl_command_queue_is_valid (command_queue)) {
2241
2241
return CL_INVALID_COMMAND_QUEUE;
2242
2242
}
@@ -2771,15 +2771,18 @@ CL_API_ENTRY void *CL_API_CALL clEnqueueMapImageIntelFPGA(
2771
2771
if (image->mem_object_type == CL_MEM_OBJECT_IMAGE2D ||
2772
2772
image->mem_object_type == CL_MEM_OBJECT_IMAGE1D ||
2773
2773
image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) {
2774
- if (image_slice_pitch != NULL ) {
2775
- *image_slice_pitch = 0 ;
2774
+ if (image_slice_pitch == NULL ) {
2775
+ BAIL_INFO (CL_INVALID_VALUE, command_queue->context ,
2776
+ " Invalid slice pitch provided" );
2776
2777
}
2778
+ *image_slice_pitch = 0 ;
2777
2779
} else if (image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) {
2778
2780
*image_slice_pitch = tmp_row_pitch;
2779
2781
} else {
2780
2782
*image_slice_pitch =
2781
2783
image->fields .image_objs .image_desc ->image_height * tmp_row_pitch;
2782
2784
}
2785
+
2783
2786
tmp_slice_pitch = *image_slice_pitch;
2784
2787
}
2785
2788
@@ -6820,12 +6823,12 @@ static void acl_dump_mem_internal(cl_mem mem) {
6820
6823
(mem->block_allocation ->region ->uses_host_system_malloc
6821
6824
? " is malloc"
6822
6825
: " not malloc" ));
6826
+ printf (" .begin %p\n " ,
6827
+ mem->block_allocation ->range .begin );
6828
+ printf (" .end %p\n " ,
6829
+ mem->block_allocation ->range .next );
6823
6830
}
6824
6831
printf (" .mappings %d\n " , mem->mapping_count );
6825
- printf (" .begin %p\n " ,
6826
- mem->block_allocation ->range .begin );
6827
- printf (" .end %p\n " ,
6828
- mem->block_allocation ->range .next );
6829
6832
acl_print_debug_msg (" .size %lu\n " , mem->size );
6830
6833
printf (" .host_ptr %p\n " ,
6831
6834
mem->fields .buffer_objs .host_ptr );
0 commit comments