56
56
"INTEGER" , "INTEGER"
57
57
]
58
58
59
- # Legacy aliases for backward compatibility
60
- DB_FIELDS = LLAMA_BENCH_DB_FIELDS
61
- DB_TYPES = LLAMA_BENCH_DB_TYPES
62
-
63
59
assert len (LLAMA_BENCH_DB_FIELDS ) == len (LLAMA_BENCH_DB_TYPES )
64
60
assert len (TEST_BACKEND_OPS_DB_FIELDS ) == len (TEST_BACKEND_OPS_DB_TYPES )
65
61
75
71
"backend_name" , "op_name" , "op_params" , "test_mode"
76
72
]
77
73
78
- # Legacy alias for backward compatibility
79
- KEY_PROPERTIES = LLAMA_BENCH_KEY_PROPERTIES
80
-
81
- # Properties that are boolean and are converted to Yes/No for the table (llama-bench):
74
+ # Properties that are boolean and are converted to Yes/No for the table:
82
75
LLAMA_BENCH_BOOL_PROPERTIES = ["embeddings" , "cpu_strict" , "use_mmap" , "no_kv_offload" , "flash_attn" ]
83
-
84
- # Properties that are boolean and are converted to Yes/No for the table (test-backend-ops):
85
76
TEST_BACKEND_OPS_BOOL_PROPERTIES = ["supported" , "passed" ]
86
77
87
- # Legacy alias for backward compatibility
88
- BOOL_PROPERTIES = LLAMA_BENCH_BOOL_PROPERTIES
89
-
90
78
# Header names for the table (llama-bench):
91
79
LLAMA_BENCH_PRETTY_NAMES = {
92
80
"cpu_info" : "CPU" , "gpu_info" : "GPU" , "backends" : "Backends" , "n_gpu_layers" : "GPU layers" ,
104
92
"flops" : "FLOPS" , "bandwidth_gb_s" : "Bandwidth (GB/s)" , "memory_kb" : "Memory (KB)" , "n_runs" : "Runs"
105
93
}
106
94
107
- # Legacy alias for backward compatibility
108
- PRETTY_NAMES = LLAMA_BENCH_PRETTY_NAMES
109
-
110
95
DEFAULT_SHOW_LLAMA_BENCH = ["model_type" ] # Always show these properties by default.
111
96
DEFAULT_HIDE_LLAMA_BENCH = ["model_filename" ] # Always hide these properties by default.
112
97
113
98
DEFAULT_SHOW_TEST_BACKEND_OPS = ["backend_name" , "op_name" ] # Always show these properties by default.
114
99
DEFAULT_HIDE_TEST_BACKEND_OPS = ["error_message" ] # Always hide these properties by default.
115
100
116
- # Legacy aliases for backward compatibility
117
- DEFAULT_SHOW = DEFAULT_SHOW_LLAMA_BENCH
118
- DEFAULT_HIDE = DEFAULT_HIDE_LLAMA_BENCH
119
101
GPU_NAME_STRIP = ["NVIDIA GeForce " , "Tesla " , "AMD Radeon " ] # Strip prefixes for smaller tables.
120
102
MODEL_SUFFIX_REPLACE = {" - Small" : "_S" , " - Medium" : "_M" , " - Large" : "_L" }
121
103
122
104
DESCRIPTION = """Creates tables from llama-bench or test-backend-ops data written to multiple JSON/CSV files, a single JSONL file or SQLite database. Example usage (Linux):
123
105
124
106
For llama-bench:
125
107
$ git checkout master
126
- $ make clean && make llama-bench
108
+ $ cmake -B ${BUILD_DIR} ${CMAKE_OPTS} && cmake --build ${BUILD_DIR} -t llama-bench -j $(nproc)
127
109
$ ./llama-bench -o sql | sqlite3 llama-bench.sqlite
128
110
$ git checkout some_branch
129
- $ make clean && make llama-bench
111
+ $ cmake -B ${BUILD_DIR} ${CMAKE_OPTS} && cmake --build ${BUILD_DIR} -t llama-bench -j $(nproc)
130
112
$ ./llama-bench -o sql | sqlite3 llama-bench.sqlite
131
113
$ ./scripts/compare-llama-bench.py
132
114
133
115
For test-backend-ops:
134
116
$ git checkout master
135
- $ make clean && make test-backend-ops
117
+ $ cmake -B ${BUILD_DIR} ${CMAKE_OPTS} && cmake --build ${BUILD_DIR} -t test-backend-ops -j $(nproc)
136
118
$ ./test-backend-ops perf --output sql | sqlite3 test-backend-ops.sqlite
137
119
$ git checkout some_branch
138
- $ make clean && make test-backend-ops
120
+ $ cmake -B ${BUILD_DIR} ${CMAKE_OPTS} && cmake --build ${BUILD_DIR} -t test-backend-ops -j $(nproc)
139
121
$ ./test-backend-ops perf --output sql | sqlite3 test-backend-ops.sqlite
140
122
$ ./scripts/compare-llama-bench.py --tool test-backend-ops -i test-backend-ops.sqlite
141
123
180
162
help_s = (
181
163
"Columns to add to the table. "
182
164
"Accepts a comma-separated list of values. "
183
- f"Legal values: { ', ' .join (KEY_PROPERTIES [:- 3 ])} . "
165
+ f"Legal values: { ', ' .join (LLAMA_BENCH_KEY_PROPERTIES [:- 3 ])} . "
184
166
"Defaults to model name (model_type) and CPU and/or GPU name (cpu_info, gpu_info) "
185
167
"plus any column where not all data points are the same. "
186
168
"If the columns are manually specified, then the results for each unique combination of the "
@@ -245,8 +227,10 @@ def __init__(self, tool: str = "llama-bench"):
245
227
# Set schema-specific properties based on tool
246
228
if self .tool == "llama-bench" :
247
229
self .check_keys = set (LLAMA_BENCH_KEY_PROPERTIES + ["build_commit" , "test_time" , "avg_ts" ])
248
- else : # test-backend-ops
230
+ elif self . tool == " test-backend-ops" :
249
231
self .check_keys = set (TEST_BACKEND_OPS_KEY_PROPERTIES + ["build_commit" , "test_time" ])
232
+ else :
233
+ assert False
250
234
251
235
def _builds_init (self ):
252
236
self .build_len = self .build_len_min
@@ -721,12 +705,14 @@ def get_flops_unit_name(flops_values: list) -> str:
721
705
pretty_names = LLAMA_BENCH_PRETTY_NAMES
722
706
default_show = DEFAULT_SHOW_LLAMA_BENCH
723
707
default_hide = DEFAULT_HIDE_LLAMA_BENCH
724
- else : # test-backend-ops
708
+ elif tool == " test-backend-ops" :
725
709
key_properties = TEST_BACKEND_OPS_KEY_PROPERTIES
726
710
bool_properties = TEST_BACKEND_OPS_BOOL_PROPERTIES
727
711
pretty_names = TEST_BACKEND_OPS_PRETTY_NAMES
728
712
default_show = DEFAULT_SHOW_TEST_BACKEND_OPS
729
713
default_hide = DEFAULT_HIDE_TEST_BACKEND_OPS
714
+ else :
715
+ assert False
730
716
731
717
# If the user provided columns to group the results by, use them:
732
718
if known_args .show is not None :
@@ -756,7 +742,7 @@ def get_flops_unit_name(flops_values: list) -> str:
756
742
if row_full [i ] != rows_full [0 ][i ]:
757
743
properties_different .append (kp_i )
758
744
break
759
- else : # test-backend-ops
745
+ elif tool == " test-backend-ops" :
760
746
# For test-backend-ops, check all key properties
761
747
for i , kp_i in enumerate (key_properties ):
762
748
if kp_i in default_show :
@@ -765,6 +751,8 @@ def get_flops_unit_name(flops_values: list) -> str:
765
751
if row_full [i ] != rows_full [0 ][i ]:
766
752
properties_different .append (kp_i )
767
753
break
754
+ else :
755
+ assert False
768
756
769
757
show = []
770
758
@@ -783,8 +771,10 @@ def get_flops_unit_name(flops_values: list) -> str:
783
771
if prop in show :
784
772
index_default += 1
785
773
show = show [:index_default ] + default_show + show [index_default :]
786
- else : # test-backend-ops
774
+ elif tool == " test-backend-ops" :
787
775
show = default_show + properties_different
776
+ else :
777
+ assert False
788
778
789
779
for prop in default_hide :
790
780
try :
@@ -825,7 +815,7 @@ def get_flops_unit_name(flops_values: list) -> str:
825
815
# Regular columns test name avg t/s values Speedup
826
816
# VVVVVVVVVVVVV VVVVVVVVV VVVVVVVVVVVVVV VVVVVVV
827
817
table .append (list (row [:- 5 ]) + [test_name ] + list (row [- 2 :]) + [float (row [- 1 ]) / float (row [- 2 ])])
828
- else : # test-backend-ops
818
+ elif tool == " test-backend-ops" :
829
819
# Determine the primary metric by checking rows until we find one with valid data
830
820
if rows_show :
831
821
primary_metric = "FLOPS" # Default to FLOPS
@@ -869,9 +859,11 @@ def get_flops_unit_name(flops_values: list) -> str:
869
859
# Fallback if no valid data is available
870
860
baseline_str = "N/A"
871
861
compare_str = "N/A"
872
- speedup = 1.0
862
+ speedup = float ( 'nan' )
873
863
874
864
table .append (list (row [:- 4 ]) + [baseline_str , compare_str , speedup ])
865
+ else :
866
+ assert False
875
867
876
868
# Some a-posteriori fixes to make the table contents prettier:
877
869
for bool_property in bool_properties :
@@ -907,8 +899,10 @@ def get_flops_unit_name(flops_values: list) -> str:
907
899
headers = [pretty_names .get (p , p ) for p in show ]
908
900
if tool == "llama-bench" :
909
901
headers += ["Test" , f"t/s { name_baseline } " , f"t/s { name_compare } " , "Speedup" ]
910
- else : # test-backend-ops
902
+ elif tool == " test-backend-ops" :
911
903
headers += [f"{ primary_metric } { name_baseline } " , f"{ primary_metric } { name_compare } " , "Speedup" ]
904
+ else :
905
+ assert False
912
906
913
907
if known_args .plot :
914
908
def create_performance_plot (table_data : list [list [str ]], headers : list [str ], baseline_name : str , compare_name : str , output_file : str , plot_x_param : str , log_scale : bool = False , tool_type : str = "llama-bench" , metric_name : str = "t/s" ):
@@ -925,7 +919,7 @@ def create_performance_plot(table_data: list[list[str]], headers: list[str], bas
925
919
plot_x_label = plot_x_param
926
920
927
921
if plot_x_param not in ["n_prompt" , "n_gen" , "n_depth" ]:
928
- pretty_name = PRETTY_NAMES .get (plot_x_param , plot_x_param )
922
+ pretty_name = LLAMA_BENCH_PRETTY_NAMES .get (plot_x_param , plot_x_param )
929
923
if pretty_name in data_headers :
930
924
plot_x_index = data_headers .index (pretty_name )
931
925
plot_x_label = pretty_name
0 commit comments