Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression on master when allocating arrays of arrays #46

Open
LegNeato opened this issue Nov 4, 2024 · 3 comments
Open

Regression on master when allocating arrays of arrays #46

LegNeato opened this issue Nov 4, 2024 · 3 comments
Labels
bug Something isn't working regression

Comments

@LegNeato
Copy link
Collaborator

LegNeato commented Nov 4, 2024

Minimal repro that fails to compile:

use spirv_std::spirv;

#[spirv(fragment)]
pub fn main() {
    let x = [[1; 2]; 1];
}

Bisects to 02cd324

It was found in #21 (comment) (assuming it is the same issue, but at least that is what I started with to get a repro)

@LegNeato
Copy link
Collaborator Author

LegNeato commented Nov 4, 2024

@eddyb not sure if this will be fixed by your qptr stuff.

@eddyb
Copy link
Collaborator

eddyb commented Nov 4, 2024

Is this the error you're seeing?

error: cannot cast between pointer types
       from `*i32`
         to `*[i32; 2]`

With my various changes I also get:

error: error:0:0 - OpStore Pointer <id> '32[%32]' is not a logical pointer.
         OpStore %32 %33

And with a full move to qptr, something goes wrong with qptr.copy:

error: error:0:0 - Opcode CopyMemorySized requires one of these capabilities: Addresses 
         OpCopyMemorySized %29 %30 %uint_8

(and I'm not getting the kind of SPIR-T errors I would expect, either).

02cd324 shouldn't have broken anything like this, but that code is subtle and I am not exactly surprised.

My best guess is that something is being ambiguous about wanting access to the whole inner [_; 2] array, and instead it gets just the leaf field.

@LegNeato
Copy link
Collaborator Author

LegNeato commented Nov 4, 2024

Yep, that's the error:

error: cannot cast between pointer types
       from `*i32`
         to `*[i32; 2]`

LegNeato added a commit to LegNeato/rust-gpu that referenced this issue Dec 1, 2024
LegNeato added a commit to LegNeato/rust-gpu that referenced this issue Dec 1, 2024
LegNeato added a commit that referenced this issue Dec 13, 2024
These passed before 02cd324.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working regression
Projects
None yet
Development

No branches or pull requests

2 participants