An execution trace is a chronological, low-level record of the sequence of instructions, memory accesses, and function calls executed by a program on a processor. For NPU acceleration, this detailed log captures the precise flow of kernel execution, data movement between memory hierarchies, and hardware events, enabling engineers to reconstruct the exact runtime behavior of a workload. It is the raw data source for performance profiling and bottleneck analysis, moving beyond aggregate metrics to provide a step-by-step account of computation.
Glossary
Execution Trace

What is Execution Trace?
A foundational tool for analyzing the runtime behavior of programs on specialized hardware accelerators like Neural Processing Units (NPUs).
Analyzing an execution trace allows performance engineers to identify specific inefficiencies such as memory access patterns causing poor coalescing, pipeline stalls due to dependencies, or suboptimal workgroup scheduling. By correlating trace events with hardware performance counters, engineers can pinpoint whether a kernel is compute-bound or memory-bound. This granular insight is critical for auto-tuning parameters like tile size and vectorization factor, and for validating the effectiveness of kernel fusion and other compiler optimizations on the target NPU architecture.
Key Components of an Execution Trace
An execution trace is a granular, chronological log of a program's runtime behavior. For NPU workloads, it provides the foundational data required for performance analysis, bottleneck identification, and auto-tuning. The following components are essential for a comprehensive trace.
Instruction Stream
The sequential record of every machine instruction executed by the NPU's cores. This is the most fundamental component, showing the exact flow of control.
- Opcode and Operands: Captures the operation type (e.g., FMA, LOAD, STORE) and its associated data sources/destinations.
- Program Counter (PC): Tracks the memory address of each instruction, enabling reconstruction of the execution path.
- Branch Resolution: Logs the outcome of conditional branches, revealing control flow divergence and potential thread divergence inefficiencies.
This stream is critical for verifying compiler output and identifying unexpected instruction sequences.
Memory Access Log
A detailed record of all data movement operations, including addresses, sizes, and latencies. This is paramount for diagnosing memory-bound kernels.
- Access Pattern: Shows whether loads/stores are contiguous (enabling memory coalescing) or scattered.
- Hierarchy Level: Indicates whether an access hit in L1/L2 cache or required a fetch from global memory, directly impacting the cache hit rate.
- Bank Conflicts: Flags simultaneous accesses to the same memory bank within a shared memory region, which serialize execution.
Analyzing this log reveals opportunities to optimize data layout, tiling, and prefetching.
Function Call Stack
A hierarchical record of subroutine invocations, including entry/exit timestamps and parameters. This contextualizes low-level events within the program's logical structure.
- Call Graph: Maps the relationships between functions, showing which high-level operations lead to specific kernel launches.
- Nested Timing: Allows for attribution of execution time to specific functions, facilitating hotspot identification.
- Kernel Launch Parameters: Records the configuration (grid size, block size) for each dispatched kernel, which is the target for auto-tuning.
This stack is essential for creating flame graphs and understanding performance at the application level.
Hardware Performance Counters
Metrics collected from specialized processor registers that count low-level architectural events. These provide quantitative insight into hardware resource utilization.
- Compute Metrics: Floating-point operations (FLOPs), integer operations, and compute throughput (e.g., FLOPS achieved).
- Memory Metrics: Cache misses at each level, memory bandwidth utilization, and DRAM transaction counts.
- Execution Metrics: Pipeline stall cycles, warp/wavefront issue efficiency, and occupancy levels.
Integrating these counters with the instruction stream enables precise bottleneck analysis, distinguishing between compute-bound and memory-bound phases.
Timeline and Synchronization Events
A temporally ordered log of events with nanosecond-resolution timestamps. This reveals parallelism, dependencies, and idle periods.
- Kernel Execution Windows: Visualizes when each kernel starts and stops, showing potential for concurrent kernel execution.
- Memory Transfer Phases: Shows overlapping of computation with host-to-device (H2D) and device-to-host (D2H) data transfers under asynchronous execution.
- Synchronization Points: Records barriers, locks, and atomic operations that can cause threads to wait, indicating resource contention or serialization.
This timeline is crucial for optimizing workload scheduling and achieving full NPU utilization.
Metadata and Execution Context
Ancillary data that provides essential context for interpreting the raw trace, ensuring reproducibility and accurate analysis.
- Hardware Identification: NPU model, driver version, and core clock frequency at capture time.
- Software Environment: Compiler version, framework (e.g., TensorFlow, PyTorch), and kernel binary hash.
- Input Tensor Characteristics: Shapes, data types (e.g., FP16, INT8), and memory layouts of the workload's inputs.
- Trace Capture Parameters: Sampling rate (for sampling profiler traces) or instrumentation mode (for instrumentation profiler traces).
This context allows performance engineers to correlate behavior across runs and different hardware platforms.
How Execution Tracing Works for NPUs
Execution tracing is a fundamental technique for understanding and optimizing the runtime behavior of workloads on Neural Processing Units (NPUs).
An execution trace is a chronological, low-level record of the sequence of instructions, memory accesses, and function calls executed by a program on an NPU. Unlike aggregated performance counters, a trace provides a detailed, temporal view of execution, enabling engineers to reconstruct the exact flow of operations. This granular data is essential for identifying pipeline stalls, thread divergence, and inefficient memory access patterns that hinder performance.
Tracing is typically implemented via hardware event streams or instrumented software emulation, capturing events like kernel launches, memory coalescing successes, and cache hits/misses. By analyzing this timeline, performance engineers can pinpoint hotspots, understand resource contention, and validate the effectiveness of auto-tuning parameters. The trace serves as the ground truth for building accurate performance models and conducting bottleneck analysis to transition workloads from memory-bound to compute-bound states.
Primary Use Cases for Execution Traces
Execution traces provide a granular, chronological record of program activity on an NPU, enabling engineers to move beyond aggregate metrics and diagnose the root causes of performance issues.
Bottleneck Identification and Analysis
Execution traces are the primary tool for distinguishing between compute-bound and memory-bound kernels. By analyzing the sequence of instructions and memory accesses, engineers can pinpoint the exact cause of pipeline stalls. For example, a trace showing frequent, long-latency accesses to global memory followed by idle compute units clearly indicates a memory bandwidth bottleneck. This analysis directly informs optimization strategies like memory coalescing or increasing cache hit rates.
Thread Divergence and Warp Efficiency
Traces reveal the dynamic execution path of individual threads within a warp or wavefront. This is critical for identifying thread divergence, where conditional branches (e.g., if/else statements) cause threads within the same warp to serialize their execution, drastically reducing parallel efficiency. By visualizing which threads are active at each cycle, engineers can restructure algorithms or data layouts to maintain high occupancy and ensure all threads in a warp follow the same execution path as much as possible.
Validating Auto-Tuning Results
Auto-tuning systems like a kernel tuner use parameter search across a configuration space (e.g., workgroup size, tile size) to find optimal settings. An execution trace provides the definitive proof of why one configuration outperforms another. Instead of just seeing a final runtime, engineers can examine traces to verify that the chosen configuration successfully increased memory coalescing, reduced pipeline stalls, or improved cache hit rates. This moves optimization from a black-box search to an explainable, engineering-driven process.
Memory Access Pattern Optimization
The most detailed use case involves analyzing the exact pattern of loads and stores. Traces can show:
- Non-coalesced memory accesses that fracture a single wide transaction into many small, inefficient ones.
- Bank conflicts in shared memory that serialize access.
- Inefficient reuse patterns that cause unnecessary data movement across the memory hierarchy. By studying these patterns, engineers can apply transformations like loop tiling (tile size selection) or data layout restructuring to create sequential, aligned access patterns that maximize memory bandwidth utilization.
Concurrency and Scheduling Analysis
For complex workloads using asynchronous execution or concurrent kernels, traces provide a timeline view of kernel launches, data transfers, and synchronization events. This allows engineers to:
- Identify gaps of idle hardware between kernels.
- Detect resource contention between concurrently running kernels.
- Verify that computation is effectively overlapped with data transfer (hiding latency).
- Optimize the scheduling order and dependencies to maximize NPU utilization and overall throughput.
Creating and Refining Performance Models
Execution traces serve as ground-truth data for building and calibrating analytical performance models. By correlating observed execution times and stall cycles in the trace with kernel parameters (e.g., input size, workgroup size) and hardware events, engineers can create models that predict performance for new configurations. This is a key technique in advanced auto-tuning methods like Bayesian Optimization, where an accurate model guides the search towards promising regions of the configuration space without exhaustive profiling.
Execution Trace Collection Methods
A comparison of the primary techniques used to capture chronological records of NPU program execution for performance analysis and debugging.
| Method | Hardware-Based Tracing | Software-Based Instrumentation | Hybrid (Hardware + Software) |
|---|---|---|---|
Collection Mechanism | Dedicated on-chip trace units (e.g., ETB, PTM) | Code instrumentation (probes, hooks) or binary rewriting | Hardware trace packets augmented with software metadata |
Granularity | Cycle-accurate instruction & memory access | Function/API call, user-defined regions | Instruction stream with annotated high-level events |
Overhead | < 1% (dedicated hardware) | 5-50% (varies by instrumentation density) | 1-10% (hardware overhead + minimal software) |
Data Volume | High (raw bitstream) | Low to Medium (structured events) | Medium (raw stream + filtered events) |
Required Hardware Support | Mandatory (NPU trace IP) | None | Mandatory (NPU trace IP) |
Post-Processing | Complex decoding with vendor tools | Minimal (structured logs) | Moderate (correlation and symbol resolution) |
Debug Symbol Integration | Post-capture, requires symbol files | At capture time | Post-capture correlation |
Real-Time Analysis | Limited (streaming to host) | Yes (in-process callbacks) | Yes (software component can filter/analyze) |
Frequently Asked Questions
A glossary of key terms and concepts related to Execution Trace, a critical tool for analyzing and optimizing the performance of workloads on Neural Processing Units (NPUs).
An Execution Trace is a chronological, low-level record of the sequence of instructions, memory accesses, and function calls executed by a program on a processor, such as a Neural Processing Unit (NPU). It provides a detailed, step-by-step log of runtime behavior, capturing events like kernel launches, memory transfers, and synchronization points. Unlike summary profiling data, a trace offers a temporal view, essential for identifying patterns of inefficiency, pipeline stalls, and resource contention. In NPU performance analysis, traces are used to reconstruct the exact flow of execution, enabling engineers to pinpoint latency bottlenecks, optimize memory coalescing, and validate auto-tuning results by showing how parameter changes affect the actual instruction stream and hardware utilization.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Execution traces are analyzed alongside these core concepts to diagnose bottlenecks and optimize NPU workloads. Each term represents a distinct facet of performance measurement or automated tuning.
Performance Counter
A hardware register that counts low-level events within a processor, such as cache misses, floating-point operations (FLOPs), or branch mispredictions. These counters provide the raw, quantitative data that feeds into the analysis of an execution trace.
- Key Metrics: Instructions per cycle (IPC), L1/L2 cache hit rates, memory read/write throughput.
- Use Case: Correlating high-level trace events (e.g., a function call taking too long) with microarchitectural causes (e.g., a high rate of last-level cache misses).
Kernel Profiler
A software tool that measures the execution time, resource utilization, and associated hardware performance counters for a computational kernel running on an NPU. It provides a focused, timed view of a kernel's execution, which is a critical subset of a full system trace.
- Outputs: Timeline of kernel launches, memory copies, and GPU/NPU activity.
- Tools: NVIDIA Nsight Systems, AMD ROCprofiler, Intel VTune Profiler for GPUs/XPUs. NPU vendors provide analogous SDK tools.
Hotspot Identification
The process of using profiling data—including execution traces—to locate the specific functions, loops, or instructions within a program that consume the most execution time or resources. This is the primary diagnostic goal of trace analysis.
- Method: Aggregate time spent per call stack or code region from the trace.
- Visualization: Often presented using Flame Graphs, where the width of horizontal bars represents the proportional time spent in each function and its descendants.
Bottleneck Analysis
The systematic process of identifying the primary limiting factor that restricts overall performance. An execution trace is the essential dataset for this analysis, revealing whether a workload is compute-bound, memory-bound, or limited by synchronization or control flow.
- Compute-Bound: ALUs are saturated; trace shows high occupancy but low memory throughput.
- Memory-Bound: Compute units are often idle; trace shows high memory transaction counts and potential stalls.
- Latency-Bound: Execution is stalled waiting for dependencies (e.g., data from main memory).
Auto-Tuning
The automated process of searching a configuration space (e.g., tile size, unroll factor, workgroup size) to find the parameters that yield optimal performance for a given kernel on specific hardware. Execution traces and performance counters are used to evaluate each candidate configuration.
- Search Methods: Grid search, random search, or more advanced techniques like Bayesian Optimization.
- Goal: Automatically derive the optimal parameters that a human engineer would seek through manual trace analysis and experimentation.
Performance Model
An analytical or machine-learned model that predicts the execution time or resource usage of a computational kernel based on its parameters, hardware characteristics, and input data. Execution traces from prior runs are often used as training data to build or validate these models.
- Purpose: To guide auto-tuning searches efficiently, avoiding the need to physically execute every possible configuration.
- Types: Roofline models (analytical), linear regression models, or neural networks trained on trace/counter data.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us