Skip to content

Commit

Permalink
Update storage size tests
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: James Price <[email protected]>
Auto-Submit: dan sinclair <[email protected]>
Commit-Queue: James Price <[email protected]>
  • Loading branch information
dj2 authored and Dawn LUCI CQ committed Dec 11, 2024
1 parent e90af28 commit a86c863
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/tint/lang/glsl/writer/function_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/tint/lang/hlsl/writer/function_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/tint/lang/spirv/writer/function_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 4 additions & 2 deletions src/tint/lang/wgsl/inspector/inspector_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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) {
Expand Down

0 comments on commit a86c863

Please sign in to comment.