Nsight Systems — real CUDA kernel execution

GPU Kernel Trace

One actual deepseek-r1:8b inference call, profiled with NVIDIA Nsight Systems while ollama serve ran wrapped under the profiler. Every row below is a real CUDA kernel that executed on the RTX 2080 Ti, with real hardware timing — not the conceptual ggml op graph, the layer beneath it.

GPU
RTX 2080 Ti
Kernel launches
2270
Distinct kernels
27
GPU-busy time
175.2 ms
Quantization
Q4_K_M

Where the GPU spent its time

mul_mat_q (Q4_K)
41.0%
mul_mat_vec_q (Q4_K)
18.7%
mul_mat_q (Q6_K)
8.2%
mul_mat_vec_q (Q6_K)
5.6%
mul_mat_vec_q (Q6_K)
4.6%
mul_mat_f
3.9%
mul_mat_vec_q (Q4_K)
3.7%
mul_mat_vec_q (Q4_K)
2.9%
mul_mat_vec_f
1.9%
mul_mat_q_stream_k_fixup
1.7%
Bar length is share of total GPU-busy time across all 2270 kernel launches in this call. mul_mat_q — the quantized matrix multiply — alone accounts for the majority: matrix multiplication is where an LLM's compute actually goes.

Every kernel, matched back to its ggml op

KernelMeaningggml opLaunchesAvgTotal% time
mul_mat_q (Q4_K)quantized matrix multiplyMUL_MAT196366.6 µs71.9 ms41.0%
mul_mat_vec_q (Q4_K)quantized matrix x vector (single-token decode)MUL_MAT58565.4 µs32.8 ms18.7%
mul_mat_q (Q6_K)quantized matrix multiplyMUL_MAT17843.5 µs14.3 ms8.2%
mul_mat_vec_q (Q6_K)quantized matrix x vector (single-token decode)MUL_MAT24.9 ms9.8 ms5.6%
mul_mat_vec_q (Q6_K)quantized matrix x vector (single-token decode)MUL_MAT12677.5 µs8.1 ms4.6%
mul_mat_ffloat16 matrix multiplyMUL_MAT36191.5 µs6.9 ms3.9%
mul_mat_vec_q (Q4_K)quantized matrix x vector (single-token decode)MUL_MAT19632.8 µs6.4 ms3.7%
mul_mat_vec_q (Q4_K)quantized matrix x vector (single-token decode)MUL_MAT45111.4 µs5.0 ms2.9%
mul_mat_vec_ffloat16 matrix x vectorMUL_MAT22153.2 µs3.4 ms1.9%
mul_mat_q_stream_k_fixupmerge step for split matmulMUL_MAT19614.9 µs2.9 ms1.7%
flash_attn_ext_f16fused attention (Q·K, softmax, ·V in one kernel)FLASH_ATTN_EXT3659.3 µs2.1 ms1.2%
rms_norm_f32RMSNormNORM19110.8 µs2.1 ms1.2%
quantize_mmq_q8_1quantize activations to Q8_1 before matmul(internal)1967.1 µs1.4 ms0.8%
mul_mat_vec_q (Q6_K)quantized matrix x vector (single-token decode)MUL_MAT1776.5 µs1.3 ms0.7%
flash_attn_ext_f16fused attention (Q·K, softmax, ·V in one kernel)FLASH_ATTN_EXT5821.3 µs1.2 ms0.7%
quantize_q8_1quantize activations to Q8_1(internal)3302.8 µs913.4 µs0.5%
rms_norm_mul_rope_f32fused RMSNorm + rotary position embeddingNORM + ROPE948.8 µs829.3 µs0.5%
k_bin_bcast (add)residual / bias addADD1425.5 µs781.8 µs0.4%
rms_norm_mul_rope_f32fused RMSNorm + rotary position embeddingNORM + ROPE946.8 µs636.9 µs0.4%
unary_gated_op_kernel (SiLU)SwiGLU activationFFN709.0 µs630.7 µs0.4%
mul_mat_vec_ffloat16 matrix x vectorMUL_MAT3617.2 µs618.4 µs0.4%
k_set_rowswrite into KV cacheSET_ROWS943.8 µs359.4 µs0.2%
flash_attn_stream_k_fixupmerge step for split attentionFLASH_ATTN_EXT367.8 µs281.3 µs0.2%
mul_mat_q_stream_k_fixupmerge step for split matmulMUL_MAT1714.9 µs253.2 µs0.1%
flash_attn_stream_k_fixupmerge step for split attentionFLASH_ATTN_EXT582.0 µs116.2 µs0.1%
quantize_mmq_q8_1quantize activations to Q8_1 before matmul(internal)176.7 µs114.3 µs0.1%
k_get_rows_floatembedding lookupGET_ROWS44.1 µs16.4 µs0.0%

Memory traffic

OperationCountTotal% of memory time
[CUDA memcpy Host-to-Device]48502.05 s99.8%
[CUDA memset]44.2 ms0.2%
[CUDA memcpy Device-to-Host]3796.8 µs0.0%
Host-to-Device copies dominate memory time — that is the model's weights moving from system RAM into GPU VRAM once at load time (matches the ~10s load_duration Ollama's own API reported for this call). It is a one-time cost per model load, separate from the per-token compute above.