7.27. cudaFuncAttributes 结构体参考

[CUDA运行时使用的数据类型]

CUDA函数属性

公共变量

int  binaryVersion
int  cacheModeCA
int  clusterDimMustBeSet
int  clusterSchedulingPolicyPreference
size_t  constSizeBytes
size_t  localSizeBytes
int  maxDynamicSharedSizeBytes
int  maxThreadsPerBlock
int  nonPortableClusterSizeAllowed
int  numRegs
int  preferredShmemCarveout
int  ptxVersion
int  requiredClusterWidth
int  reserved[16]
size_t  sharedSizeBytes

变量

int cudaFuncAttributes::binaryVersion [inherited]

函数编译所针对的二进制架构版本。该值为主版本号乘以10加上次版本号,因此二进制版本1.3的函数将返回值13。

int cudaFuncAttributes::cacheModeCA [inherited]

该属性用于指示函数是否已使用用户指定的编译选项"-Xptxas --dlcm=ca"进行编译。

int cudaFuncAttributes::clusterDimMustBeSet [inherited]

如果设置了此属性,内核必须使用指定的有效集群维度启动。

int cudaFuncAttributes::clusterSchedulingPolicyPreference [inherited]

函数的块调度策略。参见cudaFuncSetAttribute

size_t cudaFuncAttributes::constSizeBytes [inherited]

该函数所需的用户分配常量内存大小(以字节为单位)。

size_t cudaFuncAttributes::localSizeBytes [inherited]

该函数每个线程使用的本地内存大小(以字节为单位)。

int cudaFuncAttributes::maxDynamicSharedSizeBytes [inherited]

该函数每个块动态共享内存的最大字节数。任何启动操作的动态共享内存大小都必须小于此值。

int cudaFuncAttributes::maxThreadsPerBlock [inherited]

每个块的最大线程数,超过此数值将导致函数启动失败。该数值取决于函数本身以及当前加载该函数的设备。

int cudaFuncAttributes::nonPortableClusterSizeAllowed [inherited]

该函数是否允许使用非可移植的集群大小启动。1表示允许,0表示禁止。非可移植的集群大小可能仅在程序测试过的特定SKU上有效。如果在不同的硬件平台上运行该程序,启动可能会失败。

CUDA API提供了cudaOccupancyMaxActiveClusters来帮助检查当前设备上是否可以启动所需的大小。

可移植的集群规模

可移植的集群大小保证在所有高于目标计算能力的计算能力上都能正常工作。 对于sm_90,可移植的集群大小为每个集群8个块。这个值可能会随着未来计算能力的提升而增加。

特定硬件单元可能支持更大的集群规模,但这不能保证可移植性。请参阅cudaFuncSetAttribute

int cudaFuncAttributes::numRegs [inherited]

该函数每个线程使用的寄存器数量。

int cudaFuncAttributes::preferredShmemCarveout [inherited]

在使用相同硬件资源的L1缓存和共享内存的设备上,此设置用于指定共享内存的预留比例,以最大共享内存的百分比表示。请参阅cudaDevAttrMaxSharedMemoryPerMultiprocessor。这仅是一个提示,驱动程序可根据函数执行需要选择不同的比例。详见cudaFuncSetAttribute

int cudaFuncAttributes::ptxVersion [inherited]

函数编译所针对的PTX虚拟架构版本。该值为主版本号乘以10加上次版本号,例如PTX 1.3版本的函数将返回值13。

int cudaFuncAttributes::requiredClusterWidth [inherited]

所需的集群宽度/高度/深度(以块为单位)。这些值必须全部为0或全部为正数。集群维度的有效性将在启动时进行检查。

如果在编译时设置了该值,则无法在运行时设置。在运行时设置应返回cudaErrorNotPermitted。 参见cudaFuncSetAttribute

int cudaFuncAttributes::reserved[16] [inherited]

保留供未来使用。

size_t cudaFuncAttributes::sharedSizeBytes [inherited]

该函数每个块所需的静态分配共享内存大小(以字节为单位)。这不包括用户在运行时请求的动态分配共享内存。