| 4187 | ds4_layer_weights block; |
| 4188 | } ds4_dspark_stage_weights; |
| 4189 | |
| 4190 | typedef struct { |
| 4191 | uint32_t n_stages; |
| 4192 | uint32_t block_size; |
| 4193 | uint32_t markov_rank; |
| 4194 | uint32_t noise_token_id; |
| 4195 | uint32_t target_layer_count; |
| 4196 | uint32_t target_layers[DS4_DSPARK_MAX_TARGET_LAYERS]; |
| 4197 | uint32_t present_tensors; |
| 4198 | uint32_t missing_tensors; |
| 4199 | uint32_t invalid_tensors; |
| 4200 | uint32_t metadata_errors; |
| 4201 | bool has_block_size; |
| 4202 | bool has_markov_rank; |
| 4203 | bool has_noise_token_id; |
| 4204 | bool has_target_layers; |
| 4205 | ds4_dspark_stage_weights stage[DS4_DSPARK_MAX_STAGES]; |
| 4206 | } ds4_dspark_weights; |
| 4207 | |
| 4208 | /* ========================================================================= |
| 4209 | * Fixed Weight Binding and Model Validation. |
| 4210 | * ========================================================================= |
| 4211 | * |
| 4212 | * The GGUF tensor directory is converted into a DS4-specific pointer table. |
| 4213 | * After this section, the rest of the program addresses tensors by semantic |
| 4214 | * fields such as layer->attn_q_a or layer->ffn_gate_exps rather than by string |
| 4215 | * lookup. Shape validation is intentionally strict. |
| 4216 | */ |
| 4217 | |
| 4218 | static uint32_t required_u32(const ds4_model *m, const char *key) { |
| 4219 | uint32_t v = 0; |
| 4220 | if (!model_get_u32(m, key, &v)) { |
| 4221 | fprintf(stderr, "ds4: required metadata key is missing: %s\n", key); |
| 4222 | exit(1); |
| 4223 | } |
| 4224 | return v; |
| 4225 | } |
| 4226 | |
| 4227 | static uint64_t required_u64_compat(const ds4_model *m, const char *key) { |
| 4228 | uint64_t v = 0; |
| 4229 | if (!model_get_u64_compat(m, key, &v)) { |
| 4230 | fprintf(stderr, "ds4: required metadata key is missing: %s\n", key); |
no outgoing calls
no test coverage detected