@@ -992,6 +992,28 @@ TEST_F(VulkanComputeAPITest, texture_virtual_resize) {
992
992
graph.get_tensor(name.value)->staging_buffer_numel ()); \
993
993
graph.copy_from_staging(name.staging, data_##name.data(), data_##name.size());
994
994
995
+ // The purpose of this test is simply to track the size of various classes over
996
+ // time, in the interest of making sure that they doesn't grow too large.
997
+ TEST_F (VulkanComputeAPITest, print_object_sizes) {
998
+ #define PRINT_SIZE (name ) \
999
+ std::cout << #name << " size: " << sizeof (name) << " B" << std::endl
1000
+ PRINT_SIZE (vTensor);
1001
+ PRINT_SIZE (Value);
1002
+ PRINT_SIZE (StagingBuffer);
1003
+ PRINT_SIZE (ComputeGraph);
1004
+ PRINT_SIZE (ExecuteNode);
1005
+ #undef PRINT_SIZE
1006
+
1007
+ // The actual sizes of each object is dependent on the platform. However, we
1008
+ // can alert ourselves to any significant changes in the sizes of these
1009
+ // objects by checking the `sizeof()` the class against some loose thresholds.
1010
+ EXPECT_TRUE (sizeof (vTensor) < 1800 );
1011
+ EXPECT_TRUE (sizeof (Value) < 2400 );
1012
+ EXPECT_TRUE (sizeof (StagingBuffer) < 500 );
1013
+ EXPECT_TRUE (sizeof (ComputeGraph) < 500 );
1014
+ EXPECT_TRUE (sizeof (ExecuteNode) < 500 );
1015
+ }
1016
+
995
1017
TEST (VulkanComputeGraphTest, test_values_scalars) {
996
1018
GraphConfig config;
997
1019
ComputeGraph graph (config);
0 commit comments