Skip to content

Commit cde3c14

Browse files
dj2Dawn LUCI CQ
authored andcommitted
[spirv-reader][ir] Enable atomic store test.
Enable disabled atomicStore test which passes correctly. Bug: 391487430 Change-Id: Idcb6566cfacb695de08bc69d70afb8b171076d22 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/236914 Reviewed-by: James Price <[email protected]> Commit-Queue: dan sinclair <[email protected]>
1 parent 5d3c16f commit cde3c14

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

src/tint/lang/spirv/reader/lower/atomics_test.cc

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ UNIMPLEMENTED
16291629
ASSERT_EQ(expect, str());
16301630
}
16311631

1632-
TEST_F(SpirvReader_AtomicsTest, DISABLED_AtomicStore) {
1632+
TEST_F(SpirvReader_AtomicsTest, AtomicStore) {
16331633
auto* f = b.ComputeFunction("main");
16341634

16351635
auto* sb = ty.Struct(mod.symbols.New("S"), {
@@ -1655,11 +1655,11 @@ TEST_F(SpirvReader_AtomicsTest, DISABLED_AtomicStore) {
16551655

16561656
auto* a1 = b.Access(ty.ptr<storage, u32, read_write>(), sg, 1_u);
16571657
b.Call<spirv::ir::BuiltinCall>(ty.void_(), spirv::BuiltinFn::kAtomicStore, a1, 1_u, 0_u,
1658-
1_u);
1658+
2_u);
16591659
b.Call<spirv::ir::BuiltinCall>(ty.void_(), spirv::BuiltinFn::kAtomicStore, wg_i32, 1_u, 0_u,
1660-
1_i);
1660+
3_i);
16611661
b.Call<spirv::ir::BuiltinCall>(ty.void_(), spirv::BuiltinFn::kAtomicStore, wg_u32, 1_u, 0_u,
1662-
1_u);
1662+
4_u);
16631663
b.Return(f);
16641664
});
16651665

@@ -1680,9 +1680,9 @@ S = struct @align(4) {
16801680
%5:ptr<storage, i32, read_write> = access %sb, 0u
16811681
%6:void = spirv.atomic_store %5, 1u, 0u, 1i
16821682
%7:ptr<storage, u32, read_write> = access %sb, 1u
1683-
%8:void = spirv.atomic_store %7, 1u, 0u, 1u
1684-
%9:void = spirv.atomic_store %wg_i32, 1u, 0u, 1i
1685-
%10:void = spirv.atomic_store %wg_u32, 1u, 0u, 1u
1683+
%8:void = spirv.atomic_store %7, 1u, 0u, 2u
1684+
%9:void = spirv.atomic_store %wg_i32, 1u, 0u, 3i
1685+
%10:void = spirv.atomic_store %wg_u32, 1u, 0u, 4u
16861686
ret
16871687
}
16881688
}
@@ -1692,7 +1692,33 @@ S = struct @align(4) {
16921692
Run(Atomics);
16931693

16941694
auto* expect = R"(
1695-
UNIMPLEMENTED
1695+
S = struct @align(4) {
1696+
a:i32 @offset(0)
1697+
b:u32 @offset(4)
1698+
}
1699+
1700+
S_atomic = struct @align(4) {
1701+
a:atomic<i32> @offset(0)
1702+
b:atomic<u32> @offset(4)
1703+
}
1704+
1705+
$B1: { # root
1706+
%sb:ptr<storage, S_atomic, read_write> = var undef @binding_point(0, 0)
1707+
%wg_i32:ptr<workgroup, atomic<i32>, read_write> = var undef
1708+
%wg_u32:ptr<workgroup, atomic<u32>, read_write> = var undef
1709+
}
1710+
1711+
%main = @compute @workgroup_size(1u, 1u, 1u) func():void {
1712+
$B2: {
1713+
%5:ptr<storage, atomic<i32>, read_write> = access %sb, 0u
1714+
%6:void = atomicStore %5, 1i
1715+
%7:ptr<storage, atomic<u32>, read_write> = access %sb, 1u
1716+
%8:void = atomicStore %7, 2u
1717+
%9:void = atomicStore %wg_i32, 3i
1718+
%10:void = atomicStore %wg_u32, 4u
1719+
ret
1720+
}
1721+
}
16961722
)";
16971723
ASSERT_EQ(expect, str());
16981724
}

0 commit comments

Comments
 (0)