Rust-GPU / Rust-GPU/rust-gpu

Malformed SPIRV after assignment to mutable reference

Open
#178 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Issue originally found by rustlantis.

This reduced example:

#![no_std]
use spirv_std::spirv;
#[spirv(compute(threads(1)))]
pub fn fn1(#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] mut addr: &mut f32) {
    addr = addr;
    (*addr) = 0.0;
}

Results in invalid SPIR-V:

error: malformed SPIR-V (in OpStore: undefined ID %33)
  |
  = note: while lowering SPIR-V module to SPIR-T (spirt::spv::lower)
  = note: input SPIR-V module was saved to /home/michal/rust-gpu/target/spirv-builder/spirv-unknown-vulkan1.1/release/deps/sky_shader.spirt-lower-from-spv-input.spv

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

Start by compiling the reduced Rust example with rust-gpu and inspect the generated SPIR-V associated with the assignment to the mutable reference. Confirm the malformed module and undefined ID reported during SPIR-T lowering; done means the example produces valid SPIR-V without the OpStore error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.