liveBook · Manning

Conflict miss

As explained in 100 Go Mistakes and How to Avoid Them

A conflict miss is a cache miss caused by multiple memory blocks competing for a restricted cache set.

A conflict miss occurs when memory blocks compete for a restricted cache set, causing a miss that partitioning would otherwise avoid. A critical stride repeatedly maps accesses to the same set. section 12.1.5

The 512-column trap

A 32 KB, eight-way L1D cache with 64 sets and 64-byte lines has a 4 KB critical stride. Because 4 KB contains 512 int64 values, calculateSum512 repeatedly creates poor cache distribution; calculateSum513 avoids that critical stride despite identical loop logic. section 12.1.5

How 100 Go Mistakes and How to Avoid Them covers it

How deep it goes
Explains cache-set competition, critical stride, replacement, and concrete matrix dimensions without developing cache internals beyond placement.
Examples
Uses Go matrix-summing functions with 512 versus 513 columns and a 32 KB eight-way L1D cache.
What it assumes
Assumes familiarity with memory addresses, cache lines, cache sets, matrix traversal, and striding.
What you can do after
Diagnose cache-sensitive loops and avoid critical strides when optimizing performance-intensive applications.
How it connects
Connects cache lines, cache sets, set-associative caches, striding, critical stride, and CPU caches.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of 100 Go Mistakes and How to Avoid Them. The section links point to the parts of the book it draws on.