# What does the \`use\_fast\_accum\` option do in \`torch.\_scaled\_mm\`

**URL:** <https://discuss.pytorch.org/t/what-does-the-use-fast-accum-option-do-in-torch-scaled-mm/208719>\
**Category:** mixed-precision\
**Created:** [August 27, 2024, 11:40am UTC](https://discuss.pytorch.org/t/what-does-the-use-fast-accum-option-do-in-torch-scaled-mm/208719 "2024-08-27T11:40:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![veritas](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/veritas/32/11018_2.png) [@veritas](https://discuss.pytorch.org/u/veritas)\
**Post date:** [August 27, 2024, 11:40am UTC](https://discuss.pytorch.org/t/what-does-the-use-fast-accum-option-do-in-torch-scaled-mm/208719/1 "2024-08-27T11:40:43Z")

</div>

Recent PyTorch support for FP8 in the `torch._scaled_mm` has a `use_fast_accum` flag that I have found to increase throughput by a noticable amount.  
However, even after going through the CUDA code, I was unable to find out what this option does and what potential effects it may have on the matrix multiplication outputs.  
May I ask for help on where to find detailed documentation on the matter?  
If such documentation is not available, I would like to request that it be added, maybe in `torch.ao`.

Many thanks in advance!

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [August 27, 2024, 1:16pm UTC](https://discuss.pytorch.org/t/what-does-the-use-fast-accum-option-do-in-torch-scaled-mm/208719/2 "2024-08-27T13:16:51Z")

</div>

This flag enables `CUBLASLT_MATMUL_DESC_FAST_ACCUM` [here](https://github.com/pytorch/pytorch/blob/dde5974b1368d26bc2cade9722b8ef242e46e242/aten/src/ATen/cuda/CUDABlas.cpp#L1432) which is defined as:

> Flag for managing FP8 fast accumulation mode. When enabled, problem execution might be faster but at the cost of lower accuracy because intermediate results will not periodically be promoted to a higher precision. Default value: 0 - fast accumulation mode is disabled

in the [cuBLAS docs](https://docs.nvidia.com/cuda/cublas/).
