@@ -2030,14 +2030,14 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImageIntelFPGA(
2030
2030
" Pointer argument cannot be NULL" );
2031
2031
}
2032
2032
2033
- if (image ! = NULL ) {
2034
- src_element_size = acl_get_image_element_size (
2035
- image-> context , image-> fields . image_objs . image_format , &errcode_ret);
2036
- if (errcode_ret != CL_SUCCESS) {
2037
- return errcode_ret;
2038
- }
2039
- } else {
2040
- src_element_size = 0 ;
2033
+ if (image = = NULL ) {
2034
+ return CL_INVALID_MEM_OBJECT;
2035
+ }
2036
+
2037
+ src_element_size = acl_get_image_element_size (
2038
+ image-> context , image-> fields . image_objs . image_format , &errcode_ret);
2039
+ if (errcode_ret != CL_SUCCESS) {
2040
+ return errcode_ret ;
2041
2041
}
2042
2042
2043
2043
tmp_src_offset[0 ] = origin[0 ];
@@ -2127,16 +2127,16 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImageIntelFPGA(
2127
2127
size_t dst_element_size;
2128
2128
std::scoped_lock lock{acl_mutex_wrapper};
2129
2129
2130
- if (image != NULL ) {
2131
- dst_element_size = acl_get_image_element_size (
2132
- image->context , image->fields .image_objs .image_format , &errcode_ret);
2133
- if (errcode_ret != CL_SUCCESS) {
2134
- return errcode_ret;
2135
- }
2136
- } else {
2130
+ if (image == NULL ) {
2137
2131
return CL_INVALID_MEM_OBJECT;
2138
2132
}
2139
2133
2134
+ dst_element_size = acl_get_image_element_size (
2135
+ image->context , image->fields .image_objs .image_format , &errcode_ret);
2136
+ if (errcode_ret != CL_SUCCESS) {
2137
+ return errcode_ret;
2138
+ }
2139
+
2140
2140
if (!acl_command_queue_is_valid (command_queue)) {
2141
2141
return CL_INVALID_COMMAND_QUEUE;
2142
2142
}
@@ -2231,16 +2231,16 @@ CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillImageIntelFPGA(
2231
2231
cl_event tmp_event;
2232
2232
std::scoped_lock lock{acl_mutex_wrapper};
2233
2233
2234
- if (image != NULL ) {
2235
- dst_element_size = acl_get_image_element_size (
2236
- image->context , image->fields .image_objs .image_format , &errcode_ret);
2237
- if (errcode_ret != CL_SUCCESS) {
2238
- return errcode_ret;
2239
- }
2240
- } else {
2234
+ if (image == NULL ) {
2241
2235
return CL_INVALID_MEM_OBJECT;
2242
2236
}
2243
2237
2238
+ dst_element_size = acl_get_image_element_size (
2239
+ image->context , image->fields .image_objs .image_format , &errcode_ret);
2240
+ if (errcode_ret != CL_SUCCESS) {
2241
+ return errcode_ret;
2242
+ }
2243
+
2244
2244
if (!acl_command_queue_is_valid (command_queue)) {
2245
2245
return CL_INVALID_COMMAND_QUEUE;
2246
2246
}
@@ -2710,7 +2710,7 @@ CL_API_ENTRY void *CL_API_CALL clEnqueueMapImageIntelFPGA(
2710
2710
cl_int status;
2711
2711
size_t element_size;
2712
2712
size_t tmp_row_pitch;
2713
- size_t tmp_slice_pitch;
2713
+ size_t tmp_slice_pitch = 0 ;
2714
2714
std::scoped_lock lock{acl_mutex_wrapper};
2715
2715
2716
2716
if (image != NULL ) {
@@ -2771,19 +2771,22 @@ CL_API_ENTRY void *CL_API_CALL clEnqueueMapImageIntelFPGA(
2771
2771
image_slice_pitch == NULL ) {
2772
2772
BAIL_INFO (CL_INVALID_VALUE, command_queue->context ,
2773
2773
" Invalid slice pitch provided" );
2774
- } else {
2775
- if (image->mem_object_type == CL_MEM_OBJECT_IMAGE2D ||
2776
- image->mem_object_type == CL_MEM_OBJECT_IMAGE1D ||
2777
- image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) {
2778
- if (image_slice_pitch != NULL ) {
2779
- *image_slice_pitch = 0 ;
2780
- }
2781
- } else if (image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) {
2782
- *image_slice_pitch = tmp_row_pitch;
2783
- } else {
2784
- *image_slice_pitch =
2785
- image->fields .image_objs .image_desc ->image_height * tmp_row_pitch;
2774
+ }
2775
+
2776
+ if (image->mem_object_type == CL_MEM_OBJECT_IMAGE2D ||
2777
+ image->mem_object_type == CL_MEM_OBJECT_IMAGE1D ||
2778
+ image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) {
2779
+ if (image_slice_pitch != NULL ) {
2780
+ *image_slice_pitch = 0 ;
2786
2781
}
2782
+ } else if (image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) {
2783
+ *image_slice_pitch = tmp_row_pitch;
2784
+ } else {
2785
+ *image_slice_pitch =
2786
+ image->fields .image_objs .image_desc ->image_height * tmp_row_pitch;
2787
+ }
2788
+
2789
+ if (image_slice_pitch != NULL ) {
2787
2790
tmp_slice_pitch = *image_slice_pitch;
2788
2791
}
2789
2792
@@ -6824,12 +6827,12 @@ static void acl_dump_mem_internal(cl_mem mem) {
6824
6827
(mem->block_allocation ->region ->uses_host_system_malloc
6825
6828
? " is malloc"
6826
6829
: " not malloc" ));
6830
+ printf (" .begin %p\n " ,
6831
+ mem->block_allocation ->range .begin );
6832
+ printf (" .end %p\n " ,
6833
+ mem->block_allocation ->range .next );
6827
6834
}
6828
6835
printf (" .mappings %d\n " , mem->mapping_count );
6829
- printf (" .begin %p\n " ,
6830
- mem->block_allocation ->range .begin );
6831
- printf (" .end %p\n " ,
6832
- mem->block_allocation ->range .next );
6833
6836
acl_print_debug_msg (" .size %lu\n " , mem->size );
6834
6837
printf (" .host_ptr %p\n " ,
6835
6838
mem->fields .buffer_objs .host_ptr );
0 commit comments