Skip to content

Skip bfloat16 rnn_relu benchmark on pre-Ampere GPU - #229

Merged
Dongxu-H merged 2 commits into
flagos-ai:infra-cifrom
yzw1128:feat/rnn-relu-skip-bf16
Aug 11, 2026
Merged

Skip bfloat16 rnn_relu benchmark on pre-Ampere GPU#229
Dongxu-H merged 2 commits into
flagos-ai:infra-cifrom
yzw1128:feat/rnn-relu-skip-bf16

Conversation

@yzw1128

@yzw1128 yzw1128 commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Skip bfloat16 in the rnn_relu benchmark on GPUs whose compute capability
is less than 8.0 (pre-Ampere). This includes the Iluvatar BI-V150 (CC 7.1).

Pre-Ampere GPUs lack native bfloat16 hardware support. The Triton bf16
backend falls back to software conversion for every load/store operation.
In an RNN the hidden-state recurrence performs bf16 loads and stores on every
time step, and the accumulated conversion overhead makes the kernel ~20x
slower than PyTorch cuDNN (speedup ~0.05x). That number is not a meaningful
performance metric — it reflects a missing hardware feature, not an
optimisation opportunity.

Files Changed

  • benchmark/test_rnn_relu.py: Gate bf16 on torch.cuda.get_device_capability()[0] >= 8

@Dongxu-H Dongxu-H 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.

LGTM

@Dongxu-H Dongxu-H 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.

LGTM

@Dongxu-H Dongxu-H 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.

torch.cuda.get_device_capability() only works on NVIDIA GPUs. Other backends like Iluvatar, Ascend, Metax may need different detection methods. Consider using flag_gems.vendor_name or torch.cuda.get_device_properties() for broader compatibility.

@Dongxu-H Dongxu-H 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.

LGTM

@Dongxu-H Dongxu-H 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.

torch.cuda.get_device_capability() may throw exception on non-CUDA devices. Consider adding try-except or checking torch.cuda.is_available() first.

@Dongxu-H Dongxu-H 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.

LGTM

@Dongxu-H Dongxu-H 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.

PR 包含大量基础设施变更(删除 CODEOWNERS、修改 workflow 分支、添加 sync-to-kernelgen workflow),这些变更不应与 benchmark 修改混在一起提交。基础设施变更应单独提 PR。

@Dongxu-H Dongxu-H 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.

PR contains large infrastructure changes (removing CODEOWNERS, modifying workflows, adding image-builder and sync-to-kernelgen workflows, modifying backends.yaml, fused_marlin_moe.py) that should not be mixed with benchmark changes. Infrastructure changes should be submitted as separate PR. Only benchmark-specific changes should remain: benchmark/test_rnn_relu.py bf16 skip logic.

@Dongxu-H Dongxu-H 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.

PR 标题描述的是 rnn_relu benchmark 的 bf16 跳过,但实际变更包含了多个新算子(linalg_ldl_solve, slice, special_i0, special_softmax 等)的注册和配置,这些算子没有对应的实现文件。

src/flag_gems/init.py 中存在重复注册:
special_log1p 在 777 和新增的 773 行重复注册
special_logsumexp 在 781 和新增的 778 行重复注册
special_xlog1py 在 826 和新增的 827 行重复注册

conf/operators.yaml 中 special_shifted_chebyshev_polynomial_t 条目缺少 labels 字段。

conf/operators.yaml 中 special_spherical_bessel_j0 条目缺少 labels、kind、stages 字段。

建议拆分 PR,将 benchmark 修改与算子注册分离。

@Dongxu-H Dongxu-H 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.

PR 包含 95 个文件变更,但标题只描述了 rnn_relu benchmark 的修改。这看起来是分支没有正确 rebase 到最新的 infra-ci 分支导致的。建议重新创建 PR:git checkout feat/rnn-relu-skip-bf16 && git rebase origin/infra-ci && git push -f。核心修改(rnn_relu benchmark 跳过 pre-Ampere GPU 的 bfloat16)逻辑合理。

@yzw1128
yzw1128 force-pushed the feat/rnn-relu-skip-bf16 branch from 0f2fe66 to dda909d Compare August 10, 2026 03:50
@yzw1128
yzw1128 force-pushed the feat/rnn-relu-skip-bf16 branch from dda909d to 0256ff7 Compare August 10, 2026 05:01
@yzw1128 yzw1128 changed the title Skip bfloat16 rnn_relu benchmark on pre-Ampere GPUs Skip bfloat16 rnn_relu benchmark on pre-Ampere GPUs Aug 10, 2026
@yzw1128 yzw1128 changed the title Skip bfloat16 rnn_relu benchmark on pre-Ampere GPUs Skip bfloat16 rnn_relu benchmark on pre-Ampere GPU Aug 10, 2026
yzw1128 and others added 2 commits August 10, 2026 14:01
- On GPUs with compute capability less than 8.0 (e.g., Iluvatar
  BI-V150 at CC 7.1), replace bfloat16 with float16 instead of
  skipping it — the benchmark still runs 3 dtype entries with
  meaningful numbers rather than dropping to 2 entries
- Pre-Ampere GPUs lack native bf16 hardware support; the Triton
  bf16 backend falls back to software conversion that makes the
  RNN hidden-state recurrence ~20x slower — not a meaningful metric

Co-Authored-By: yzw1128 <yzw1128@users.noreply.github.com>
@yzw1128
yzw1128 force-pushed the feat/rnn-relu-skip-bf16 branch from ff837ca to 74e8edf Compare August 10, 2026 06:02

@Dongxu-H Dongxu-H 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.

CI python-op job failed. The change replaces bf16 with fp16 on pre-Ampere GPUs instead of skipping, which is a reasonable approach given the performance issue. The dict.fromkeys() deduplication preserves order correctly.

@Dongxu-H Dongxu-H 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.

CI python-op failed. Can you check if the failure is related to this change?

The benchmark modification logic looks reasonable for handling pre-Ampere GPU bfloat16 support limitation.

@Dongxu-H
Dongxu-H marked this pull request as draft August 11, 2026 08:36
@Dongxu-H
Dongxu-H marked this pull request as ready for review August 11, 2026 08:36
@Dongxu-H
Dongxu-H merged commit 1375a82 into flagos-ai:infra-ci Aug 11, 2026
16 of 17 checks passed
@Dongxu-H

Copy link
Copy Markdown
Collaborator

/test | cudnn_convolution:metax

@github-actions

Copy link
Copy Markdown

⚠️ Cannot proceed with operation

  • reviewDecision: skip_reviews
  • commitStatus: FAILURE

Reviews are not required for this operation but CI checks must be passing in order to continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants