From a86c8635268e989bfc9515beb565e4b725064b65 Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Wed, 11 Dec 2024 15:03:14 -0800 Subject: [PATCH] Update storage size tests This CL updates the remaining storage size test to add a second variable to show the 2x16 size. Change-Id: Id55bf70f0e07dbd09f8bc1d9019c68f0d95e2e94 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/219096 Commit-Queue: dan sinclair Reviewed-by: James Price Auto-Submit: dan sinclair Commit-Queue: James Price --- src/tint/lang/glsl/writer/function_test.cc | 4 +++- src/tint/lang/hlsl/writer/function_test.cc | 4 +++- src/tint/lang/spirv/writer/function_test.cc | 4 +++- src/tint/lang/wgsl/inspector/inspector_test.cc | 6 ++++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/tint/lang/glsl/writer/function_test.cc b/src/tint/lang/glsl/writer/function_test.cc index 208b282e01a..71fc16587ac 100644 --- a/src/tint/lang/glsl/writer/function_test.cc +++ b/src/tint/lang/glsl/writer/function_test.cc @@ -108,15 +108,17 @@ TEST_F(GlslWriterTest, WorkgroupStorageSizeEmpty) { TEST_F(GlslWriterTest, WorkgroupStorageSizeSimple) { auto* var = mod.root_block->Append(b.Var("var", ty.ptr(workgroup, ty.f32()))); + auto* var2 = mod.root_block->Append(b.Var("var2", ty.ptr(workgroup, ty.i32()))); auto* func = b.ComputeFunction("main", 32_u, 4_u, 1_u); b.Append(func->Block(), [&] { // b.Let("x", var); + b.Let("y", var2); b.Return(func); }); ASSERT_TRUE(Generate()) << err_ << output_.glsl; - EXPECT_EQ(16u, output_.workgroup_info.storage_size); + EXPECT_EQ(32u, output_.workgroup_info.storage_size); } TEST_F(GlslWriterTest, WorkgroupStorageSizeCompoundTypes) { diff --git a/src/tint/lang/hlsl/writer/function_test.cc b/src/tint/lang/hlsl/writer/function_test.cc index 4aa76047fd9..ad8ead09018 100644 --- a/src/tint/lang/hlsl/writer/function_test.cc +++ b/src/tint/lang/hlsl/writer/function_test.cc @@ -1101,15 +1101,17 @@ TEST_F(HlslWriterTest, WorkgroupStorageSizeEmpty) { TEST_F(HlslWriterTest, WorkgroupStorageSizeSimple) { auto* var = mod.root_block->Append(b.Var("var", ty.ptr(workgroup, ty.f32()))); + auto* var2 = mod.root_block->Append(b.Var("var2", ty.ptr(workgroup, ty.i32()))); auto* func = b.ComputeFunction("main", 32_u, 4_u, 1_u); b.Append(func->Block(), [&] { // b.Let("x", var); + b.Let("y", var2); b.Return(func); }); ASSERT_TRUE(Generate()) << err_ << output_.hlsl; - EXPECT_EQ(16u, output_.workgroup_info.storage_size); + EXPECT_EQ(32u, output_.workgroup_info.storage_size); } TEST_F(HlslWriterTest, WorkgroupStorageSizeCompoundTypes) { diff --git a/src/tint/lang/spirv/writer/function_test.cc b/src/tint/lang/spirv/writer/function_test.cc index da9e2668996..6a700a68e7a 100644 --- a/src/tint/lang/spirv/writer/function_test.cc +++ b/src/tint/lang/spirv/writer/function_test.cc @@ -634,15 +634,17 @@ TEST_F(SpirvWriterTest, WorkgroupStorageSizeEmpty) { TEST_F(SpirvWriterTest, WorkgroupStorageSizeSimple) { auto* var = mod.root_block->Append(b.Var("var", ty.ptr(workgroup, ty.f32()))); + auto* var2 = mod.root_block->Append(b.Var("var2", ty.ptr(workgroup, ty.i32()))); auto* func = b.ComputeFunction("main", 32_u, 4_u, 1_u); b.Append(func->Block(), [&] { // b.Let("x", var); + b.Let("y", var2); b.Return(func); }); ASSERT_TRUE(Generate()) << Error() << output_; - EXPECT_EQ(16u, workgroup_info.storage_size); + EXPECT_EQ(32u, workgroup_info.storage_size); } TEST_F(SpirvWriterTest, WorkgroupStorageSizeCompoundTypes) { diff --git a/src/tint/lang/wgsl/inspector/inspector_test.cc b/src/tint/lang/wgsl/inspector/inspector_test.cc index e6d7976b31c..6a93800cc26 100644 --- a/src/tint/lang/wgsl/inspector/inspector_test.cc +++ b/src/tint/lang/wgsl/inspector/inspector_test.cc @@ -373,9 +373,11 @@ TEST_F(InspectorGetEntryPointTest, WorkgroupStorageSizeEmpty) { TEST_F(InspectorGetEntryPointTest, WorkgroupStorageSizeSimple) { AddWorkgroupStorage("wg_f32", ty.f32()); + AddWorkgroupStorage("wg_i32", ty.i32()); MakePlainGlobalReferenceBodyFunction("f32_func", "wg_f32", ty.f32(), tint::Empty); + MakePlainGlobalReferenceBodyFunction("i32_func", "wg_i32", ty.i32(), tint::Empty); - MakeCallerBodyFunction("ep_func", Vector{std::string("f32_func")}, + MakeCallerBodyFunction("ep_func", Vector{std::string("f32_func"), "i32_func"}, Vector{ Stage(ast::PipelineStage::kCompute), WorkgroupSize(1_i), @@ -386,7 +388,7 @@ TEST_F(InspectorGetEntryPointTest, WorkgroupStorageSizeSimple) { ASSERT_FALSE(inspector.has_error()) << inspector.error(); ASSERT_EQ(1u, result.size()); - EXPECT_EQ(16u, result[0].workgroup_storage_size); + EXPECT_EQ(32u, result[0].workgroup_storage_size); } TEST_F(InspectorGetEntryPointTest, WorkgroupStorageSizeCompoundTypes) {