[KongchangAI]
ConceptGeneral Matrix Multiplication / 通用矩阵乘法

GEMM

General Matrix Multiplication, the fundamental and computationally intensive operation in deep learning. It is the core computation underlying fully connected layers, attention mechanism Q/K/V projections, and Transformer feed-forward networks, with its execution efficiency directly determining overall model training and inference throughput.

Core Facts

Timeline (last 90 days)

Nov 20

Common sources of computation graph differences include: operator fusion (such as merging LayerNorm with GEMM), reduction order changing due to different degrees of parallelism, inconsistent random number generator seeds and consumption order, and special optimizations of attention by inference frameworks (such as paged KV Cache changing the accumulation order).

Unverified50%
Nov 13

On GPUs, FP64 theoretical throughput is typically only 1/2 to 1/32 that of FP32 (depending on architecture) and requires more registers and bandwidth, so optimizing FP64 GEMM is more challenging than lower precision.

Unverified50%
Nov 13

GEMM (general matrix multiplication) is a core level-3 operation in BLAS libraries, computing C = α·A·B + β·C, where A, B and C are dense matrices.

Unverified50%
Nov 13

The degree to which library-level optimization improves end-to-end metrics depends on the share of FP64 GEMM in the workload; if the share is low, the improvement is limited.

Unverified50%
Nov 13

Modern GPUs implement GEMM using tiling, splitting large matrices into small blocks that fit in on-chip shared memory and reducing global memory accesses through data reuse.

Unverified50%
Oct 30

For large-size input scenarios, boundary test cases for kernels involving 32-bit indexing should be established, rather than relying only on small- and medium-scale benchmarks.

Unverified50%
Oct 30

As context windows and batch sizes continue to grow, scenarios where M*N crosses 2^31 will become more and more common, and the frequency of such boundary bugs may increase.

Unverified50%
Oct 30

The default NCCL reduce-scatter can slow down a GEMM that originally completes in a single wave by 69%.

Unverified50%
Oct 21

For dense GEMM and grouped GEMM, PyTorch's scheduling layer selects the appropriate backend based on tensor shapes and hardware type.

Unverified50%
Oct 21

FlyDSL covers core operations such as dense and grouped GEMM, fused multi-head attention (FMHA/Attention), MXFP8/MXFP4 scaled GEMM, RMSNorm and TopK.

Unverified50%

15 more timeline events

All Facts (20)

Verified

General Matrix Multiplication (GEMM) is the most fundamental and computationally intensive operation in deep learning inference, and NVIDIA Tensor Cores and Google TPU systolic arrays are both specialized optimizations targeting GEMM.

75%
Unverified

通过CUDA Tile,开发者可以更自然地表达矩阵分块乘法(Tiled GEMM),而不必深入处理wmma或mma.sync等底层PTX指令

85%
Unverified

Common sources of computation graph differences include: operator fusion (such as merging LayerNorm with GEMM), reduction order changing due to different degrees of parallelism, inconsistent random number generator seeds and consumption order, and special optimizations of attention by inference frameworks (such as paged KV Cache changing the accumulation order).

50%
Unverified

Modern GPUs implement GEMM using tiling, splitting large matrices into small blocks that fit in on-chip shared memory and reducing global memory accesses through data reuse.

50%
Unverified

The degree to which library-level optimization improves end-to-end metrics depends on the share of FP64 GEMM in the workload; if the share is low, the improvement is limited.

50%
Unverified

On GPUs, FP64 theoretical throughput is typically only 1/2 to 1/32 that of FP32 (depending on architecture) and requires more registers and bandwidth, so optimizing FP64 GEMM is more challenging than lower precision.

50%
Unverified

GEMM (general matrix multiplication) is a core level-3 operation in BLAS libraries, computing C = α·A·B + β·C, where A, B and C are dense matrices.

50%
Unverified

For large-size input scenarios, boundary test cases for kernels involving 32-bit indexing should be established, rather than relying only on small- and medium-scale benchmarks.

50%
Unverified

The default NCCL reduce-scatter can slow down a GEMM that originally completes in a single wave by 69%.

50%
Unverified

For dense GEMM and grouped GEMM, PyTorch's scheduling layer selects the appropriate backend based on tensor shapes and hardware type.

50%
Unverified

FlyDSL covers core operations such as dense and grouped GEMM, fused multi-head attention (FMHA/Attention), MXFP8/MXFP4 scaled GEMM, RMSNorm and TopK.

50%
Unverified

Matrix multiplication satisfies (A×B)ᵀ = Bᵀ×Aᵀ; swapping the two operands and transposing the result does not change the computational semantics, only the way data is arranged in memory and registers.

50%
Unverified

Benchmarks show that when the number of concurrent requests reaches 5, the throughput ratio of row-by-row GEMV over GEMM drops below 100% (90.7%), and GEMM regains the advantage.

50%
Unverified

The two prefill kernels, GEMM and row-by-row GEMV, produced output that was identical in the first 597 characters under the same prompt and greedy decoding, then began to diverge.

50%
Unverified

GEMV can complete dequantization while reading the weights, whereas GEMM's tiling logic makes the dequantization process more complex.

50%
Unverified

In Candle's quantized Metal execution path, when the number of rows in the input matrix equals 1 it takes the GEMV path, and when the row count exceeds 1 it enters the GEMM path.

50%
Unverified

In small-batch scenarios, the additional overhead of the GEMM implementation far outweighs the gains from reusing weights across rows.

50%
Unverified

Floating-point addition and multiplication are not associative under the IEEE 754 standard, and the different internal summation orders of GEMM and GEMV produce extremely small differences in activation values for the same input.

50%
Unverified

In large models based on the Transformer architecture, the vast majority of floating-point operations are concentrated in matrix multiplication, and the efficiency of GEMM kernels directly determines training throughput and inference latency.

50%
Unverified

The computational form of GEMM can be described as C = A × B + C, where A, B, and C are all two-dimensional matrices.

50%

Source Articles