Skip to content

Conversation

attiladoor
Copy link

@attiladoor attiladoor commented Apr 27, 2023

  • add a new device buffer class which only re-allocated on demand
  • make the buffer instances static to preserve them between frames

Related issue: #11692 (comment)

Nsight systems profiling:

realsense_profiling

As we can see, there is no allocation being done at the yuy2 conversion

- add a new device buffer class which only re-allocated on demand
- make the buffer instances static to preserve them between frames

Github issue: IntelRealSense#11692 (comment)
static T* allocateBuffer(std::size_t const reserve_size)
{
T* datatemp{nullptr};
cudaMalloc(&datatemp, reserve_size * sizeof(T));
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe i can add an assert to the return value of cudaMalloc and cudaFree above. What do you think?

result = cudaGetLastError();
assert(result == cudaSuccess);

cudaDeviceSynchronize();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, this is unnecessary, but better to use async copy and use the same stream across the whole function and do a stream syncronization before we return from this function. By that we can avoid extra syncing, however the gain would be probably not very significant.

https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1g85073372f776b4c4d5f89f7124b7bf79

@Nir-Az
Copy link
Collaborator

Nir-Az commented May 2, 2023

Thanks for the PR, we will investigate this issue & fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants