MCPcopy Create free account
hub / github.com/antirez/ds4 / layer_shared_ffn_batch

Function layer_shared_ffn_batch

ds4.c:7262–7304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7260 if (ds4_streq(arch, "glm-dsa")) {
7261 config_validate_glm_dsa_model(m);
7262 return;
7263 }
7264 if (ds4_streq(arch, "glm5-next")) {
7265 config_validate_glm53_model(m);
7266 return;
7267 }
7268 if (ds4_streq(arch, "qwen4exp")) {
7269 config_validate_qwen4_model(m);
7270 return;
7271 }
7272 }
7273 config_validate_deepseek4_model(m);
7274}
7275
7276#ifndef DS4_NO_GPU
7277static ds4_tensor *vision_required_tensor(
7278 const ds4_model *m,
7279 const char *name,
7280 uint32_t ndim,
7281 const uint64_t *dims) {
7282 ds4_tensor *t = required_tensor(m, name);
7283 if (t->type != DS4_TENSOR_BF16 || t->ndim != ndim) {
7284 fprintf(stderr,
7285 "ds4: vision tensor %s has type %s/rank %u, expected BF16/rank %u\n",
7286 name, tensor_type_name(t->type), t->ndim, ndim);
7287 exit(1);
7288 }
7289 for (uint32_t d = 0; d < ndim; d++) {
7290 if (t->dim[d] == dims[d]) continue;
7291 fprintf(stderr,
7292 "ds4: vision tensor %s has dim[%u]=%" PRIu64
7293 ", expected %" PRIu64 "\n",
7294 name, d, t->dim[d], dims[d]);
7295 exit(1);
7296 }
7297 return t;
7298}
7299
7300static uint64_t vision_required_offset(
7301 const ds4_model *m,
7302 const char *name,
7303 uint32_t ndim,
7304 const uint64_t *dims) {
7305 return vision_required_tensor(m, name, ndim, dims)->abs_offset;
7306}
7307

Callers 2

layer_ffn_batchFunction · 0.85
layer_ffn_shared_batchFunction · 0.85

Calls 5

ds4_dieFunction · 0.85
matmul_q8_0_pair_batchFunction · 0.85
ds4_parallel_forFunction · 0.85
matmul_q8_0_batchFunction · 0.85
xmallocFunction · 0.70

Tested by

no test coverage detected