@@ -103,10 +103,10 @@ static cl_int l_enqueue_kernel_with_type(
103
103
const cl_event *event_wait_list, cl_event *event, cl_command_type type);
104
104
static void l_get_arg_offset_and_size(cl_kernel kernel, cl_uint arg_index,
105
105
size_t *start_idx_ret, size_t *size_ret);
106
- static cl_int
107
- l_copy_and_adjust_arguments_for_device( cl_kernel kernel, cl_device_id device,
108
- char *buf, cl_uint *num_bytes ,
109
- acl_mem_migrate_t *memory_migration );
106
+ static cl_int l_copy_and_adjust_arguments_for_device(
107
+ cl_kernel kernel, cl_device_id device, char *buf, cl_uint *num_bytes ,
108
+ acl_mem_migrate_t *memory_migration ,
109
+ std::vector<aocl_mmd_streaming_kernel_arg_info_t> &streaming_args );
110
110
111
111
static void l_abort_use_of_wrapper(acl_kernel_invocation_wrapper_t *wrapper);
112
112
@@ -2178,7 +2178,7 @@ static cl_int l_enqueue_kernel_with_type(
2178
2178
2179
2179
kernel_arg_bytes = (cl_uint)l_copy_and_adjust_arguments_for_device(
2180
2180
kernel, device, &(invocation->arg_value[0]), &kernel_arg_bytes,
2181
- &memory_migration);
2181
+ &memory_migration, serialization_wrapper->streaming_args );
2182
2182
2183
2183
assert(kernel_arg_bytes <= kernel->arg_value_size);
2184
2184
@@ -2242,7 +2242,7 @@ static cl_int l_enqueue_kernel_with_type(
2242
2242
2243
2243
status = l_copy_and_adjust_arguments_for_device(
2244
2244
kernel, device, &(invocation->arg_value[0]), &kernel_arg_bytes,
2245
- &memory_migration);
2245
+ &memory_migration, wrapper->streaming_args );
2246
2246
2247
2247
if (status != CL_SUCCESS) {
2248
2248
ERR_RET(status, context, "Argument error");
@@ -2738,10 +2738,10 @@ int acl_num_non_null_mem_args(cl_kernel kernel) {
2738
2738
//
2739
2739
// Returns number of bytes written to the device-side buffer in num_bytes.
2740
2740
// Returns failure if memory could not be reserved on the device.
2741
- static cl_int
2742
- l_copy_and_adjust_arguments_for_device( cl_kernel kernel, cl_device_id device,
2743
- char *buf, cl_uint *num_bytes ,
2744
- acl_mem_migrate_t *memory_migration ) {
2741
+ static cl_int l_copy_and_adjust_arguments_for_device(
2742
+ cl_kernel kernel, cl_device_id device, char *buf, cl_uint *num_bytes ,
2743
+ acl_mem_migrate_t *memory_migration ,
2744
+ std::vector<aocl_mmd_streaming_kernel_arg_info_t> &streaming_args ) {
2745
2745
// indices into the host and device arg value buffer arrays.
2746
2746
size_t host_idx = 0;
2747
2747
size_t device_idx = 0;
@@ -2770,6 +2770,9 @@ l_copy_and_adjust_arguments_for_device(cl_kernel kernel, cl_device_id device,
2770
2770
next_local[aspace.aspace_id] +=
2771
2771
l_round_up_for_alignment(aspace.static_demand);
2772
2772
}
2773
+
2774
+ streaming_args.clear();
2775
+
2773
2776
#ifdef MEM_DEBUG_MSG
2774
2777
printf("kernel args\n");
2775
2778
#endif
@@ -2785,7 +2788,17 @@ l_copy_and_adjust_arguments_for_device(cl_kernel kernel, cl_device_id device,
2785
2788
// Exclude kernel argument value from device-side buffer by default.
2786
2789
cl_uint buf_incr = 0;
2787
2790
2788
- if (arg_info->addr_space == ACL_ARG_ADDR_LOCAL) {
2791
+ if (arg_info->streaming_arg_info_available) {
2792
+ #ifdef MEM_DEBUG_MSG
2793
+ printf("streaming");
2794
+ #endif
2795
+ // Copy argument value to a separate buffer since it may be modified with
2796
+ // clSetKernelArg() after kernel is enqueued but before it is launched.
2797
+ const char *const arg_value = &kernel->arg_value[host_idx];
2798
+ streaming_args.emplace_back(aocl_mmd_streaming_kernel_arg_info_t{
2799
+ arg_info->streaming_arg_info.interface_name,
2800
+ std::vector<char>(arg_value, arg_value + arg_info->size)});
2801
+ } else if (arg_info->addr_space == ACL_ARG_ADDR_LOCAL) {
2789
2802
#ifdef MEM_DEBUG_MSG
2790
2803
printf("local");
2791
2804
#endif
0 commit comments