Loading...
Loading...
Profile a model running on MAX to find where it spends time and whether the GPU is saturated. Use when the user asks to "profile my model," "where is my model spending time," "why is inference slow," "is my GPU being utilized," "how much GPU am I using," "get a kernel breakdown," "capture an nsys/rocprof/ncu trace of max serve," or wants to measure MAX inference performance. Works for any model MAX can run — built-in architectures and custom ones loaded with --custom-architectures — from a pip or pixi install (max generate, max serve, or a Python script) on NVIDIA or AMD GPUs. Decide cheapest-first: a GPU utilization check, then a kernel breakdown, then a single-kernel deep dive only when one kernel dominates.
npx skill4agent add modular/skills profile-model--custom-architecturespippiximax| What you're answering | Tool | Cost |
|---|---|---|
| Is the GPU busy? | | seconds, no extra installs |
| Where does time go? | | a couple of profiled runs |
| Why is one kernel slow? | Nsight Compute ( | one slow capture per kernel |
references/utilization-api.mdscripts/gpu_snapshot.pyreferences/nsys.mdreferences/rocprofv3.mdreferences/ncu.md--custom-architecturesPYTHONPATHmax serve--custom-architecturesreferences/custom-architectures.mdgemv_split_k_**_mha_*rms_norm*grouped*block_scaled_*topk_*moe_create_indicesdispatchcombine*quantize**block_scales*gemvgemmsm100_*elementwisematmul*_mha_*gpu_usage_percentnvidia-smirocm-smiwhich nsyswhich rocprofv3which ncumax servemax generate --profile/healthpkill -f maxmax-servepixi init quickstart -c https://conda.modular.com/max-nightly/ -c conda-forge
cd quickstart && pixi add max-serve
pixi run max --version # expect a *.dev buildGPUDiagContextBackgroundRecordermaxpip install maxmax.profiler.gpumax-servemaxpixi run max ...max-servemaxnsysncuwhich nsysexport PATH=/usr/local/cuda/bin:$PATHsudo apt-get install nsight-systemsrocprofv3/opt/rocm/binmaxmax.profiler.gpuscripts/gpu_snapshot.pypixi run max generate --model <m> --prompt "hello" --num-warmups 1 --profile.nsys-repMODULAR_ENABLE_PROFILING=detailednsys launchrocprofv3