Rust-GPU / Rust-GPU/rust-gpu

[Migrated] For loops need more optimizations

Open
#123 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Issue automatically imported from old repo: https://github.com/EmbarkStudios/rust-gpu/issues/739
Old labels: t: enhancement,a: codegen
Originally creatd by hrydgard on 2021-08-30T12:50:21Z


Due to how for loops over a range work in Rust, a lot of scaffolding code is generated that is then expected to be optimized away, but in rust-gpu, that doesn't happen enough yet. We had a case where I had to change a for i in 0..8 {} to a while i < 8 { ...; i++ } loop to work around SPIRV-Cross making a right mess out of it.

Filing this issue to have something to point to from the code comment, mainly, not expectations for a quick resolution as I know it's a thorny one.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names Rust range-based for loops, rust-gpu code generation, and SPIRV-Cross, but provides no source file, test, or entry point. Start by locating the referenced code comment and the codegen path for range loops; done would require reducing the generated scaffolding and confirming that SPIRV-Cross produces acceptable output without the while-loop workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.