Skip to content

Conversation

eddyb
Copy link
Contributor

@eddyb eddyb commented Apr 21, 2023

This PR has roughly three broad stages:

  1. standard SPIR-V OpSource is used instead of rustc SourceFile hashes
    • suboptimal because it keeps Rust source code in the SPIR-V files
    • rustc SourceFiles can still be accurately regenerated from the paths+sources
    • using the standard OpSource mechanism might allow other tools to work well long-term
  2. better reporting of the "zombie" (deferred errors) usage stack trace
    • (see also below for a longer example)
    • mostly using information that was already there (just cumbersome to extract outside of SPIR-T)
    • this PR also replaces all "error in use code, zombie in core & friends" logic to always zombie, as the errors are on average higher-quality now for zombies
  3. a SPIR-T pass for reporting diagnostics, along the above lines

For 2. we have this change in diagnostics:

before this PRafter this PR
error: Cannot memcpy dynamically sized data
    --> $CORE_SRC/intrinsics.rs:2460:9
     |
2460 |         copy(src, dst, count)
     |         ^^^^^^^^^^^^^^^^^^^^^
     |
     = note: Stack:
             core::intrinsics::copy::
             ptr_copy::copy_via_raw_ptr
             ptr_copy::main
             main
error: cannot memcpy dynamically sized data
    --> $CORE_SRC/intrinsics.rs:2460:9
     |
2460 |         copy(src, dst, count)
     |         ^
     |
note: used from within `core::intrinsics::copy::`
    --> $CORE_SRC/intrinsics.rs:2447:21
     |
2447 | pub const unsafe fn copy(src: *const T, dst: *mut T, count: usize) {
     |                     ^
note: called by `ptr_copy::copy_via_raw_ptr`
    --> $DIR/ptr_copy.rs:30:18
     |
30   |         unsafe { core::ptr::copy(src, dst, 1) }
     |                  ^
note: called by `ptr_copy::main`
    --> $DIR/ptr_copy.rs:35:5
     |
35   |     copy_via_raw_ptr(&i, o);
     |     ^
note: called by `main`
    --> $DIR/ptr_copy.rs:33:1
     |
33   | #[spirv(fragment)]
     | ^

@eddyb eddyb requested a review from oisyn as a code owner April 21, 2023 01:00
@eddyb eddyb enabled auto-merge (rebase) April 21, 2023 01:02
@eddyb eddyb merged commit 7b71878 into EmbarkStudios:main Apr 21, 2023
@eddyb eddyb deleted the zombie-refactor branch April 21, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants