[MiniMax-H3] RoPE re-assembles the rotated and pass-through channels with torch.cat, which is slow on ROCm

Aberta
#15,401 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #15393 de @Shan2L — fechado sem integrar

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
15/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
python, pytorch
Domínio
ai, performance

Direção de pesquisa

The RoPE helper in the MiniMax-H3 transformer code is the entry point: it slices the first rotary_dim channels, rotates them, and rebuilds the tensor with torch.cat. Work is already under way in linked pull request #15393, which has the change implemented, so this is not open for a new contributor. Done would mean the same output with the concat replaced by an in-place write into a copy of the input, verified by the existing MiniMax-H3 tests.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Is your feature request related to a problem? Please describe.

The MiniMax-H3 and MiniMax-H3-Image transformers apply RoPE to the first rotary_dim channels of each head and pass the rest through. The helper slices, rotates, and re-assembles the result with torch.cat of last-dimension slices. On ROCm that torch.cat takes a slow generic copy path (pytorch/pytorch#206557), so the RoPE apply costs about twice what it needs to.

Describe the solution you'd like.

Write the rotated part into a copy of the input instead of concatenating. The arithmetic is unchanged and the output is bitwise identical. On one Radeon AI PRO R9600D (gfx1201): RoPE apply 2.15x faster on the MiniMax-H3-Image shape, a 2048x2048 request 31.43 -> 31.00 s.

Describe alternatives you've considered.

Fixing torch.cat itself (pytorch/pytorch#206555) helps every caller but only lands with a future PyTorch release; the model-side change needs no new PyTorch.

Additional context.

Implemented in #15393.

Linguagem predominante
Python
Estrelas
35k
Forks
7.5k
Merge médio
2d 22h
PRs com merge (30d)
58

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de huggingface/diffusers

Todas as issues de huggingface/diffusers

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.