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

Function metal_graph_debug_dump_tensor

ds4.c:10837–10864  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10835
10836typedef struct {
10837 float *mid;
10838 const uint8_t *gate_base[DS4_MAX_EXPERT];
10839 const uint8_t *up_base[DS4_MAX_EXPERT];
10840 const block_q8_K *xq;
10841 const ds4_expert_pair *pairs;
10842 const uint32_t *pair_ids;
10843 const uint32_t *expert_offset;
10844 const uint32_t *active_expert;
10845 const float *pair_weight;
10846 float clamp;
10847 uint64_t in_dim;
10848 uint64_t out_dim;
10849 uint64_t xq_blocks;
10850 uint64_t gate_row_bytes[DS4_MAX_EXPERT];
10851 uint64_t up_row_bytes[DS4_MAX_EXPERT];
10852} matvec_q8_k_batch_mid_ctx;
10853
10854static void matvec_iq2_xxs_batch_mid_worker(void *vctx, uint64_t task0, uint64_t task1) {
10855 matvec_iq2_xxs_batch_mid_ctx *ctx = vctx;
10856
10857 for (uint64_t task = task0; task < task1; task++) {
10858 const uint32_t active_idx = (uint32_t)(task / ctx->out_dim);
10859 const uint64_t row = task - (uint64_t)active_idx * ctx->out_dim;
10860 const uint32_t expert = ctx->active_expert[active_idx];
10861 const uint32_t begin = ctx->expert_offset[expert];
10862 const uint32_t end = ctx->expert_offset[expert + 1];
10863
10864 const block_iq2_xxs *gate_row = (const block_iq2_xxs *)(ctx->gate_base[expert] + row * ctx->gate_row_bytes[expert]);
10865 const block_iq2_xxs *up_row = (const block_iq2_xxs *)(ctx->up_base[expert] + row * ctx->up_row_bytes[expert]);
10866
10867 for (uint32_t i = begin; i < end; i++) {

Calls 3

metal_graph_debug_wantsFunction · 0.85
write_f32_binary_fileFunction · 0.85
xmallocFunction · 0.70

Tested by

no test coverage detected