MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / main

Function main

subprojects/llama.cpp/tests/test-quantize-perf.cpp:140–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140int main(int argc, char * argv[]) {
141 quantize_perf_params params {};
142
143 // read command line
144
145 bool invalid_param = false;
146 std::string arg;
147 for (int i = 1; i < argc; i++) {
148 arg = argv[i];
149
150 if (arg == "--size") {
151 if (++i >= argc) {
152 invalid_param = true;
153 break;
154 }
155 size_t size = std::stoi(argv[i]);
156 if (size % 32 != 0) {
157 fprintf(stderr, "error: size %zu not divisible by 32\n", size);
158 invalid_param = true;
159 break;
160 }
161 params.test_sizes.push_back(size);
162 } else if (arg == "-3") {
163 // quick select sizes that probably fit in CPU caches
164 params.test_sizes.push_back(L1_SIZE);
165 params.test_sizes.push_back(L2_SIZE);
166 params.test_sizes.push_back(L3_SIZE);
167 } else if (arg == "-4") {
168 // quick select cache sizes + memory
169 params.test_sizes.push_back(L1_SIZE);
170 params.test_sizes.push_back(L2_SIZE);
171 params.test_sizes.push_back(L3_SIZE);
172 params.test_sizes.push_back(MEM_SIZE);
173 } else if (arg == "--op") {
174 if (++i >= argc) {
175 invalid_param = true;
176 break;
177 }
178 std::string op {argv[i]};
179 if (op == "quantize_row_q_reference") {
180 params.op_quantize_row_q_reference = true;
181 } else if (op == "quantize_row_q") {
182 params.op_quantize_row_q = true;
183 } else if (op == "dequantize_row_q") {
184 params.op_dequantize_row_q = true;
185 } else if (op == "quantize_row_q_dot") {
186 params.op_quantize_row_q_dot = true;
187 } else if (op == "vec_dot_q") {
188 params.op_vec_dot_q = true;
189 } else {
190 invalid_param = true;
191 break;
192 }
193 } else if (arg == "--type") {
194 if (++i >= argc) {
195 invalid_param = true;
196 break;
197 }

Callers

nothing calls this directly

Calls 15

align_with_offsetFunction · 0.85
ggml_cpu_initFunction · 0.85
ggml_get_type_traitsFunction · 0.85
ggml_get_type_traits_cpuFunction · 0.85
ggml_type_nameFunction · 0.85
ggml_quantize_initFunction · 0.85
ggml_row_sizeFunction · 0.85
benchmark_functionFunction · 0.85
usageFunction · 0.70
generate_dataFunction · 0.70
emptyMethod · 0.65
push_backMethod · 0.45

Tested by

no test coverage detected