Rust-GPU / Rust-GPU/rust-gpu

[Migrated] Compiling uom crashes the compiler

Open
#56 0 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/1150
Old labels: t: bug
Originally creatd by JensGM on 2024-05-21T12:17:15Z


Expected Behaviour

Compile doesn't fail

Example & Steps To Reproduce
  1. Write a shader with a dependency on uom

System Info

  • Rust: rustc 1.74.0-nightly (8ce4540bd 2023-09-29)
  • OS: macos 14.5 (23F79)
  • GPU: m1 pro

Backtrace

Updating crates.io index Compiling uom v0.36.0 thread 'rustc' panicked at /Users/jens/sources/rust-gpu/crates/rustc_codegen_spirv/src/builder/builder_methods.rs:521:34: attempt to divide by zero stack backtrace: 0: 0x1052144dc - ::fmt::h8895b8b562a90ee4 1: 0x105267f58 - core::fmt::write::h7a9cc4d1d610bd71 2: 0x10520a08c - std::io::Write::write_fmt::h87ff59bc697656ff 3: 0x10521431c - std::sys_common::backtrace::print::ha692d990665b4a43 4: 0x105216f18 - std::panicking::default_hook::{{closure}}::hf23c7dbcec5e5d80 5: 0x105216c30 - std::panicking::default_hook::h6d5fe0c884e09021 6: 0x10d7596fc - as core[49eafda268333cb]::ops::function::Fn<(&dyn for<'a, 'b> core[49eafda268333cb]::ops::func tion::Fn<(&'a core[49eafda268333cb]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[49eafda268333cb]::marker::Sync + core[49eafda268333cb]::marker::Send, &core[49eafda268333cb]::panic::panic_info::PanicInfo)>>::call 7: 0x10d7596fc - as core[49eafda268333cb]::ops::function::Fn<(&dyn for<'a, 'b> core[49eafda268333cb]::ops::func tion::Fn<(&'a core[49eafda268333cb]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[49eafda268333cb]::marker::Sync + core[49eafda268333cb]::marker::Send, &core[49eafda268333cb]::panic::panic_info::PanicInfo)>>::call 8: 0x1052176b0 - std::panicking::rust_panic_with_hook::h7c3b2a0098acc318 9: 0x10521743c - std::panicking::begin_panic_handler::{{closure}}::h5a56c37d4253c5c6 10: 0x105214968 - std::sys_common::backtrace::__rust_end_short_backtrace::h6240b1fcaf592476 11: 0x1052171e8 - _rust_begin_unwind 12: 0x1052932c0 - core::panicking::panic_fmt::h665dccaf061d2198 13: 0x105293334 - core::panicking::panic::he1ba182bf716bbc2 14: 0x106c7099c - rustc_codegen_spirv::builder::builder_methods::::recover_access_chain_from_offset::he6b0c04ddb3305e7 15: 0x106c76c2c - rustc_codegen_spirv::builder::builder_methods::::pointercast::h9cc3e414ef1f966a 16: 0x106c75fe0 - rustc_codegen_spirv::builder::builder_methods::::bitcast::h95bef7ee067e6e52 17: 0x106c72388 - rustc_codegen_spirv::builder::builder_methods::::ret::hea66e4be1e6f30df 18: 0x106c37b04 - rustc_codegen_ssa::mir::block::>::codegen_terminator::ha5211e4b8b8ed3fc 19: 0x106c34f08 - rustc_codegen_ssa::mir::codegen_mir::h680cf704b650ab2a 20: 0x106cc9080 - rustc_codegen_ssa::base::codegen_instance::hf2c0f9e676c3fe71 21: 0x106c0e9b4 - ::define::hf389f7022ecbfada 22: 0x106c24f6c - ::compile_codegen_unit::{{closure}}::h0218353bb7111ed5 23: 0x106c2491c - ::compile_codegen_unit::h91c26f9a6763dca3 24: 0x106cc8a9c - rustc_codegen_ssa::base::codegen_crate::h54fbe7881ae09c5c 25: 0x106c23ccc - ::codegen_crate::ha25804fa111ed196 26: 0x10d8bb7d4 - ::time::, rustc_interface[698431996f4b6697]::passes::start_codegen::{closur e#0}> 27: 0x10d89dd28 - rustc_interface[698431996f4b6697]::passes::start_codegen 28: 0x10d8bf5e4 - ::enter::<::ongoing_codegen::{closure#0}, core[49eafda268333cb]::result::Result, rustc_span[de8f35f4add29872]::ErrorGuaranteed>> 29: 0x10d88f4a0 - ::ongoing_codegen 30: 0x10d7860b4 - rustc_span[de8f35f4add29872]::set_source_map::, rustc_interface[698431996f4b6697]::interface::run_compiler, rustc_driver_impl[19b3a9f15fe02931]::run_compiler::{closure#1}>::{closure#0}::{closure#0}> 31: 0x10d757618 - std[3254da1c1438db11]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[19b3a9f15fe02931]::run_compiler::{closure#1}>::{closure#0}, core[49eafda268333cb]::result::Result<(), rustc_span[de 8f35f4add29872]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[49eafda268333cb]::result::Result<(), rustc_span[de8f35f4add29872]::ErrorGuaranteed>> 32: 0x10d758738 - <::spawn_unchecked_, rustc_driver_impl[19b3a9f15fe02931]::run_compiler::{closure#1}>::{closure#0}, core[49eafda268333cb]::result::Result<(), rustc_span[de8f35f4add29872]:: ErrorGuaranteed>>::{closure#0}::{closure#0}, core[49eafda268333cb]::result::Result<(), rustc_span[de8f35f4add29872]::ErrorGuaranteed>>::{closure#1} as core[49eafda268333cb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 33: 0x105220558 - std::sys::unix::thread::Thread::new::thread_start::h86fccd826fc7dcb1 34: 0x197ecaf94 - __pthread_joiner_wake

<backtrace>

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

Reproduce the crash with a Rust shader that depends on uom v0.36.0, using the reported compiler and environment details as a baseline. Start in crates/rustc_codegen_spirv/src/builder/builder_methods.rs at recover_access_chain_from_offset, where the backtrace reports division by zero. Done means compiling the uom-dependent shader no longer panics.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.