|
| 1 | +# Hosted Nsight Compute profiling |
| 2 | + |
| 3 | +`popcorn submit submission.py --leaderboard qr_v2 --profile --benchmark-index 0` |
| 4 | +uses the normal Popcorn identity and API. Users do not install Modal, create a |
| 5 | +provider account, or supply provider credentials. KernelBot dispatches the job |
| 6 | +to its GPU runner and streams back reports. `--profile-brev` remains an explicit, |
| 7 | +separate CLI choice; failures never switch providers. |
| 8 | + |
| 9 | +## API and capture contract |
| 10 | + |
| 11 | +`POST /profile/{leaderboard_name}/{gpu_type}` accepts the usual |
| 12 | +`X-Popcorn-Cli-Id` header and a multipart `file`, plus optional fields: |
| 13 | + |
| 14 | +| Field | Meaning | |
| 15 | +| --- | --- | |
| 16 | +| `benchmark_index` | Zero-based index in the task's `benchmarks`; omit for all entries. | |
| 17 | +| `ncu_kernel_name` | NCU kernel filter, including `regex:` expressions. | |
| 18 | +| `ncu_kernel_name_base` | `function`, `demangled`, or `mangled`. | |
| 19 | +| `ncu_launch_count` | Positive capture limit per benchmark; default 10. | |
| 20 | + |
| 21 | +The route retains normal submission permissions, limits, and leaderboard GPU |
| 22 | +validation. It supports the configured single-GPU NVIDIA Modal runners. Invalid |
| 23 | +options and unsupported GPUs are rejected; unsupported evaluators fail with NCU |
| 24 | +diagnostics. The dedicated route prevents older API versions from silently |
| 25 | +ignoring capture options. |
| 26 | + |
| 27 | +The runner sets `POPCORN_NCU=1`, follows child processes, and captures the NVTX |
| 28 | +push/pop range `custom_kernel/`. It collects the full NCU section set with kernel |
| 29 | +replay and leaves GPU clocks unchanged. Each benchmark returns a zip containing |
| 30 | +`profile.ncu-rep`, `ncu-details.txt`, and `ncu-details.csv`. A missing capture is a |
| 31 | +failure, even when the profiler process exits successfully. |
| 32 | + |
| 33 | +`FullResult.profile_metadata` records selected benchmark specifications, capture |
| 34 | +options, and a SHA-256 fingerprint of source/configuration fields. This is not a |
| 35 | +git commit. Record the synced reference-kernels revision in operator validation |
| 36 | +records; the client cannot update the hosted task through a local checkout. |
| 37 | + |
| 38 | +## Rollout |
| 39 | + |
| 40 | +Deploy the updated GPU runners and API before releasing the companion |
| 41 | +[popcorn-cli change](https://github.com/gpu-mode/popcorn-cli/pull/80). The runner |
| 42 | +image pins NCU 2025.2.1 and checks `ncu --version` during its build. NCU 2026.2 |
| 43 | +from CUDA 13.3 produced many NaN counters on the tested Modal B200; repeating |
| 44 | +the same capture with 2025.2.1 restored hardware counters. Use the existing Modal deployment |
| 45 | +workflow and API deployment process; no additional container privileges or |
| 46 | +user-facing provider setup is introduced. |
| 47 | + |
| 48 | +Sync an NCU-compatible task through the existing problem-update workflow, then |
| 49 | +validate one benchmark through the public API using an ordinary Popcorn user. |
| 50 | +Inspect the returned report and counter exports. The |
| 51 | +[reference-kernels guide](https://github.com/gpu-mode/reference-kernels/pull/171) |
| 52 | +describes the evaluator contract for new problems. Merely accepting `profile` |
| 53 | +and running `torch.profiler` does not satisfy that contract. |
| 54 | + |
| 55 | +## Validation |
| 56 | + |
| 57 | +CPU tests cover API authentication and options, benchmark selection, capture |
| 58 | +commands, exports, and empty captures. The GPU fixture is |
| 59 | +`problems/linalg/qr_v2`, benchmark 0 (`batch=20, n=32, cond=1, seed=43214`), at |
| 60 | +reference-kernels `51e22db671d36c1c76091c43c36a44546ba324a1`. |
| 61 | +Only this problem/shape is used for the GPU integration check; other tasks and |
| 62 | +GPU types require their own validation. |
| 63 | + |
| 64 | +The integration check used the real FastAPI route, submission preparation, |
| 65 | +KernelBackend, and GPU `run_config`, with a fake database and an ephemeral |
| 66 | +launcher instead of production infrastructure. The CLI used normal Popcorn |
| 67 | +header authentication with an empty `PATH` and no `MODAL_*` environment values. |
| 68 | +It successfully saved and extracted a 7,593,257-byte report and both detail |
| 69 | +exports. NCU reopened the report to produce those exports. |
| 70 | + |
| 71 | +NCU 2025.2.1 collected 39 passes on NVIDIA B200 with PyTorch 2.12.0+cu130, |
| 72 | +CUDA 13.3, and `regex:geqr2` / demangled / launch count 1. Observed counters: |
| 73 | +322.78 us duration, 12.51% achieved occupancy, 0.42% SM throughput, 70.09% L2 |
| 74 | +hit rate, and 1,565,428 executed instructions. Six `ctc__*` metrics remained |
| 75 | +unavailable. This validates the isolated implementation; the production API |
| 76 | +has not been deployed as part of this change. |
| 77 | + |
| 78 | +[Ephemeral validation run](https://modal.com/apps/coreauto/main/ap-p8eodYfHkZAMp0ZT5btR1y) |
| 79 | +(access requires the operator's workspace permissions). |
0 commit comments