Skip to content

Triton finegrained fp8/fp4 - #46407

Merged
IlyasMoutawwakil merged 12 commits into
mainfrom
finegrained-fp8-v2
Jun 8, 2026
Merged

IlyasMoutawwakil merged 12 commits into
mainfrom
finegrained-fp8-v2

Conversation

@IlyasMoutawwakil

Copy link
Copy Markdown
Member

What does this PR do?

Fixes # (issue)

Code Agent Policy

The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. We are currently bottlenecked by our ability to review and respond to them. As a result,
we ask that new users do not submit pure code agent PRs at this time.
You may use code agents in drafting or to help you diagnose issues. We'd also ask autonomous "OpenClaw"-like agents
not to open any PRs or issues for the moment.

PRs that appear to be fully agent-written will probably be closed without review, and we may block users who do this
repeatedly or maliciously.

This is a rapidly-evolving situation that's causing significant shockwaves in the open-source community. As a result,
this policy is likely to be updated regularly in the near future. For more information, please read CONTRIBUTING.md.

  • I confirm that this is not a pure code agent PR.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@IlyasMoutawwakil
IlyasMoutawwakil marked this pull request as ready for review June 5, 2026 07:23
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

CI Dashboard: View test results in Grafana

@IlyasMoutawwakil
IlyasMoutawwakil requested a review from vasqu June 8, 2026 10:12
@IlyasMoutawwakil

Copy link
Copy Markdown
Member Author

still need static cache to speedup the decode, otherwise the decode dominates 🥲
generate

@ArthurZucker ArthurZucker left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty! Can you add a compile test if that is suppose to fixe it? 🤗

Comment on lines +434 to +435
# Post-mask sentinel rows: kernel left them uninitialized, so zero them out
# before the reduction below (uninit may be NaN; NaN * 0 = NaN).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh nice catch if we were not doing this before when that was fixed on other ops

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i took the time to add sentinel support/skipping in batched_mm impls in huggingface/kernels-community#923, before we used to clamp so the batched_mm projected sentinels on the last expert, now it just skips their computations (like grouped_mm)

prompt_len = inputs.input_ids.size(1)
# `deepgemm` experts impl is excluded — DeepGEMM kernels race in single-process
# multi-GPU runs (which `device_map="auto"` always is for a model this size).
for impl in ("eager", "batched_mm", "grouped_mm"):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: deepseek_v4

@IlyasMoutawwakil

IlyasMoutawwakil commented Jun 8, 2026 •

Copy link
Copy Markdown
Member Author

@ArthurZucker fixed compilation, our triton kernels compile well now, deepgemm compile is still broken upstream (cpu-gpu sync in a function assert), will fix that in kernels-community

@IlyasMoutawwakil
IlyasMoutawwakil added this pull request to the merge queue Jun 8, 2026
Merged via the queue into main with commit 0c9e543 Jun 8, 2026
119 checks passed
@IlyasMoutawwakil
IlyasMoutawwakil deleted the finegrained-fp8-v2 branch June 8, 2026 16:08
@stevhliu stevhliu mentioned this pull request Jun 8, 2026
khushali9 pushed a commit to khushali9/transformers that referenced this pull request Jun 8, 2026
* finegrained fp8/fp4

* drop pref

* order

* full testing

* remove errors

* better ep + batched_mm

* add batched as well

* add ability to disable deepgemm linear fp8

* compilable

* torch compile tests and cold cache hack
louzongzhi pushed a commit to louzongzhi/transformers that referenced this pull request Jun 10, 2026
* finegrained fp8/fp4

* drop pref

* order

* full testing

* remove errors

* better ep + batched_mm

* add batched as well

* add ability to disable deepgemm linear fp8

* compilable

* torch compile tests and cold cache hack
louzongzhi pushed a commit to louzongzhi/transformers that referenced this pull request Jun 10, 2026
* finegrained fp8/fp4

* drop pref

* order

* full testing

* remove errors

* better ep + batched_mm

* add batched as well

* add ability to disable deepgemm linear fp8

* compilable

* torch compile tests and cold cache hack
stevhliu pushed a commit to stevhliu/transformers that referenced this pull request Jul 30, 2026
* finegrained fp8/fp4

* drop pref

* order

* full testing

* remove errors

* better ep + batched_mm

* add batched as well

* add ability to disable deepgemm linear fp8

* compilable

* torch compile tests and cold cache hack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants