NVIDIA / NVIDIA/TransformerEngine

[Feature Request][PyTorch] Support thd format for fp8 tensors in DotProductAttention

Open
#923 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
3.5k
Forks
831
Avg merge
3d 11h
Merged PRs (30d)
65

Description

Seems like at the current time packed tensors in thd format are not supported by transformer_engine.pytorch.attention. DotProductAttention. That's weird as such mode clearly supported by fused_attn_fwd from fused_attn cpp_extensions

I see that FusedAttnFunc was used in FusedAttention, but implementations for FusedAttnFunc_kvpacked and FusedAttnFunc_qkvpacked are not present. I suppose, they could be added in a same way

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with transformer_engine.pytorch.attention.DotProductAttention and compare its FusedAttention path with fused_attn_fwd in the fused_attn cpp_extensions. Review the existing FusedAttnFunc implementation and determine how packed thd FP8 inputs should be handled alongside the missing FusedAttnFunc_kvpacked and FusedAttnFunc_qkvpacked paths. Done means DotProductAttention supports packed thd FP8 tensors consistently with fused_attn_fwd.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.