Skip to content

debug: make common_debug_print_tensor readable#19331

Merged
ngxson merged 3 commits intoggml-org:masterfrom
ngxson:xsn/better_tensor_debug_print
Feb 4, 2026
Merged

debug: make common_debug_print_tensor readable#19331
ngxson merged 3 commits intoggml-org:masterfrom
ngxson:xsn/better_tensor_debug_print

Conversation

@ngxson
Copy link
Contributor

@ngxson ngxson commented Feb 4, 2026

Now using 4-space indentation

The log is output to stdout, so that I can do llama-eval-callback ... > debug.log

common_debug_cb_eval:       model.embed_tokens = (f32)   GET_ROWS(token_embd.weight{1024, 151936, 1, 1}, inp_tokens{9, 1, 1, 1}}) = {1024, 9, 1, 1}
    [
        [
            [      0.0434,       0.2299,      -0.2418,    ...,      -0.3296,      -0.0322,      -0.0372  ],
            [     -0.3237,      -0.0854,       0.1682,    ...,      -0.7642,       0.0383,      -0.1573  ],
            [      0.0539,      -0.3584,       0.4673,    ...,      -0.1351,       0.0991,       0.2449  ],
            ..., 
            [      0.1506,      -0.2698,      -0.2025,    ...,       0.0360,      -0.3262,      -0.3264  ],
            [     -0.0278,       0.1212,      -0.4956,    ...,      -0.9229,       0.1324,      -1.0742  ],
            [      0.0959,      -0.2170,      -0.3105,    ...,      -0.3237,       0.0635,       0.3186  ],
        ],
    ]
    sum = -1875.671875
common_debug_cb_eval:                   (view) = (f32)       FILL(leaf_3{64, 64, 1, 1}, }) = {64, 64, 1, 1}
    [
        [
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
            ..., 
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
        ],
    ]
    sum = 4096.000000
common_debug_cb_eval:                   node_2 = (f32)        TRI( (view){64, 64, 1, 1}, }) = {64, 64, 1, 1}
    [
        [
            [      0.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      1.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      1.0000,       1.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            ..., 
            [      1.0000,       1.0000,       1.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       0.0000,       0.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       0.0000  ],
        ],
    ]
    sum = 2016.000000
common_debug_cb_eval:                   (view) = (f32)       FILL(leaf_4{64, 1, 1, 1}, }) = {64, 1, 1, 1}
    [
        [
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
        ],
    ]
    sum = 64.000000
common_debug_cb_eval:                   node_4 = (f32)       DIAG(CPU# (view)#0{64, 1, 1, 1}, }) = {64, 64, 1, 1}
    [
        [
            [      1.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      0.0000,       1.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      0.0000,       0.0000,       1.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            ..., 
            [      0.0000,       0.0000,       0.0000,    ...,       1.0000,       0.0000,       0.0000  ],
            [      0.0000,       0.0000,       0.0000,    ...,       0.0000,       1.0000,       0.0000  ],
            [      0.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       1.0000  ],
        ],
    ]
    sum = 64.000000
common_debug_cb_eval:                   node_5 = (f32)        ADD(node_2{64, 64, 1, 1}, MTL0#node_4#0{64, 64, 1, 1}}) = {64, 64, 1, 1}
    [
        [
            [      1.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      1.0000,       1.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       0.0000,       0.0000,       0.0000  ],
            ..., 
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       0.0000,       0.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       0.0000  ],
            [      1.0000,       1.0000,       1.0000,    ...,       1.0000,       1.0000,       1.0000  ],
        ],
    ]
    sum = 2080.000000
common_debug_cb_eval: conv_states_updated-0 (reshaped) = (f32)    RESHAPE(conv_states_updated-0{12288, 1, 1, 1}, }) = {12288, 1, 1, 1}
    [
        [
            [      0.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
        ],
    ]
    sum = 0.000000
common_debug_cb_eval: conv_states_updated-0 (reshaped) (view) = (f32)       VIEW(conv_states_updated-0 (reshaped){12288, 1, 1, 1}, }) = {12288, 1, 1, 1}
    [
        [
            [      0.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
        ],
    ]
    sum = 0.000000
common_debug_cb_eval:                   (view) = (i32)       VIEW(leaf_6{1, 1, 1, 1}, }) = {1, 1, 1, 1}
    [
        [
            [      0.0000  ],
        ],
    ]
    sum = 0.000000
common_debug_cb_eval:                   (view) = (i32)       VIEW(leaf_6{1, 1, 1, 1}, }) = {0, 1, 1, 1}
    [
        [
            [  ],
        ],
    ]
    sum = 0.000000
common_debug_cb_eval: conv_states_updated-0 (reshaped) (view) (view) = (f32)      SCALE(conv_states_updated-0 (reshaped) (view){12288, 1, 1, 1}, }) = {12288, 1, 1, 1}
    [
        [
            [      0.0000,       0.0000,       0.0000,    ...,       0.0000,       0.0000,       0.0000  ],
        ],
    ]
    sum = 0.000000

@ngxson ngxson requested a review from pwilkin February 4, 2026 14:01
@ngxson ngxson requested a review from CISC as a code owner February 4, 2026 15:49
@github-actions github-actions bot added the model Model specific label Feb 4, 2026
@ngxson ngxson merged commit e0c93af into ggml-org:master Feb 4, 2026
69 of 75 checks passed
liparetejas pushed a commit to liparetejas/llama.cpp that referenced this pull request Feb 23, 2026
* debug: make common_debug_print_tensor readable

* editorconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model Model specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants