1
\$\begingroup\$

When we import a D3D12 memory object into cuda we do something like this:

cudaExternalMemoryHandleDesc cuExtmemHandleDesc{};
cuExtmemHandleDesc.type = cudaExternalMemoryHandleTypeD3D12Resource; //here
//...
CheckCudaErrors(cudaImportExternalMemory(&m_externalMemory, &cuExtmemHandleDesc));

What is the difference between cudaExternalMemoryHandleTypeD3D12Resource and cudaExternalMemoryHandleTypeD3D12Heap? When should I use one or the other when importing memory object?

\$\endgroup\$
1
\$\begingroup\$

cudeExternalMemoryHandleTypeD3D12Heap refers to a D3D12 heap object, whereas cudeExternalMemoryHandleTypeD3D12Resource refers to a D3D12 resource object. You'd choose the value that correctly represents the D3D12 object type you're referencing via cudaImportExternalMemory.

An ID2D12Heap is a representation of a contiguous allocation of memory, whereas an ID3D12Resource is somewhat higher-level, providing methods for (per the docs)

organizing and manipulating simple arrays of data as well as multidimensional data optimized for shader sampling

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.