Lack of unrolling and very high register usage
@Firestar99 đang làm issue này rồi.
Từ ngày 26/11/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
I have many places in the code that can be condensed to something like this:
const MAX_BUCKET_SIZE: usize = 512;
const WORKGROUP_SIZE: u32 = 256;
unsafe {
core::hint::assert_unchecked(matches_count <= MAX_BUCKET_SIZE);
}
for index in (local_invocation_id..matches_count as u32).step_by(WORKGROUP_SIZE as usize) {
Can also be rewritten in a way that will probably produce some helpful runtime code in SPIR-V since I suspect the hint will be lost in translation:
const MAX_BUCKET_SIZE: usize = 512;
const WORKGROUP_SIZE: u32 = 256;
for index in (local_invocation_id..matches_count.min(MAX_BUCKET_SIZE) as u32)
.step_by(WORKGROUP_SIZE as usize)
{
It is not difficult for me to see that there will be at most two loop iterations here per invocation. However, it is not something compiler sees today.
The result is much higher register usage, impacting occupancy in a big way.
Rewriting it to inner function that is called twice with explicit bounds checks fixes register usage (though I hit https://github.com/Rust-GPU/rust-gpu/issues/461 when doing so), but is far from idiomatic Rust and is quite painful to do manually in all such cases.
I wish end-to-end compilation chain was aware of things like this, it is a very important pattern for performance.
In fact loop unrolling is extremely bad right now, even fixed loops with 3-4 iterations and one or several simply ALU instructions in it are not unrolled and balloon register usage.
- Ngôn ngữ chính
- Rust
- Star
- 3.4k
- Fork
- 126
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Rust-GPU/rust-gpu
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
glam v0.33.6 breaks `Vec3A` Đang mởbug
-
enhancement
Rust-GPU/rust-gpu#643 · 3 bình luận · 1 reaction · 1 người được giao ·
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Tất cả issue của Rust-GPU/rust-gpu
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug good first issue package: quic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
-
`dora trace view` sends a non-canonical full UUID as-is, so a valid trace ID shows "No spans found" Đang mởcli coordinator rust
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
area: tasks enhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Jason-jo17/Polybench#15 · 1 bình luận ·