Skip to content

Conversation

@dneto0
Copy link
Contributor

@dneto0 dneto0 commented Mar 5, 2021

Reverts #1468

Reverting because we have the rule:

The type of an expression must not be a runtime-sized array type.

You should not have been able to "load" the whole runtime array in the first place.

@dneto0 dneto0 requested review from alan-baker and kvark March 5, 2021 17:01
@dneto0 dneto0 added wgsl WebGPU Shading Language Issues wgsl resolved Resolved - waiting for a change to the WGSL specification labels Mar 5, 2021
@alan-baker
Copy link
Contributor

I don't think you are loading the whole array, but until pointers are resolved it's not obvious. Without this runtime arrays are useless.

@alan-baker
Copy link
Contributor

I don't think you are loading the whole array, but until pointers are resolved it's not obvious. Without this runtime arrays are useless.

For the non-array case:

[[block]] struct A {
  x : array<u32, 4>;
};
var<storage> v : [[access(read_write)]] A;
void main() {
  const a : u32 = v.a[0];
  // ...
}

If v.a[0] loads the whole array then many extra data races would be introduced.

@kvark
Copy link
Contributor

kvark commented Mar 8, 2021

Agree with @alan-baker . The relevant spec text doesn't mention OpLoad anywhere, it's up to the implementation to figure out when to do this right now, isn't it? And yes, we need proper pointer semantics.

@dneto0
Copy link
Contributor Author

dneto0 commented Apr 9, 2021

Superceded/fixed by #1619

@dneto0 dneto0 closed this Apr 9, 2021
@kainino0x kainino0x deleted the revert-1468-runtime-array-access branch July 14, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wgsl resolved Resolved - waiting for a change to the WGSL specification wgsl WebGPU Shading Language Issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants