memory-profile

Analyze TPU pretraining profiles to determine HBM peak occupancy and buffer allocation.

5|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/primatrix/skills --skill memory-profile
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: memory-profile
Source: https://github.com/primatrix/skills/tree/main/plugins/tpu-perf/skills/memory-profile
Command: npx skills add https://github.com/primatrix/skills --skill memory-profile

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires hlo_pb2, xplane_pb2, pypdf, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides deep insights into the HBM (High Bandwidth Memory) occupancy and memory allocation during TPU pretraining, helping to optimize resource usage and identify bottlenecks.

Core Features & Use Cases

  • HBM Occupancy Analysis: Locate the static HBM peak and identify the HLO instructions and buffers that contribute to it.
  • Memory Allocation Tracking: Track the lifetime and size of buffers in the runtime memory, including those allocated and deallocated during the trace.
  • Use Case: Imagine you are pretraining a model on a TPU and encountering high HBM usage. Use this Skill to identify the specific HLO instructions and buffers contributing to the peak usage, allowing you to optimize your model architecture or code.

Quick Start

Analyze the HBM occupancy for the profile directory 'tpu_profile'.

Frequently Asked Questions about memory-profile

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I analyze TPU pretraining HBM occupancy to identify memory bottlenecks?

TPU pretraining HBM occupancy is analyzed by parsing HLO buffer assignments from '.hlo_proto.pb' files and runtime allocator events from '.xplane.pb' files to determine peak memory usage and identify contributing buffers.

What causes high HBM usage during TPU pretraining?

High HBM usage during TPU pretraining is caused by specific HLO instructions and buffer allocations that contribute to the static memory peak. Tracking runtime buffer lifetimes and sizes helps pinpoint these memory bottlenecks.

How do I track buffer allocation and deallocation in TPU runtime memory?

Track buffer allocation in TPU runtime memory by parsing runtime allocator events captured within '.xplane.pb' profile files to monitor the lifetime and size of buffers allocated and deallocated during the trace.

Do I need HLO proto files to analyze TPU memory allocation?

Yes, HLO proto files are required to analyze TPU memory allocation. The analysis specifically requires HLO buffer assignment data from '*.hlo_proto.pb' files to identify the HLO instructions contributing to peak HBM occupancy.

What is the best way to find HLO instructions contributing to HBM peak usage?

The best way to find HLO instructions contributing to HBM peak usage is to cross-reference static HLO buffer assignment data from '.hlo_proto.pb' files with runtime allocator events from '.xplane.pb' profiles to isolate the specific buffers at the peak.

Can I optimize TPU resource usage without runtime allocator events?

No, optimizing TPU resource usage fully requires runtime allocator events from '*.xplane.pb' files. Without these events, the analysis cannot track the dynamic lifetime and size of buffers allocated and deallocated during the runtime trace.