vkGetCudaModuleCacheNV(3)
C Specification
To get the CUDA module cache call:
// Provided by VK_NV_cuda_kernel_launchVkResult vkGetCudaModuleCacheNV( VkDevice device, VkCudaModuleNV module, size_t* pCacheSize, void* pCacheData);Parameters
deviceis the logical device that destroys the Function.moduleis the CUDA module.pCacheSizeis a pointer containing the amount of bytes to becopied inpCacheDatapCacheDatais a pointer to a buffer in which to copy the binarycache
Description
IfpCacheData isNULL, then the size of the binary cache, in bytes,is returned inpCacheSize.Otherwise,pCacheSizemust point to a variable set by the applicationto the size of the buffer, in bytes, pointed to bypCacheData, and onreturn the variable is overwritten with the amount of data actually writtentopCacheData.IfpCacheSize is less than the size of the binary shader code, nothingis written topCacheData, andVK_INCOMPLETE will be returnedinstead ofVK_SUCCESS.
The returned cachemay then be used later for further initialization of theCUDA module, by sending this cacheinstead of the PTX code when usingvkCreateCudaModuleNV.
Using the binary cache instead of the original PTX codeshouldsignificantly speed up initialization of the CUDA module, given that thewhole compilation and validation will not be necessary. As withVkPipelineCache, the binary cache depends on the specificimplementation.The applicationmust assume the cache upload might fail in manycircumstances and thusmay have to get ready for falling back to theoriginal PTX code if necessary.Most often, the cachemay succeed if the same device driver andarchitecture is used between the cache generation from PTX and the use ofthis cache.In the event of a new driver version or if using a different devicearchitecture, this cachemay become invalid. |
This query does not behave consistently with the behavior described inOpaque Binary Data Results, for historicalreasons. If the amount of data available is larger than the passed |
VUID-vkGetCudaModuleCacheNV-device-parameter
devicemust be a validVkDevice handleVUID-vkGetCudaModuleCacheNV-module-parameter
modulemust be a validVkCudaModuleNV handleVUID-vkGetCudaModuleCacheNV-pCacheSize-parameter
pCacheSizemust be a valid pointer to asize_tvalueVUID-vkGetCudaModuleCacheNV-pCacheData-parameter
If the value referenced bypCacheSizeis not0, andpCacheDatais notNULL,pCacheDatamust be a valid pointer to an array ofpCacheSizebytesVUID-vkGetCudaModuleCacheNV-module-parent
modulemust have been created, allocated, or retrieved fromdevice
Document Notes
For more information, see theVulkan Specification.
This page is extracted from the Vulkan Specification.Fixes and changes should be made to the Specification, not directly.