Overseas access: www.kdjingpai.com
Bookmark Us
Current Position:fig. beginning " AI Answers

如何使用DeepGEMM进行基本的FP8 GEMM运算?

2025-08-30 1.3 K

以下是使用 DeepGEMM 进行基本 FP8 GEMM 运算的步骤:

  1. 导入库和函数::
    import torch
    from deep_gemm import gemm_fp8_fp8_bf16_nt
  2. Preparing to enter data(矩阵 A 和 B,必须是 FP8 格式):
    A = torch.randn(1024, 512, dtype=torch.float8_e4m3fn).cuda()
    B = torch.randn(512, 1024, dtype=torch.float8_e4m3fn).cuda()
  3. 调用函数进行矩阵乘法::
    C = gemm_fp8_fp8_bf16_nt(A, B)
    print(C)

Caveats:

  • 输入矩阵需位于 GPU 上,且格式需为 FP8(E4M3 或 E5M2)
  • 输出结果为 BF16 格式,适合后续计算或存储

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish