cpu-pipelines-and-hazards

cpu-pipelines-and-hazards is a skill for Claude Code, Codex from mohitmishra786/low-level-dev-skills. It costs 63 tokens per session (813 once invoked), scanned A, original, MIT.

An explanation of how modern CPUs overlap instruction work through stages, and what happens when instructions depend on one another or when a branch goes the wrong way. It covers hazards, forwarding, and stalls—the delays caused by these situations.

In plain words
What is it for?
Use it to understand data and control hazards, interpret pipeline-stall metrics, reason about instruction scheduling, and investigate slow loops or branch-related performance problems.
Why use it?
It helps explain why code can run slower even when it performs the same calculations. It connects low-level code order with pipeline-stall measurements and processor behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to understand data and control hazards, interpret pipeline-stall metrics, reason about instruction scheduling, and investigate slow loops or branch-related performance problems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mohitmishra786/low-level-dev-skills --skill cpu-pipelines-and-hazards
Clone the repo
git clone --depth 1 https://github.com/mohitmishra786/low-level-dev-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cpu-pipelines-and-hazards

README.md
[![agentmods](https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards/github.svg)](https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards)
Your own site
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cpu-pipelines-and-hazards

Your own site · 80×15
<a href="https://agentmods.dev/skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards"><img src="https://agentmods.dev/badge/skills/mohitmishra786/low-level-dev-skills/cpu-pipelines-and-hazards.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 813 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.00813
Opus 5 $0.00032 $0.00407
Sonnet 5 $0.00013 $0.00163
Haiku 4.5 $0.00006 $0.00081

Measured 12d ago against content hash 0b7c066e80f9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

cpu-pipelines-and-hazards scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/computer-architecture/cpu-pipelines-and-hazards/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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

Read the full file on GitHub · 104 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 104 lines · 63 tokens per session scan A 0b7c066e80f9

Subscribe to this mod's changes

cpu-pipelines-and-hazards is a skill published in the GitHub repository mohitmishra786/low-level-dev-skills (202 stars, last pushed 2mo ago), licensed MIT. It adds 63 tokens to every session and 813 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.