/cpu-pipelines-and-hazards
CPU pipeline skill for hazards, forwarding, and stalls. Use when explaining pipeline stages, data/control hazards, forwarding paths, or branch stalls in performance analysis. Activates on queries about pipeline hazard, data hazard, control hazard, forwarding, pipeline stall, or
$ npx -y skills add mohitmishra786/low-level-dev-skills --skill cpu-pipelines-and-hazards --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/cpu-pipelines-and-hazards
Context preview
The summary Claude sees to decide when to auto-load this skill.
CPU pipeline skill for hazards, forwarding, and stalls. Use when explaining pipeline stages, data/control hazards, forwarding paths, or branch stalls in performance analysis. Activates on queries about pipeline hazard, data hazard, control hazard, forwarding, pipeline stall, or
SKILL.md
cpu-pipelines-and-hazards.SKILL.mdname: cpu-pipelines-and-hazards
description: CPU pipeline skill for hazards, forwarding, and stalls. Use when explaining pipeline stages, data/control hazards, forwarding paths, or branch stalls in performance analysis. Activates on queries about pipeline hazard, data hazard, control hazard, forwarding, pipeline stall, or superscalar basics.
CPU Pipelines and Hazards
Purpose
Explain classic and modern CPU pipeline concepts: stages, data and control hazards, forwarding/bypassing, stalls, and branch handling — foundational for optimization and understanding microarchitecture counters.
When to Use
- Interpreting pipeline stall metrics from `skills/profilers/intel-vtune-amd-uprof`
- Teaching why instruction order affects throughput
- Relating assembly scheduling to hardware behavior
- Debugging unexpected performance cliffs in hot loops
Workflow
1. Five-stage classic pipeline (MIPS-style mental model)
IF → ID → EX → MEM → WB
Overlapped execution: instruction N in EX while N+1 in ID.
2. Data hazards
| Type | Example | Mitigation | |------|---------|------------| | RAW (true) | `add r1,r2,r3` then `sub r4,r1,r5` | Forwarding from EX/MEM/WB | | WAR / WAW | Rare in in-order; relevant in OoO rename | Register renaming |
Without forwarding:
stall until writeback completes
3. Control hazards (branches)
Branch in ID → target unknown until EX
├── Predict taken/not-taken (static or dynamic)
├── Flush wrong-path instructions on mispredict
└── Penalty = pipeline depth (varies by CPU)
See `skills/computer-architecture/branch-prediction-and-speculation`.
4. Structural hazards
Limited functional units (single memory port) cause stalls even without dependencies.
5. Practical optimization hints
/* Bad — tight dependency chain */
for (int i = 0; i < n; i++)
acc = acc + data[i]; /* each iter waits on acc */
/* Better — multiple accumulators (ILP) */
acc0 = acc1 = 0;
for (int i = 0; i < n; i += 2) {
acc0 += data[i];
acc1 += data[i+1];
}
acc = acc0 + acc1;Pair with `skills/low-level-programming/cpu-cache-opt` — memory often dominates.
6. Reading uops / ports (x86)
perf stat -e instructions,cycles,stalls-frontend,stalls-backend ./app
VTune "Microarchitecture Exploration" maps to pipeline slots.
7. Agent usage
/cpu-pipelines-and-hazards Explain RAW hazard in this ARM assembly loop and how to break it
Common Problems
| Symptom | Cause | Fix | |---------|-------|-----| | High `stalls-frontend` | I-cache misses / branch mispredict | Align hot loop; see branch skill | | No speedup from unroll | Memory bound | Profile loads; prefetch | | Wrong cycle model | Ignored OoO execution | Use perf hardware counters | | "NOP fixes it" | Timing-sensitive MMIO | Never tune device delays by NOP |
Related Skills
- `skills/computer-architecture/branch-prediction-and-speculation` — mispredict cost
- `skills/computer-architecture/memory-hierarchy-and-caches` — load latency
- `skills/low-level-programming/cpu-cache-opt` — cache-line effects
- `skills/profilers/intel-vtune-amd-uprof` — pipeline analysis
- `skills/low-level-programming/assembly-arm` — instruction scheduling
Read more
name: cpu-pipelines-and-hazards description: CPU pipeline skill for hazards, forwarding, and stalls. Use when explaining pipeline stages, data/control hazards, forwarding paths, or branch stalls in performance analysis. Activates on queries about pipeline hazard, data hazard, control hazard, forwarding, pipeline stall, or superscalar basics.
CPU Pipelines and Hazards
Purpose
Explain classic and modern CPU pipeline concepts: stages, data and control hazards, forwarding/bypassing, stalls, and branch handling — foundational for optimization and understanding microarchitecture counters.
When to Use
- Interpreting pipeline stall metrics from `skills/profilers/intel-vtune-amd-uprof`
- Teaching why instruction order affects throughput
- Relating assembly scheduling to hardware behavior
- Debugging unexpected performance cliffs in hot loops
Workflow
1. Five-stage classic pipeline (MIPS-style mental model)
IF → ID → EX → MEM → WB
Overlapped execution: instruction N in EX while N+1 in ID.
2. Data hazards
| Type | Example | Mitigation | |------|---------|------------| | RAW (true) | `add r1,r2,r3` then `sub r4,r1,r5` | Forwarding from EX/MEM/WB | | WAR / WAW | Rare in in-order; relevant in OoO rename | Register renaming |
Without forwarding:
stall until writeback completes
3. Control hazards (branches)
Branch in ID → target unknown until EX ├── Predict taken/not-taken (static or dynamic) ├── Flush wrong-path instructions on mispredict └── Penalty = pipeline depth (varies by CPU)
See `skills/computer-architecture/branch-prediction-and-speculation`.
4. Structural hazards
Limited functional units (single memory port) cause stalls even without dependencies.
5. Practical optimization hints
/* Bad — tight dependency chain */
for (int i = 0; i < n; i++)
acc = acc + data[i]; /* each iter waits on acc */
/* Better — multiple accumulators (ILP) */
acc0 = acc1 = 0;
for (int i = 0; i < n; i += 2) {
acc0 += data[i];
acc1 += data[i+1];
}
acc = acc0 + acc1;Pair with `skills/low-level-programming/cpu-cache-opt` — memory often dominates.
6. Reading uops / ports (x86)
perf stat -e instructions,cycles,stalls-frontend,stalls-backend ./app
VTune "Microarchitecture Exploration" maps to pipeline slots.
7. Agent usage
/cpu-pipelines-and-hazards Explain RAW hazard in this ARM assembly loop and how to break it
Common Problems
| Symptom | Cause | Fix | |---------|-------|-----| | High `stalls-frontend` | I-cache misses / branch mispredict | Align hot loop; see branch skill | | No speedup from unroll | Memory bound | Profile loads; prefetch | | Wrong cycle model | Ignored OoO execution | Use perf hardware counters | | "NOP fixes it" | Timing-sensitive MMIO | Never tune device delays by NOP |
Related Skills
- `skills/computer-architecture/branch-prediction-and-speculation` — mispredict cost
- `skills/computer-architecture/memory-hierarchy-and-caches` — load latency
- `skills/low-level-programming/cpu-cache-opt` — cache-line effects
- `skills/profilers/intel-vtune-amd-uprof` — pipeline analysis
- `skills/low-level-programming/assembly-arm` — instruction scheduling
A curated suite of AI agent skills for systems and low-level programming — C/C++, Rust, Zig, GPU, bare-metal firmware, Linux kernel/driver development, computer architecture, compiler internals, HPC, and more.
Repo: mohitmishra786/low-level-dev-skills
Other skills on low-level-dev-skills.
- /custom-allocators
Custom allocator skill for memory allocation strategies. Use when implementing pool/slab/arena allocators, tuning jemalloc/mimalloc, writing Rust GlobalAlloc, or benchmarking allocator performance. Activates on queries about jemalloc, mimalloc, tcmalloc, arena allocator,
Open skill - /numa-programming
NUMA programming skill for multi-socket memory locality. Use when detecting NUMA topology, binding processes with numactl, using libnuma API, building NUMA-aware data structures, or measuring remote access penalties. Activates on queries about numactl, libnuma, NUMA topology,
Open skill - /af-xdp
AF_XDP skill for high-performance XDP sockets. Use when creating AF_XDP sockets, configuring UMEM and XSK rings, XDP_REDIRECT programs, copy vs zero-copy mode, or comparing with DPDK. Activates on queries about AF_XDP, xsk_umem, XDP_REDIRECT, libbpf xsk, or zero-copy XDP.
Open skill - /dpdk
DPDK skill for userspace packet I/O. Use when initializing EAL, configuring PMD drivers, using mbuf pools and rte_ring, setting up huge pages, RSS, or testpmd validation. Activates on queries about DPDK, EAL, rte_eth_rx_burst, hugepages, PMD, or testpmd.
Open skill - /io-uring
io_uring skill for Linux async I/O. Use when building high-performance servers with liburing, multi-shot operations, provided buffers, fixed files, zero-copy send, or tokio-uring. Activates on queries about io_uring, SQE/CQE, liburing, IORING_OP_PROVIDE_BUFFERS, or io_uring vs
Open skill - /adc-dac-baremetal
Bare-metal ADC and DAC skill. Use when configuring analog sampling, DMA-driven ADC, calibration, or DAC output on MCUs. Activates on queries about ADC bare-metal, sampling time, DMA ADC, or DAC channel setup.
Open skill

