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

Function ggml_compute_forward_get_rows_q

ggml.c:10318–10345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10316// ggml_compute_forward_get_rows
10317
10318static void ggml_compute_forward_get_rows_q(
10319 const struct ggml_compute_params * params,
10320 const struct ggml_tensor * src0,
10321 const struct ggml_tensor * src1,
10322 struct ggml_tensor * dst) {
10323 assert(params->ith == 0);
10324
10325 if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
10326 return;
10327 }
10328
10329 const int nc = src0->ne[0];
10330 const int nr = ggml_nelements(src1);
10331 const enum ggml_type type = src0->type;
10332 ggml_to_float_t const dequantize_row_q = type_traits[type].to_float;
10333
10334 assert( dst->ne[0] == nc);
10335 assert( dst->ne[1] == nr);
10336 assert(src0->nb[0] == ggml_type_size(type));
10337
10338 for (int i = 0; i < nr; ++i) {
10339 const int r = ((int32_t *) src1->data)[i];
10340
10341 dequantize_row_q(
10342 (const void *) ((char *) src0->data + r*src0->nb[1]),
10343 (float *) ((char *) dst->data + i*dst->nb[1]), nc);
10344 }
10345}
10346
10347static void ggml_compute_forward_get_rows_f16(
10348 const struct ggml_compute_params * params,

Callers 1

Calls 2

ggml_nelementsFunction · 0.70
ggml_type_sizeFunction · 0.70

Tested by

no test coverage detected