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

spirv: Memory accesses with PhysicalStorageBuffer must use Aligned #23212

Open
igaryhe opened this issue Mar 12, 2025 · 0 comments · May be fixed by #23158
Open

spirv: Memory accesses with PhysicalStorageBuffer must use Aligned #23212

igaryhe opened this issue Mar 12, 2025 · 0 comments · May be fixed by #23158
Labels
arch-spirv Khronos Group SPIR-V backend-self-hosted bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@igaryhe
Copy link
Contributor

igaryhe commented Mar 12, 2025

Zig Version

0.15.0-dev.34+8e0a4ca4b

Steps to Reproduce and Observed Behavior

sample code:

const std = @import("std");
const gpu = std.gpu;

const v4 = @Vector(4, f32);

const Input = struct {
    color: v4,
};

const PushConstant = extern struct {
    buffer: [*]addrspace(.global) Input,
};

extern var iid: u32 addrspace(.input);
extern var pc: PushConstant addrspace(.push_constant);
extern var color: v4 addrspace(.output);

export fn main() callconv(.spirv_vertex) void {
    gpu.location(&color, 0);
    const input = pc.buffer[iid];
    color = input.color;
}

compile with:

zig build-obj test.zig -target spirv64-vulkan -ofmt=spirv -mcpu vulkan_v1_2+int64 -fno-llvm

running spirv-val test.spv returns:

error: line 61: Memory accesses with PhysicalStorageBuffer must use Aligned.
  %input = OpLoad %test_Input %23 None

Expected Behavior

alignment should be specified when loading from a PhysicalStorageBuffer pointer. the expected behaviour is that the validator shouldn't complain about anything.

@igaryhe igaryhe added the bug Observed behavior contradicts documented or intended behavior label Mar 12, 2025
@martinetd martinetd linked a pull request Mar 12, 2025 that will close this issue
alichraghi added a commit to alichraghi/zig that referenced this issue Mar 12, 2025
@alexrp alexrp added the arch-spirv Khronos Group SPIR-V label Mar 13, 2025
@alexrp alexrp added this to the 0.15.0 milestone Mar 13, 2025
igaryhe pushed a commit to igaryhe/zig that referenced this issue Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-spirv Khronos Group SPIR-V backend-self-hosted bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants