Skip to content

Commit

Permalink
Merge branch 'buffer_transform' into 'master'
Browse files Browse the repository at this point in the history
fix: fix the GPU buffer transform error

See merge request applied-machine-learning/sysml/mace!1335
  • Loading branch information
lee-bin committed Dec 23, 2020
2 parents 091b4e4 + fb15718 commit c8c2429
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mace/ops/opencl/buffer_transformer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ class OpenCLBufferTransformer {
<< " with data type " << dt;
internal_tensor->Resize(input->shape());
const uint8_t *input_ptr = input->data<uint8_t>();
// No need to finish the opencl command queue to write to the tensor
// from CPU, this can accelerate the mapping if using ION buffer.
Tensor::MappingGuard guard(internal_tensor, false);
uint8_t *internal_ptr = internal_tensor->mutable_data<uint8_t>();
memcpy(internal_ptr, input_ptr, input->raw_size());
{
// No need to finish the opencl command queue to write to the tensor
// from CPU, this can accelerate the mapping if using ION buffer.
Tensor::MappingGuard guard(internal_tensor, false);
uint8_t *internal_ptr = internal_tensor->mutable_data<uint8_t>();
memcpy(internal_ptr, input_ptr, input->raw_size());
}
// 2. convert the internal GPU Buffer to output.
return kernel_->Compute(
context, internal_tensor, type, wino_blk_size, output);
Expand Down

0 comments on commit c8c2429

Please sign in to comment.