Skip to content

Commit

Permalink
Merge pull request #56 from THU-DSP-LAB/55-cl_mem_use_host_ptr
Browse files Browse the repository at this point in the history
[fix] fixed the bug that the mem_host_ptr will be changed while mem flag is CL_MEM_USE_HOST_PTR
  • Loading branch information
Jules-Kong authored Dec 12, 2023
2 parents dea8460 + 0608316 commit 301f619
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/CL/devices/ventus/pocl_ventus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,10 @@ void pocl_ventus_write(void *data,
size_t size) {
struct vt_device_data_t *d = (struct vt_device_data_t *)data;
void *tmp_data = malloc(size);
memcpy(tmp_data, host_ptr, size);
dst_buf->mem_host_ptr = tmp_data;
if (!(CL_MEM_USE_HOST_PTR & dst_buf->flags)) {
memcpy(tmp_data, host_ptr, size);
dst_buf->mem_host_ptr = tmp_data;
}

int err = vt_copy_to_dev(d->vt_device,*((uint64_t*)(dst_mem_id->mem_ptr))+offset,host_ptr,size,0,0);
assert(0 == err);
Expand Down

0 comments on commit 301f619

Please sign in to comment.