cuda.bindings._v2.driver.mem_map_array_async#
- cuda.bindings._v2.driver.mem_map_array_async(
- map_info_list,
- unsigned int count,
- intptr_t h_stream,
Maps or unmaps subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays.
Performs map or unmap operations on subregions of sparse CUDA arrays and sparse CUDA mipmapped arrays. Each operation is specified by a
CUarrayMapInfoentry in themap_info_listarray of sizecount. The structureCUarrayMapInfois defined as follow:. **View CUDA Toolkit Documentation for a C++ code example**. whereCUarrayMapInfo.resourceTypespecifies the type of resource to be operated on. IfCUarrayMapInfo.resourceTypeis set toCUresourcetype::CU_RESOURCE_TYPE_ARRAY thenCUarrayMapInfo.resource.arraymust be set to a valid sparse CUDA array handle. The CUDA array must be either a 2D, 2D layered or 3D CUDA array and must have been allocated usingcuArrayCreateorcuArray3DCreatewith the flagCUDA_ARRAY3D_SPARSEorCUDA_ARRAY3D_DEFERRED_MAPPING. For CUDA arrays obtained usingcuMipmappedArrayGetLevel,CUDA_ERROR_INVALID_VALUEwill be returned. IfCUarrayMapInfo.resourceTypeis set toCUresourcetype::CU_RESOURCE_TYPE_MIPMAPPED_ARRAY thenCUarrayMapInfo.resource.mipmapmust be set to a valid sparse CUDA mipmapped array handle. The CUDA mipmapped array must be either a 2D, 2D layered or 3D CUDA mipmapped array and must have been allocated usingcuMipmappedArrayCreatewith the flagCUDA_ARRAY3D_SPARSEorCUDA_ARRAY3D_DEFERRED_MAPPING.CUarrayMapInfo.subresourceTypespecifies the type of subresource within the resource.CUarraySparseSubresourceType_enumis defined as:. **View CUDA Toolkit Documentation for a C++ code example**. whereCUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL indicates a sparse-miplevel which spans at least one tile in every dimension. The remaining miplevels which are too small to span at least one tile in any dimension constitute the mip tail region as indicated byCUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL subresource type. IfCUarrayMapInfo.subresourceTypeis set toCUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_SPARSE_LEVEL thenCUarrayMapInfo.subresource.sparseLevelstruct must contain valid array subregion offsets and extents. TheCUarrayMapInfo.subresource.sparseLevel.offsetX,CUarrayMapInfo.subresource.sparseLevel.offsetYandCUarrayMapInfo.subresource.sparseLevel.offsetZmust specify valid X, Y and Z offsets respectively. TheCUarrayMapInfo.subresource.sparseLevel.extentWidth,CUarrayMapInfo.subresource.sparseLevel.extentHeightandCUarrayMapInfo.subresource.sparseLevel.extentDepthmust specify valid width, height and depth extents respectively. These offsets and extents must be aligned to the corresponding tile dimension. For CUDA mipmapped arraysCUarrayMapInfo.subresource.sparseLevel.levelmust specify a valid mip level index. Otherwise, must be zero. For layered CUDA arrays and layered CUDA mipmapped arraysCUarrayMapInfo.subresource.sparseLevel.layermust specify a valid layer index. Otherwise, must be zero.CUarrayMapInfo.subresource.sparseLevel.offsetZmust be zero andCUarrayMapInfo.subresource.sparseLevel.extentDepthmust be set to 1 for 2D and 2D layered CUDA arrays and CUDA mipmapped arrays. Tile extents can be obtained by callingcuArrayGetSparsePropertiesandcuMipmappedArrayGetSparseProperties. IfCUarrayMapInfo.subresourceTypeis set toCUarraySparseSubresourceType::CU_ARRAY_SPARSE_SUBRESOURCE_TYPE_MIPTAIL thenCUarrayMapInfo.subresource.miptailstruct must contain valid mip tail offset inCUarrayMapInfo.subresource.miptail.offsetand size inCUarrayMapInfo.subresource.miptail.size. Both, mip tail offset and mip tail size must be aligned to the tile size. For layered CUDA mipmapped arrays which don’t have the flagCU_ARRAY_SPARSE_PROPERTIES_SINGLE_MIPTAILset inCUDA_ARRAY_SPARSE_PROPERTIES.flagsas returned bycuMipmappedArrayGetSparseProperties,CUarrayMapInfo.subresource.miptail.layermust specify a valid layer index. Otherwise, must be zero. IfCUarrayMapInfo.resource.arrayorCUarrayMapInfo.resource.mipmapwas created withCUDA_ARRAY3D_DEFERRED_MAPPINGflag set theCUarrayMapInfo.subresourceTypeand the contents ofCUarrayMapInfo.subresourcewill be ignored.CUarrayMapInfo.memOperationTypespecifies the type of operation.CUmemOperationTypeis defined as:. **View CUDA Toolkit Documentation for a C++ code example**. IfCUarrayMapInfo.memOperationTypeis set toCUmemOperationType::CU_MEM_OPERATION_TYPE_MAP then the subresource will be mapped onto the tile pool memory specified byCUarrayMapInfo.memHandleat offsetCUarrayMapInfo.offset. The tile pool allocation has to be created by specifying theCU_MEM_CREATE_USAGE_TILE_POOLflag when callingcuMemCreate. Also,CUarrayMapInfo.memHandleTypemust be set toCUmemHandleType::CU_MEM_HANDLE_TYPE_GENERIC. IfCUarrayMapInfo.memOperationTypeis set toCUmemOperationType::CU_MEM_OPERATION_TYPE_UNMAP then an unmapping operation is performed.CUarrayMapInfo.memHandlemust be NULL.CUarrayMapInfo.deviceBitMaskspecifies the list of devices that must map or unmap physical memory. Currently, this mask must have exactly one bit set, and the corresponding device must match the device associated with the stream. IfCUarrayMapInfo.memOperationTypeis set toCUmemOperationType::CU_MEM_OPERATION_TYPE_MAP, the device must also match the device associated with the tile pool memory allocation as specified byCUarrayMapInfo.memHandle.CUarrayMapInfo.flagsandCUarrayMapInfo.reserved[] are unused and must be set to zero.- Parameters:
map_info_list (intptr_t) – List of
CUarrayMapInfo.count (unsigned int) – Count of
CUarrayMapInfoinmap_info_list.h_stream (intptr_t) – Stream identifier for the stream to use for map or unmap operations.
See also
cuMemMapArrayAsync