Intel® MPI Library
Get help with building, analyzing, optimizing, and scaling high-performance computing (HPC) applications.
2159 Discussions

[SYCL][CUDA] unnecessary memcpy for write buffers.

andry954
Beginner
2,205 Views

When using write and discard_write accessors with the CUDA backend a Host to Device copy is made. Even though this is supposed to be write only which does not need such an action and this is wasted resources.

queue.submit([&] (cl::sycl::handler& cgh) {
auto input_acc = input.get_accesssycl::access::mode::read(cgh);
auto output_acc = output.get_accesssycl::access::mode::discard_write(cgh);
auto maxRange = sycl::nd_range<2>(sycl::range<2>{height, width / 4}, sycl::range<2>(1, 128));
cgh.parallel_for(maxRange, [=](sycl::nd_item<2> item){
output_acc[item.get_global_id()] = 0;
});
});

Am I doing something wrong or is this a quirk of the current implementation of the SYCL specification?

I have never written an issue like this before so if you need additional information just ask.

Labels (1)
0 Kudos
5 Replies
RahulV_intel
Moderator
2,170 Views

Hi,


Do you mind sharing your complete source file so as to get a better clarity with respect to your claim?


In general, accessor::read mode is where the copy happens from host to device. Buffers just claim the memory space. Whereas, the actual copy happens when accessors are called.


I would like to see the buffers which you have declared in your program.


Thanks,

Rahul


0 Kudos
andry954
Beginner
2,123 Views

Hi,

I already  got an answer to my question here https://github.com/intel/llvm/issues/1992

thanks for your time.

0 Kudos
RahulV_intel
Moderator
2,150 Views

Hi,


Just a quick reminder to share your complete source code.


Thanks,

Rahul


0 Kudos
RahulV_intel
Moderator
2,112 Views

Hi,


Thanks for providing the link. Good to know that your query got addressed.


Let me know if I can close the thread.


Thanks,

Rahul


0 Kudos
RahulV_intel
Moderator
2,093 Views

Intel will no longer monitor this thread. However, this thread will remain open for community discussion. If you still have any issue, feel free to post a new question.


0 Kudos
Reply