TorchNeuron Profiling on AWS Trainium: System-Level Analysis and Fusion Benefits
·2026.10.22 01:04
Key point
A Hugging Face blog post details system-level profiling methods for TorchNeuron on AWS Trainium, showing that operator fusion reduces RMSNorm device time from 2,355 µs to 375 µs.
Details
- System-level profiling methodology for TorchNeuron on AWS Trainium uses
torch.profilerand Neuron Explorer to trace execution from framework dispatch to hardware. - Operator fusion via
torch.rms_normortorch.compilereduces RMSNorm device time to approximately 1/6 of the naive implementation (375 µs vs 2,355 µs). torch.compilewith the Neuron backend achieves 375.5 µs latency, comparable to the fusedtorch.rms_normkernel at 403.3 µs, by eliminating intermediate value materialization.- Naive PyTorch operations result in 6 operator calls and 2,355 µs device time, with
aten::mulaccounting for 49.5% of the self NEURON time.
Profiling Tools and Configuration
NeuronConfigpassed totorch.profilercontrols data stream capture and NeuronCore selection viaexperimental_config.- Neuron Explorer visualizes system traces, device timelines, and engine breakdowns using
.neffand.ntffartifacts. correlate_device_time=Trueenables comparison of CPU and Neuron device times in thekey_averages()table.
Performance Analysis
- Fusion removes gaps between hardware executions and prevents physical generation of intermediate values like
x_sqandmean_sq. - The workflow identifies hotspots in
key_averages(), verifies them in traces, and applies fused operations or compilation. - Part 2 of the series will cover device-level profiling, including TensorEngine, VectorEngine, and DMA breakdowns.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.