@@ -2773,7 +2773,7 @@ CL_API_ENTRY void *CL_API_CALL clEnqueueMapImageIntelFPGA(
2773
2773
image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_BUFFER) {
2774
2774
if (image_slice_pitch == NULL ) {
2775
2775
BAIL_INFO (CL_INVALID_VALUE, command_queue->context ,
2776
- " Invalid slice pitch provided" );
2776
+ " Invalid slice pitch provided" );
2777
2777
}
2778
2778
*image_slice_pitch = 0 ;
2779
2779
} else if (image->mem_object_type == CL_MEM_OBJECT_IMAGE1D_ARRAY) {
@@ -2782,7 +2782,7 @@ CL_API_ENTRY void *CL_API_CALL clEnqueueMapImageIntelFPGA(
2782
2782
*image_slice_pitch =
2783
2783
image->fields .image_objs .image_desc ->image_height * tmp_row_pitch;
2784
2784
}
2785
-
2785
+
2786
2786
tmp_slice_pitch = *image_slice_pitch;
2787
2787
}
2788
2788
@@ -4065,7 +4065,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4065
4065
cl_event local_event = 0 ;
4066
4066
unsigned int physical_id;
4067
4067
unsigned int mem_id;
4068
- int *needs_release_on_fail;
4069
4068
4070
4069
std::scoped_lock lock{acl_mutex_wrapper};
4071
4070
@@ -4110,10 +4109,7 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4110
4109
4111
4110
// Try to reserve space for all the buffers to be moved. If we fail, we need
4112
4111
// to know which buffers to deallocate:
4113
- needs_release_on_fail = (int *)malloc (sizeof (int ) * num_mem_objects);
4114
- for (i = 0 ; i < num_mem_objects; ++i) {
4115
- needs_release_on_fail[i] = 0 ;
4116
- }
4112
+ std::vector<bool > needs_release_on_fail (num_mem_objects, false );
4117
4113
4118
4114
status = CL_SUCCESS;
4119
4115
for (i = 0 ; i < num_mem_objects; ++i) {
@@ -4128,7 +4124,7 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4128
4124
status = CL_MEM_OBJECT_ALLOCATION_FAILURE;
4129
4125
break ;
4130
4126
}
4131
- needs_release_on_fail[i] = 1 ;
4127
+ needs_release_on_fail[i] = true ;
4132
4128
}
4133
4129
mem_objects[i]->reserved_allocations_count [physical_id][mem_id]++;
4134
4130
}
@@ -4144,7 +4140,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4144
4140
}
4145
4141
mem_objects[i]->reserved_allocations_count [physical_id][mem_id]--;
4146
4142
}
4147
- free (needs_release_on_fail);
4148
4143
return status;
4149
4144
}
4150
4145
@@ -4155,7 +4150,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4155
4150
CL_COMMAND_MIGRATE_MEM_OBJECTS, &local_event);
4156
4151
4157
4152
if (status != CL_SUCCESS) {
4158
- free (needs_release_on_fail);
4159
4153
return status; // already signalled callback
4160
4154
}
4161
4155
@@ -4201,8 +4195,6 @@ ACL_EXPORT CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjectsIntelFPGA(
4201
4195
acl_idle_update (command_queue->context ); // Clean up early
4202
4196
}
4203
4197
4204
- free (needs_release_on_fail);
4205
-
4206
4198
return CL_SUCCESS;
4207
4199
}
4208
4200
@@ -6824,9 +6816,9 @@ static void acl_dump_mem_internal(cl_mem mem) {
6824
6816
? " is malloc"
6825
6817
: " not malloc" ));
6826
6818
printf (" .begin %p\n " ,
6827
- mem->block_allocation ->range .begin );
6819
+ mem->block_allocation ->range .begin );
6828
6820
printf (" .end %p\n " ,
6829
- mem->block_allocation ->range .next );
6821
+ mem->block_allocation ->range .next );
6830
6822
}
6831
6823
printf (" .mappings %d\n " , mem->mapping_count );
6832
6824
acl_print_debug_msg (" .size %lu\n " , mem->size );
0 commit comments