MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / main

Function main

tests/test-quantize-perf.cpp:139–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

fprintfFunction · 0.85
printfFunction · 0.85
usageFunction · 0.70
align_with_offsetFunction · 0.70
generate_dataFunction · 0.70
benchmark_functionFunction · 0.70
ggml_initFunction · 0.50
ggml_type_nameFunction · 0.50
findFunction · 0.50
ggml_blck_sizeFunction · 0.50
ggml_type_sizeFunction · 0.50

Tested by

no test coverage detected