gpt4 book ai didi

cuda - 如何访问 CUDA 中的稀疏张量核心功能?

转载 作者:行者123 更新时间:2023-12-02 01:27:51 24 4
gpt4 key购买 nike

可以通过 CUDA 中的 WMMA 接口(interface)以编程方式访问张量核心(请参阅 https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#wmmahttps://developer.nvidia.com/blog/programming-tensor-cores-cuda-9/)。最近,在 Ampere 一代卡中,Nvidia 宣布能够使用稀疏矩阵执行稀疏张量运算,如下所示:https://developer.nvidia.com/blog/accelerating-inference-with-sparsity-using-ampere-and-tensorrt/

所呈现的格式似乎采用元素对及其在四个元素段(2 位索引)内的顺序。然而看看wmma documentation我找不到任何提及这一点的内容,或者如何访问这些特殊的张量核心操作。 AFAICT 的该功能的公告页面也没有说明这一点。

如何访问 cuda 中的稀疏张量核心功能?

最佳答案

您问题中的博客文章链接到以下论文:加速稀疏深度神经网络 https://arxiv.org/pdf/2104.08378.pdf

第 3.2 节中说

It is the application’s responsibility to ensure that the first operand is a matrixstored in the compressed 2:4 format. cuSPARSELt and other libraries provide APIs forcompression and sparse math operations, while, starting in version 8.0, the TensorRTSDK performs these functions for 2:4 sparse weights automatically. NVIDIA librariesrequire that input dimensions of a sparse matrix multiplication be multiples of 16 and32 for 16-bit (FP16/BF16) and 8b-integer formats, respectively.

可以使用 ptx mma.sp 手动执行稀疏张量运算,这在 ptx 文档第 9.7.13.5 节:https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#warp-level-matrix-instructions-for-sparse-mma 中进行了解释。

关于cuda - 如何访问 CUDA 中的稀疏张量核心功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74018900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com