@@ -827,6 +827,7 @@ TEST(VulkanComputeGraphTest, test_simple_shared_objects_with_resize) {
827
827
}
828
828
829
829
TEST (VulkanComputeGraphTest, test_large_graph) {
830
+ auto build_start_time = std::chrono::system_clock::now ();
830
831
GraphConfig config;
831
832
ComputeGraph graph (config);
832
833
@@ -837,6 +838,9 @@ TEST(VulkanComputeGraphTest, test_large_graph) {
837
838
std::vector<int64_t > size_big = {input_c, input_h, input_w};
838
839
std::vector<int64_t > size_small = {input_c, input_h, 1 };
839
840
841
+ std::vector<int64_t > size_big_alt = {input_c / 2 , input_h / 2 , input_w / 2 };
842
+ std::vector<int64_t > size_small_alt = {input_c / 2 , input_h / 2 , 1 };
843
+
840
844
// Build graph
841
845
842
846
IOValueRef a = graph.add_input_tensor (size_big, api::kFloat , 2 );
@@ -862,23 +866,58 @@ TEST(VulkanComputeGraphTest, test_large_graph) {
862
866
graph.prepare ();
863
867
graph.encode_execute ();
864
868
869
+ auto build_end_time = std::chrono::system_clock::now ();
870
+
871
+ auto build_time = std::chrono::duration_cast<std::chrono::microseconds>(
872
+ build_end_time - build_start_time);
873
+
874
+ std::stringstream ss;
865
875
for (int i = 0 ; i < 10 ; i++) {
876
+ auto resize_start_time = std::chrono::system_clock::now ();
877
+ if (i % 2 == 0 ) {
878
+ graph.resize_input (0 , size_big_alt);
879
+ graph.resize_input (1 , size_small_alt);
880
+ } else {
881
+ graph.resize_input (0 , size_big);
882
+ graph.resize_input (1 , size_small);
883
+ }
884
+ graph.propagate_resize ();
885
+ auto resize_end_time = std::chrono::system_clock::now ();
886
+
887
+ auto resize_time = std::chrono::duration_cast<std::chrono::microseconds>(
888
+ resize_end_time - resize_start_time);
889
+
866
890
float val_a = 1 .0f ;
867
891
float val_b = 2 .0f ;
868
892
869
893
float val_e = val_a + val_b * (2 * n + 1 );
870
894
895
+ auto inference_start_time = std::chrono::system_clock::now ();
896
+
871
897
fill_vtensor (graph, a, val_a);
872
898
fill_vtensor (graph, b, val_b);
873
899
874
900
graph.execute ();
875
901
876
902
EXTRACT_TENSOR (out);
877
903
904
+ auto inference_end_time = std::chrono::system_clock::now ();
905
+
906
+ auto inference_time = std::chrono::duration_cast<std::chrono::microseconds>(
907
+ inference_end_time - inference_start_time);
908
+
878
909
for (int i = 0 ; i < graph.get_tensor (out.value )->numel (); i++) {
879
910
CHECK_VALUE (data_out, i, val_e);
880
911
}
912
+
913
+ ss << " [ ] Resize: " << std::setw (10 ) << std::right
914
+ << resize_time.count () << " us" << std::endl;
915
+ ss << " [ ] Inference: " << std::setw (10 ) << std::right
916
+ << inference_time.count () << " us" << std::endl;
881
917
}
918
+ ss << " [ ] Model Load:" << std::setw (10 ) << std::right
919
+ << build_time.count () << " us" << std::endl;
920
+ std::cout << ss.str ();
882
921
}
883
922
884
923
TEST (VulkanComputeGraphTest, test_etvk_copy_offset_node) {
0 commit comments