skills/computer-architecture/cpu-pipelines-and-hazards/SKILL.md
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.
npx skillsauth add mohitmishra786/low-level-dev-skills cpu-pipelines-and-hazardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
skills/profilers/intel-vtune-amd-uprofIF → ID → EX → MEM → WB
Overlapped execution: instruction N in EX while N+1 in ID.
| 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
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.
Limited functional units (single memory port) cause stalls even without dependencies.
/* 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.
perf stat -e instructions,cycles,stalls-frontend,stalls-backend ./app
VTune "Microarchitecture Exploration" maps to pipeline slots.
/cpu-pipelines-and-hazards Explain RAW hazard in this ARM assembly loop and how to break it
| 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 |
skills/computer-architecture/branch-prediction-and-speculation — mispredict costskills/computer-architecture/memory-hierarchy-and-caches — load latencyskills/low-level-programming/cpu-cache-opt — cache-line effectsskills/profilers/intel-vtune-amd-uprof — pipeline analysisskills/low-level-programming/assembly-arm — instruction schedulingdevelopment
QEMU/KVM skill for virtualization and kernel development. Use when running qemu-system-x86_64 with KVM, configuring virtio devices, VFIO passthrough, QMP monitor, libvirt, or booting custom kernels. Activates on queries about QEMU, KVM, virtio, VFIO, virsh, virt-install, or -kernel -append.
development
Hardware virtualization internals skill for Intel VT-x and AMD-V. Use when studying VMCS/VMCB, EPT/NPT page tables, VMEXIT handling, APIC virtualization, or building minimal hypervisors. Activates on queries about VMX, SVM, VMCS, EPT, NPT, VMEXIT, or type-1 hypervisor.
testing
Linux containers internals skill for namespaces, cgroups, and OCI. Use when understanding clone/unshare namespaces, cgroups v2 limits, overlayfs, runc, seccomp profiles, capabilities, or escape mitigations. Activates on queries about namespaces, cgroups, overlayfs, runc, seccomp-bpf, OCI spec, or container escape.
tools
Reverse engineering skill for binary analysis. Use when decompiling with Ghidra, analyzing with radare2, scripting RE tools, triaging with strings/file/xxd, or diffing binaries. Activates on queries about Ghidra, radare2, r2, decompiler, Binary Ninja, Diaphora, or stripped binary analysis.