1313
1414#include < executorch/backends/vulkan/runtime/graph/ops/impl/Staging.h>
1515
16+ // #define DEBUG_MODE
17+
1618using namespace executorch ::vulkan::prototyping;
1719
1820using namespace vkcompute ;
@@ -23,7 +25,8 @@ static constexpr int64_t kRefDimSizeLimit = 100;
2325TestCase create_test_case_from_config (
2426 const Conv2dConfig& config,
2527 utils::StorageType storage_type,
26- vkapi::ScalarType input_dtype) {
28+ vkapi::ScalarType input_dtype,
29+ utils::StorageType interm_storage_type) {
2730 TestCase test_case;
2831
2932 // Create a descriptive name for the test case
@@ -35,8 +38,15 @@ TestCase create_test_case_from_config(
3538 config.test_case_name + " _" + storage_str + " _" + dtype_str;
3639 test_case.set_name (test_name);
3740
41+ std::string operator_suffix = " .test" ;
42+ if (interm_storage_type == utils::kTexture3D ) {
43+ operator_suffix += " _texture" ;
44+ } else {
45+ operator_suffix += " _buffer" ;
46+ }
47+
3848 // Set the operator name for the test case
39- std::string operator_name = " etvk." + config.op_name + " .test " ;
49+ std::string operator_name = " etvk." + config.op_name + operator_suffix ;
4050 test_case.set_operator_name (operator_name);
4151
4252 // Calculate output dimensions
@@ -56,7 +66,12 @@ TestCase create_test_case_from_config(
5666 input_dtype,
5767 storage_type,
5868 io_memory_layout,
59- DataGenType::RANDOM );
69+ #ifdef DEBUG_MODE
70+ DataGenType::RANDOM
71+ #else
72+ DataGenType::RANDOM
73+ #endif
74+ );
6075
6176 if (debugging ()) {
6277 print_valuespec_data (input_tensor, " input_tensor" );
@@ -193,8 +208,10 @@ std::vector<TestCase> generate_quantized_conv2d_easy_cases() {
193208 // Generate test cases for each combination
194209 for (const auto & storage_type : storage_types) {
195210 for (const auto & input_dtype : float_types) {
196- test_cases.push_back (
197- create_test_case_from_config (config, storage_type, input_dtype));
211+ test_cases.push_back (create_test_case_from_config (
212+ config, storage_type, input_dtype, utils::kBuffer ));
213+ test_cases.push_back (create_test_case_from_config (
214+ config, storage_type, input_dtype, utils::kTexture3D ));
198215 }
199216 }
200217
@@ -373,8 +390,10 @@ std::vector<TestCase> generate_quantized_conv2d_test_cases() {
373390 if (vkcompute::api::context ()
374391 ->adapter_ptr ()
375392 ->supports_int8_dot_product ()) {
376- test_cases.push_back (
377- create_test_case_from_config (config, storage_type, vkapi::kFloat ));
393+ test_cases.push_back (create_test_case_from_config (
394+ config, storage_type, vkapi::kFloat , utils::kBuffer ));
395+ test_cases.push_back (create_test_case_from_config (
396+ config, storage_type, vkapi::kFloat , utils::kTexture3D ));
378397 }
379398 }
380399 }
@@ -610,7 +629,11 @@ int64_t quantized_conv2d_flop_calculator(const TestCase& test_case) {
610629int main (int argc, char * argv[]) {
611630 set_debugging (false );
612631 set_print_output (false );
632+ #ifdef DEBUG_MODE
633+ set_print_latencies (true );
634+ #else
613635 set_print_latencies (false );
636+ #endif
614637 set_use_gpu_timestamps (true );
615638
616639 print_performance_header ();
@@ -623,11 +646,20 @@ int main(int argc, char* argv[]) {
623646
624647 // Execute test cases using the new framework with custom FLOP calculator
625648 auto results = execute_test_cases (
649+ #ifdef DEBUG_MODE
650+ generate_quantized_conv2d_easy_cases,
651+ #else
626652 generate_quantized_conv2d_test_cases,
653+ #endif
627654 quantized_conv2d_flop_calculator,
628655 " QuantizedConv2dQ8ToQ8To" ,
656+ #ifdef DEBUG_MODE
657+ 0 ,
658+ 1 ,
659+ #else
629660 3 ,
630661 10 ,
662+ #endif
631663 ref_fn);
632664
633665 return 0 ;
0 commit comments