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

spv-in parse AtomicLoad and AtomicStore #5821

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0360c95
added spv::Frontend::upgrade_atomics, replaces pointer type with atom…
schell Jun 5, 2024
ca9fa56
Recursively replace atomic pointer's type and expression
schell Jun 5, 2024
c2a7034
remove all matches that aren't the bare minimum for the test case
schell Jun 13, 2024
e810648
remove copy
schell Jun 13, 2024
f80a417
changelog, snapshot ron files
schell Jun 13, 2024
46aff51
remove unused iter_handles
schell Jun 13, 2024
d790a8f
Document `AtomicOp` and `front::spv::Frontend::lookup_atomic`.
jimblandy Jun 14, 2024
6340f6d
include atomic_i_increment.spvasm
schell Jun 14, 2024
81c1ba5
Merge remote-tracking branch 'schell/feature/spirv-front-atomics-2' i…
schell Jun 14, 2024
896f01d
don't upgrade local variables, padding fixes
schell Jun 14, 2024
ef98fe9
modify global variable in place instead of appending
schell Jun 14, 2024
52a375d
remove PartialEq from LocalVariable, remove AtomicOpInst
schell Jun 14, 2024
86aa3a4
no need to call .into_iter() on iter
schell Jun 14, 2024
49339d1
maintain separate list of atomic ops for all functions and entry points
schell Jun 15, 2024
5d0d05c
use ty, inner and r#type for bindings
schell Jun 15, 2024
059da60
index into arenas directly
schell Jun 15, 2024
1ca4cf1
fix atomic reference in docs
schell Jun 15, 2024
ed7f73a
only track and upgrade global variables used in atomic ops
schell Jun 15, 2024
4582dcd
WIP
schell Jun 15, 2024
780ad70
find global variables in atomic pointers
schell Jun 15, 2024
346d11c
validate module in atomic upgrade test, ron files
schell Jun 15, 2024
98532b0
get_contained_global_variable match deref and signature
schell Jun 16, 2024
c6a9301
added atomic_load_and_store.spv* files
schell Jun 15, 2024
be23146
move atomic_i_increment test to atomic_upgrade.rs
schell Jun 15, 2024
75d8753
add failing test for atomic load and store
schell Jun 15, 2024
8b77722
add parsing for spirv::Op::AtomicLoad and spirv::Op::AtomicStore
schell Jun 15, 2024
b9a6591
renamed get_contained_global_variable
schell Jun 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changelog, snapshot ron files
  • Loading branch information
schell committed Jun 13, 2024
commit f80a4176199dd19cde5d5ae04333f0e139ed6b0c
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ By @atlv24 in [#5383](https://github.com/gfx-rs/wgpu/pull/5383)

#### Naga

- Added type upgrades to SPIR-V atomic support. Added related infrastructure. Tracking issue is [here](https://github.com/gfx-rs/wgpu/issues/4489). By @schell in [#5775](https://github.com/gfx-rs/wgpu/pull/5775).
- Implement `WGSL`'s `unpack4xI8`,`unpack4xU8`,`pack4xI8` and `pack4xU8`. By @VlaDexa in [#5424](https://github.com/gfx-rs/wgpu/pull/5424)
- Began work adding support for atomics to the SPIR-V frontend. Tracking issue is [here](https://github.com/gfx-rs/wgpu/issues/4489). By @schell in [#5702](https://github.com/gfx-rs/wgpu/pull/5702).

Expand Down
2 changes: 1 addition & 1 deletion naga/src/front/atomic_upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<'a> UpgradeState<'a> {
let new_var = GlobalVariable {
name: var.name.clone(),
space: var.space,
binding: var.binding,
binding: var.binding.clone(),
ty: self.upgrade_type(var.ty)?,
init: self.upgrade_opt_expression(None, var.init)?,
};
Expand Down
214 changes: 203 additions & 11 deletions naga/tests/out/ir/atomic_i_increment.compact.ron
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
width: 4,
)),
),
(
name: None,
inner: Scalar((
kind: Bool,
width: 1,
)),
),
(
name: None,
inner: Struct(
Expand All @@ -21,13 +28,60 @@
span: 4,
),
),
(
name: None,
inner: Atomic((
kind: Uint,
width: 4,
)),
),
(
name: None,
inner: Struct(
members: [
(
name: None,
ty: 4,
binding: None,
offset: 0,
),
],
span: 4,
),
),
],
special_types: (
ray_desc: None,
ray_intersection: None,
predeclared_types: {},
),
constants: [],
constants: [
(
name: None,
ty: 1,
init: 1,
),
(
name: None,
ty: 2,
init: 2,
),
(
name: None,
ty: 1,
init: 3,
),
(
name: None,
ty: 2,
init: 4,
),
(
name: None,
ty: 1,
init: 5,
),
],
overrides: [],
global_variables: [
(
Expand All @@ -39,40 +93,178 @@
group: 0,
binding: 0,
)),
ty: 2,
ty: 3,
init: None,
),
(
name: None,
space: Storage(
access: ("LOAD"),
),
binding: Some((
group: 0,
binding: 1,
)),
ty: 3,
init: None,
),
(
name: None,
space: Storage(
access: ("LOAD | STORE"),
),
binding: Some((
group: 0,
binding: 0,
)),
ty: 5,
init: None,
),
],
global_expressions: [],
global_expressions: [
Literal(U32(0)),
Literal(Bool(false)),
Literal(U32(1)),
Literal(Bool(true)),
ZeroValue(1),
],
functions: [
(
name: None,
arguments: [],
result: None,
local_variables: [],
local_variables: [
(
name: Some("phi_23"),
ty: 1,
init: None,
),
(
name: Some("phi_24"),
ty: 1,
init: None,
),
],
expressions: [
GlobalVariable(1),
GlobalVariable(2),
Constant(4),
Constant(2),
Constant(5),
Constant(3),
Constant(1),
AccessIndex(
base: 1,
index: 0,
),
AccessIndex(
base: 2,
index: 0,
),
LocalVariable(1),
Load(
pointer: 10,
),
Load(
pointer: 9,
),
Binary(
op: GreaterEqual,
left: 11,
right: 12,
),
AtomicResult(
ty: 1,
comparison: false,
),
Literal(U32(1)),
Binary(
op: Add,
left: 11,
right: 6,
),
LocalVariable(2),
Load(
pointer: 17,
),
Select(
condition: 13,
accept: 4,
reject: 3,
),
Unary(
op: LogicalNot,
expr: 19,
),
LocalVariable(1),
LocalVariable(2),
],
named_expressions: {},
body: [
Emit((
start: 1,
end: 3,
start: 7,
end: 9,
)),
Atomic(
pointer: 2,
fun: Add,
value: 4,
result: Some(3),
Store(
pointer: 21,
value: 7,
),
Loop(
body: [
Emit((
start: 10,
end: 11,
)),
Emit((
start: 11,
end: 13,
)),
If(
condition: 13,
accept: [
Store(
pointer: 22,
value: 5,
),
],
reject: [
Emit((
start: 13,
end: 14,
)),
Atomic(
pointer: 8,
fun: Add,
value: 15,
result: Some(14),
),
Emit((
start: 15,
end: 16,
)),
Store(
pointer: 22,
value: 16,
),
],
),
Emit((
start: 17,
end: 19,
)),
Continue,
],
continuing: [
Emit((
start: 19,
end: 20,
)),
Store(
pointer: 21,
value: 18,
),
],
break_if: Some(20),
),
Return(
value: None,
Expand Down
Loading
Loading