CPU Design · All levels
ABI and Calling Conventions: Interview Drills
Interview Drills for ABI and Calling Conventions.
Interview drills
Interview Drills for ABI and Calling Conventions centers on call/return overhead cycles, register spill rate, and stack bandwidth pressure. Tie every claim to a measurable artifact and an owner-controlled action.
PROMPT
You observe call/return overhead cycles, register spill rate, and stack bandwidth pressure on ABI and Calling Conventions. Walk through root cause and release decision.
STRONG ANSWER
1. Names failing workload and first stage loss.
2. Explains mechanism: ABI register classes, stack alignment, and parameter passing rules determine function-call overhead, spill behavior, and interop safety across compiler, runtime, and libraries.
3. Requests proving artifact: calling-convention compliance report, prologue/epilogue profile, and spill heatmap
4. Proposes bounded fix + owner + rollback-safe validation.
WEAK ANSWER
Suggests generic optimization ideas without mechanism proof or owner accountability.Decision matrix
CPU EVIDENCE MATRIX - ABI and Calling Conventions
+---------------------------+--------------------------------+--------------------------------+---------------------------+
| Evidence | Tells you | Does not prove | Next action |
+---------------------------+--------------------------------+--------------------------------+---------------------------+
| CPI + top-down stack | broad pressure domain | exact root mechanism | inspect first failing stage |
| PMU event timeline | temporal onset and persistence | causality by itself | pair with trace and config lock |
| pipeline occupancy trace | bubble origin and spread | multicore/system interactions | correlate with LLC/NoC data |
| cache/TLB/coherence logs | memory and translation health | scheduler fairness | inspect issue/port behavior |
| thermal + power telemetry | silicon operating envelope | architectural correctness | validate bounded fixes at same corners |
+---------------------------+--------------------------------+--------------------------------+---------------------------+CPU deep dive
ISA choices are software contracts that directly become decode, verification, and security cost in silicon.
Concept diagram
ISA CONTRACT STACK
instruction semantics -> encoding -> decode/uOP expansion -> architectural stateMetric graph
ISA HEALTH TREND
illegal encoding escapes █
decode expansion pressure ████
ABI mismatch incidents ██Reports and artifacts
instruction legality audit
decode critical-path report
ABI conformance summary
trap/CSR latency sheet
Mini case study
A late ISA extension looked harmless but increased decode expansion ratio and pushed front-end timing beyond closure margin.
Debug branches
Map each ISA feature to decode and retire implications
Separate architectural correctness from microarchitectural cost
Validate privileged behavior with precise-state traces
Senior review question
Ask: which CPI/latency evidence proves this topic is truly closed beyond synthetic benchmarks?
Key takeaways
Always connect microarchitectural counter changes to product workload outcomes.
Lock binary, compiler, firmware, and thermal metadata before comparing CPU traces.
Common pitfalls
Treating average IPC as sufficient proof while ignoring latency tails and outliers.
Applying predictor or prefetch tweaks without first-failing-stage attribution.
Declaring closure without reproducible perf, correctness, and power gates.
Interview answer expansion
Strong interview answers for ABI and Calling Conventions begin with workload and metric framing, then explain mechanism in plain terms: ABI register classes, stack alignment, and parameter passing rules determine function-call overhead, spill behavior, and interop safety across compiler, runtime, and libraries.
Then propose a measurement plan: CPI stack, branch quality, queue occupancy, cache/TLB behavior, and latency distribution as applicable.
Finally, present one bounded fix plus regression risk. CPU interviews reward explicit tradeoff ownership, not generic tuning advice.