Sitelet https://github.com/gpuweb/gpuweb/issues/2118
Skip to content

wgsl: limit layout size of a type #2118

Description

@dneto0

Example:

         var<private> a : array<f32, 0x40000000>;      // 4 billion-ish byte big.

A similar thing can happen with a bigger element type but fewer of them.

Also

       struct S {
            [[size(0xfffffffc)]] a: i32; 
            b: i32;  // byte offset overflows 32-bit
       };

We'd like to be able to reject programs with data structures that are "too big", i.e. have overflowing sizes.

We already visited this somewhat in the max-array-size discussion, and I recall the judgement being "an implementation can reject unreasonably sized arrays", and nothing was added to the spec about that.

So these are two more cases that may fall into the same case.

There are at least a couple of options:

cc: @ben-clayton

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

wgslWebGPU Shading Language Issues

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions