Device-aware Auto() tuning: reduce default items_per_thread leaves ~1.8x on AMD
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 55/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- julia
- 領域
- backend, performance
調査の方向性
Start by reading the existing reduce_tuning(::Backend, ::Type) hooks and the oneAPI extension's predicate_tuning pattern; check the current reduce defaults and tests or benchmarks that exercise Auto() reductions. Add ROCBackend-specific defaults near items_per_thread = 16 and block_size = 512, keeping CUDA and iGPU defaults unchanged. Verify with the existing reduction tests and compare AMD bandwidth against the reported baseline.
索引モデルが issue の本文から書いたものです。
説明
Summary
The Auto() reduce path currently uses a fixed default of items_per_thread = 2 (with block_size = 256). That value is fine on CUDA, where reduce already runs at the memory-bandwidth wall, but it leaves a large amount of performance on the table on AMD, where the same kernel runs at roughly half the card's bandwidth.
Sweeping items_per_thread shows the knee is vendor-dependent: CUDA is already saturated at ipt = 2, while AMD does not reach its bandwidth wall until ipt is around 8 to 16. A single hardcoded global default cannot be right for both.
The fix is to make the Auto() defaults device-informed rather than global, through the existing per-backend tuning hooks (reduce_tuning(::Backend, ::Type) / sort_tuning(::Backend, ::Type), same pattern as the oneAPI extension's predicate_tuning). No new mechanism is needed, only per-backend values.
Measurements
items_per_thread sweep on a 64M-element reduce, block_size = 256, effective bandwidth in GB/s (higher is better). The card's achievable bandwidth on the AMD part is about 315 GB/s.
| items_per_thread | AMD RDNA4 (gfx1200) | NVIDIA RTX 5080 |
|---|---|---|
| 1 | 120 | 356 |
| 2 (current default) | 195 | 564 |
| 4 | 261 | 566 |
| 8 | 263 | 566 |
| 16 | 290 | 568 |
On CUDA the default is already at the knee (a bump buys about 1%). On AMD the default sits well below the knee, and raising ipt is worth roughly 1.5x.
Apples-to-apples against AK.reduce's own default Auto() config (same algorithm and finalize path, only the config changed), AMD RDNA4:
| config | 64M | 16M |
|---|---|---|
default (ipt=2, bs=256) |
159 GB/s | 148 GB/s |
ipt=4, bs=512 |
264 GB/s | - |
ipt=8, bs=512 |
264 GB/s | - |
ipt=16, bs=512 |
292 GB/s | 251 GB/s |
So just raising the AMD reduce config to around ipt=16, bs=512 is about 1.8x for free, within the existing Auto() structure. The last ~8% to the 315 GB/s wall is multi-pass overhead, which a true single-pass reduction would close, but that is a separate change.
Proposal
- Keep the CUDA defaults as they are (already at the bandwidth wall).
- Raise the AMD reduce defaults toward
ipt ~= 16,block_size = 512viareduce_tuning(::ROCBackend, ::Type). - Leave iGPU backends (Metal, Intel) at low
ipt; register pressure there likely wants the opposite direction, so they should be measured before changing, not bumped by analogy.
Environment
- AMD: RDNA4 gfx1200, AMDGPU 2.8.0, KernelAbstractions 0.9.42, KernelInterface 0.3.0
- NVIDIA: RTX 5080, CUDA.jl, Julia 1.12
- Measured against AcceleratedKernels 0.5 (
main). Small CUDA sizes (1M to 16M) are L2-cache-resident on the 5080 and were excluded; only 64M+ is DRAM-meaningful.
- 主要言語
- Julia
- スター
- 204
- フォーク
- 20
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 41
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaGPU/AcceleratedKernels.jl のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
JuliaGPU/AcceleratedKernels.jl#89 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 48/100
JuliaGPU/AcceleratedKernels.jl#201 ·
メンテナーはふだん 1 日以内に返信
-
Inference of reductions with a non-concrete `alg` recurses through GPUArrays 12 and never finishesオープン
難易度 5/5 1週間以上 初心者へのやさしさ 8/100
JuliaGPU/AcceleratedKernels.jl#161 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
JuliaGPU/AcceleratedKernels.jl#159 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
JuliaGPU/AcceleratedKernels.jl#156 ·
メンテナーはふだん 1 日以内に返信
JuliaGPU/AcceleratedKernels.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
MagneticResonanceImaging/MRIReco.jl#366 ·
メンテナーはふだん 3 日以内に返信
-
`AdamW` gives `NaN` for zero-gradient entries of `Float16` parameters (epsilon underflows to 0)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
FluxML/Optimisers.jl#253 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
JuliaGraphs/GraphNeuralNetworks.jl#736 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
`poissonians` is not public, unlike `brownians` and `jumps`対応中かも @isaacsas が今日担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
SciML/ModelingToolkit.jl#5389 ·
メンテナーはふだん 2 日以内に返信