Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
053a6b2
✨ feat: capture peer-to-peer copies through CUPTI MEMCPY2
itdevwu Nov 25, 2026
46a6869
🐛 fix: pair stream-order ends only with the next activity on the stream
itdevwu Nov 25, 2026
305583f
✨ feat: write a capture manifest beside artifacts and trust it offline
itdevwu Nov 25, 2026
a42a3da
✨ feat: wait for one rare slow span with triggered capture
itdevwu Nov 25, 2026
8df8f8a
📝 docs: guide collector cost tuning and record observed overheads
itdevwu Nov 26, 2026
b472c6f
✨ feat: sample CPython stacks from outside the process
itdevwu Nov 26, 2026
84f684b
✨ feat: show where swept Python threads block in native code
itdevwu Nov 26, 2026
6cbef51
📝 docs: document external Python sampling and route Python stacks to it
itdevwu Nov 26, 2026
b61a79f
✨ feat: list Python stacks sampled inside a trace slice
itdevwu Nov 26, 2026
97a361f
✨ feat: add external Python stacks to triage
itdevwu Nov 26, 2026
ba7f3bd
🐛 fix: harden ring ownership, trigger windows, stream gaps, and merge…
itdevwu Nov 26, 2026
ef21482
🐛 fix: attribute Python samples to the right thread and slice only al…
itdevwu Nov 26, 2026
2a8ea6d
🐛 fix: cut trigger windows after stop, verify GIL handoffs, and keep …
itdevwu Nov 26, 2026
2f6dc44
🐛 fix: harden trigger loss and memory bounds, STOP cleanup, and clock…
itdevwu Nov 26, 2026
1034f22
🔖 chore: prepare 0.7.0-dev.1
itdevwu Nov 26, 2026
e3590c2
🐛 fix: read ELF dependencies under the C locale in release checks
itdevwu Nov 26, 2026
3b38def
✨ feat: tell device idle from stream gaps and attribute GPUs by UUID
itdevwu Nov 28, 2026
1bdaf1a
📝 docs: describe artifacts instead of prescribing a triage-first proc…
itdevwu Nov 28, 2026
4c6d2ae
🐛 fix: ignore NVTX pops of ranges pushed before the capture
itdevwu Nov 28, 2026
e33b251
✨ feat: anchor captures to the wall clock
itdevwu Nov 28, 2026
b54ae0e
🐛 fix: keep activity running at STOP and harden device and edge evidence
itdevwu Nov 28, 2026
93085c0
📝 docs: rename and streamline Skill as xprobe-perf-profiling
itdevwu Nov 28, 2026
2955877
📝 docs: rewrite README around live profiling, tool comparison, and RSI
itdevwu Nov 28, 2026
c555c4d
📝 docs: tighten AGENTS.md wording and drop jargon
itdevwu Nov 28, 2026
b8a6047
📝 docs: correct sample paths and API domain in data-format.md
itdevwu Nov 28, 2026
26ff4f3
🔖 chore: prepare 0.7.0-dev.2
itdevwu Nov 28, 2026
525e0a4
🎨 style: redraw README hero and social card around RSI loop
itdevwu Nov 28, 2026
a53b730
📝 docs: sync docs with code, trim jargon, and drop stale version notes
itdevwu Nov 28, 2026
41b113e
📝 docs: add plain-prose writing rule to AGENTS.md
itdevwu Nov 28, 2026
d393ed4
🐛 fix: keep in-flight activity out of the clock check and recheck tri…
itdevwu Nov 28, 2026
e8786aa
🐛 fix: treat in-flight starts as busy markers and recheck trigger spa…
itdevwu Nov 28, 2026
c1b2daf
🎨 style: declutter README hero art and unify RSI tagline
itdevwu Nov 28, 2026
40ce8ce
♻️ refactor: revoke trigger windows only from records that arrive aft…
itdevwu Nov 28, 2026
9f96443
🐛 fix: revoke only idle and gap windows, pairing late ends with their…
itdevwu Nov 28, 2026
c030458
🐛 fix: close a window whose post-roll arrived instead of losing it to…
itdevwu Nov 28, 2026
c0460f3
🐛 fix: keep a lone in-flight activity at the capture start and refire…
itdevwu Nov 28, 2026
70f817f
📝 docs: describe trigger revocation and in-flight starts in plain terms
itdevwu Nov 28, 2026
eb0b25a
📝 docs: explain concept & philosophy of xprobe
itdevwu Nov 28, 2026
4da9c2c
🔖 chore: prepare 0.7.0-dev.3
itdevwu Nov 28, 2026
ee36f84
📝 docs: install the Skill from skills.sh
itdevwu Nov 28, 2026
e438135
🔧 chore: lint commit messages with gitlint
itdevwu Nov 28, 2026
2ec3132
👷 ci: verify the PyPI wheel through its per-version JSON
itdevwu Nov 28, 2026
f968b88
🔖 chore: prepare 0.7.0
itdevwu Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .cursor/rules/xprobe.mdc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
description: Shared xprobe engineering and measurement workflow
description: Shared xprobe engineering and profiling skill
alwaysApply: true
---

Follow `AGENTS.md` for repository engineering rules. For latency measurement
tasks, follow `skills/xprobe-measure-latency/SKILL.md`. Do not create a
Cursor-specific measurement workflow or reinterpret the checked-in JSON schemas.
Follow `AGENTS.md` for repository engineering rules. For profiling tasks,
follow `skills/xprobe-perf-profiling/SKILL.md`. Do not create a
Cursor-specific profiling workflow or reinterpret the checked-in JSON schemas.
26 changes: 22 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ jobs:
dist/${{ steps.package.outputs.name }}.tar.gz.sha256
dist/${{ steps.package.outputs.name }}.spdx.json
generate_release_notes: true
# X.Y.Z-dev.N tags are prereleases and never become latest.
prerelease: ${{ contains(github.ref_name, '-dev.') }}
make_latest: ${{ !contains(github.ref_name, '-dev.') }}
- name: Verify public release archive
env:
GH_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -165,12 +168,27 @@ jobs:
python-version: "3.12"
- name: Verify the public PyPI wheel
run: |
# PyPI names X.Y.Z-dev.N as X.Y.Z.devN.
version=${GITHUB_REF_NAME#v}
version=${version/-dev./.dev}
# The simple index is cached for minutes after an upload; the
# per-version JSON is fresh on its first request.
for attempt in $(seq 1 30); do
if python -m pip download --quiet --no-deps --only-binary :all: \
--dest public "xprobe==${version}"; then
if curl -fsSL -o release.json "https://pypi.org/pypi/xprobe/${version}/json?attempt=${attempt}"; then
break
fi
sleep 20
sleep 10
done
PYTHON=python tests/install/test_wheel.sh public/xprobe-"${version}"-*.whl
read -r url digest < <(python - <<'PY'
import json
files = json.load(open("release.json"))["urls"]
wheel, = [f for f in files if f["packagetype"] == "bdist_wheel"]
print(wheel["url"], wheel["digests"]["sha256"])
PY
)
mkdir -p public
curl -fsSL -o "public/${url##*/}" "$url"
# PyPI serves the wheel this run built.
echo "${digest} public/${url##*/}" | sha256sum -c -
echo "${digest} dist/${url##*/}" | sha256sum -c -
PYTHON=python tests/install/test_wheel.sh "public/${url##*/}"
16 changes: 16 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Commit message rules, checked by `just lint-commits`.
[general]
# A one-line commit is fine.
ignore=body-is-missing,body-min-length
regex-style-search=true

# GitHub cuts titles longer than 72 characters.
[title-max-length]
line-length=72

# Emoji conventional commits, e.g. "🐛 fix: restore target registers".
[title-match-regex]
regex=^\S+ (feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([a-z0-9-]+\))?!?: \S

[body-max-line-length]
line-length=80
163 changes: 78 additions & 85 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,97 @@

## Sources of truth

- Code, tests, and checked-in JSON schemas define implemented behavior.
- `README.md` and `docs/` describe released behavior. Rewrite stale sections in
place when behavior changes; do not append historical caveats or parallel
inventories.
- Treat user reports and external reviews as evidence to investigate, not as
implemented fact. Verify claims about bounds, clocks, filtering, lifecycle,
and errors against code and tests before documenting or changing them.
- Code, tests, and `schemas/` define implemented behavior.
- `README.md` and `docs/` describe current behavior. Rewrite stale sections in
place instead of appending historical version notes, and keep version strings
matched across manifests and docs.
- Write docs, Skills, and comments in plain, direct engineering prose — skip
defensive disclaimers, walls of text, and jargon filler (e.g. "contracts",
"gates", repeating "bounded").
- Verify bug reports and review claims against code and tests before changing
or documenting anything.

## Boundaries
## Architecture & boundaries

- The public CLI is exactly `doctor`, `discover`, `validate`, and `measure`.
- Keep public contracts in `xprobe/protocol`, deterministic Linux logic in
`xprobe/core`, collection in `xprobe/collector`, matching in
`xprobe/correlator`, export in `xprobe/exporter`, and orchestration in the CLI.
- Do not add a daemon or persistent session service without a concrete workflow
that cannot be expressed by the four bounded commands.
- The public CLI is strictly `doctor`, `discover`, `validate`, and `measure`.
Do not add a daemon or persistent service unless a concrete workflow cannot
be expressed with these four commands.
- Crate layout: public types and JSON schemas in `xprobe/protocol`,
deterministic Linux logic in `xprobe/core`, collection in `xprobe/collector`,
matching in `xprobe/correlator`, export in `xprobe/exporter`, and CLI
orchestration in `xprobe/cli`.
- Keep eBPF and CUPTI callback hot paths bounded and free of blocking I/O.
- Resolve architecture-specific syscall names in core. In BPF, filter process
identity and syscall number before reading scalar registers or reserving a
record. Arm multi-link collectors only after every link is attached.
- Resolve arch-specific syscall names in `core`. In BPF, filter PID and syscall
number before reading scalar registers or reserving a record. Arm multi-link
collectors only after every link attaches.
- Resolve runtime probes from mapped binary capabilities, not process names.
libbpf USDT attachment requires its support maps even when xprobe does not
read marker arguments.
libbpf USDT attachment needs its support maps even when marker arguments are
not read.

## Failures and safety
## Safety & error handling

- Return malformed data, unexpected I/O, command failures, and cleanup failures
as explicit errors. Do not replace them with defaults or partial success.
- Identify a process by PID plus procfs start time and verify it around attach.
explicitly; never substitute defaults or partial success.
- Identify processes by PID plus procfs start time and re-verify around attach.
- Every attach and injection path must restore target state on failure and have
deterministic cleanup tests.
- `validate` is read-only. `measure` may inject CUPTI only after validation
reports `injection_required`; log the mutation and include a JSON warning.
- Stop CUPTI logically after collection. Do not `dlclose` the injected agent.
- NVTX callback routing must be initialized before the target's first NVTX API
call. Once initialized, keep the CUPTI subscriber mapped and registered;
logical stop disables callback domains instead of unsubscribing it.
- Correlate NVTX IDs as ordered lifecycles. Thread range keys reuse push levels,
and a bounded capture may end with one range open; retain earlier closed
pairs and report only the trailing start as unmatched.
- Never collect pointer-referenced payloads, environments, or GPU buffer data by
default. Named tracepoints retain identity and timestamps unless a versioned
scalar payload is explicitly designed. Never describe temporal correlation
as exact causality.
- Treat sampled hotspot proportions as estimates. Preserve sample loss, stack
truncation, thread coverage, symbol coverage, and native fallback when Python
semantic symbols are unavailable.
- `validate` is read-only. `measure` injects CUPTI only after validation
reports `injection_required`, logs the mutation, and emits a JSON warning.
- Stop CUPTI logically after collection; never `dlclose` the injected agent.
- Initialize NVTX dispatch before the target's first NVTX call. Once
initialized, keep the CUPTI subscriber mapped and registered; logical stop
disables callback domains instead of unsubscribing.
- Correlate NVTX IDs in order: thread range keys reuse push levels, and a
capture may end with one range open — keep earlier closed pairs and report
only the trailing start as unmatched.
- Never read pointer-referenced payloads, environment variables, or GPU buffer
data by default. Named tracepoints record identity and timestamps only unless
a versioned scalar payload is explicitly added. Never label temporal
correlation as exact causality.
- Treat sampled hotspot shares as estimates, and preserve sample loss, stack
truncation, thread/symbol coverage, and native fallback when Python symbols
are unavailable.

## Agent workflow
## Agent Skill

- Follow `skills/xprobe-measure-latency/SKILL.md` for measurement tasks.
- Choose the shortest Skill route supported by the evidence. Existing artifacts
are analyzed offline; known boundaries go straight to bounded measurement;
unknown live work starts with one triage window and continues with its ranked
next spec or a measurement graph. Escalate only from evidence, and do not
guess selectors. `discover` is only for CUDA context holders.
- Read the quality verdict, source coverage, stream identity, and profiler
overhead before interpreting latency. Summed concurrent GPU duration is not
wall time.
- Keep the Skill entry point short and each fact in one place. Field meanings
belong to schemas and flags to `--help`; Skill tests check behavior, links,
and documented flags rather than pinning prose.
- Keep reusable analysis deterministic and bundled with the Skill. Keep model
orchestration in the caller rather than adding CLI commands or a service.
- Use `skills/xprobe-perf-profiling/SKILL.md` for profiling tasks.
- Keep the Skill short and focused on commands, exact JSON/JSONL artifact
shapes, scripting/RSI recipes, and hard runtime limits — not a fixed
investigation procedure.
- Keep reusable analysis deterministic in `analyze_trace.py`; leave
orchestration to the caller rather than adding CLI commands or a service.
- Skill tests check links, CLI flags, and cited schema fields instead of
pinning prose.
- User docs point to skills.sh (`npx skills add itdevwu/xprobe`), which
installs from `master`. To develop or test the Skill, install from the local
checkout or a GitHub tag URL.

## Release discipline
## Releases & git

- Start post-release work on a dedicated feature or fix branch. Rebase pull
requests into `master`; do not create merge commits.
- Build Linux release artifacts on Ubuntu 22.04 and enforce a GLIBC_2.34 ceiling
for the CLI and every shipped Agent ELF.
- A release is complete only after downloading the public archive, checking its
digest, testing installation, and inspecting all shipped ELF compatibility.
- Retry CI only when logs identify a transient infrastructure failure. Preserve
real compiler, test, packaging, and compatibility failures for diagnosis.
- Pin Rust in `rust-toolchain.toml`. Change the pin only in a dedicated change
and rerun lint and tests under the new compiler.
- Start post-release work on a dedicated branch and rebase PRs onto `master`
(no merge commits).
- Use emoji conventional commits, e.g. `🐛 fix: restore target registers`.
- Build Linux release artifacts on Ubuntu 22.04 with a `GLIBC_2.34` ceiling for
the CLI and every shipped Agent `.so`. Follow `docs/releasing.md` to verify
the public archive, digest, installation, and ELF compatibility before
marking a release complete.
- Change the Rust version in `rust-toolchain.toml` only in a dedicated commit,
then rerun lint and tests.

## Verification

- Run `just` recipes inside the `xprobe-dev` Mamba environment from
`environment.yml`, for example `mamba run -n xprobe-dev just test`. A bare
host shell may lack Clang, Ninja, and autotools.
- Set `PYTORCH_ENV` to an environment created from `environment-pytorch.yml`
for PyTorch live gates and `just test-release-live`.
- Run `just fmt-check`, `just lint`, and `just test` for Rust changes.
- Run `just test-bpf-live` for BPF attachment changes.
- Run `just test-cupti-live` for CUPTI ABI or callback changes.
- Run `just test-nvtx-live` for NVTX callback, filtering, or lifecycle changes.
- Run `just test-injection-live` for injection or agent lifecycle changes.
- Run `just test-multisource-live` for host/GPU orchestration changes.
- Run `just test-agent-contract` for CLI, schema, docs, or Skill changes.
- Test bundled Skill scripts with deterministic fixtures and include them in
`just test-agent-contract`.
- Run `just benchmark-gpu` for callback hot-path changes.
- Run `just benchmark-aggregate` for aggregate inventory hot-path or capacity
changes.
- Run `just benchmark-multiprocess` for concurrent worker orchestration changes.
- Run `just benchmark-pytorch` for PyTorch workflow or framework-overhead
changes.
- Use emoji conventional commits, for example `🐛 fix: restore target registers`.
- Run `just` inside the `xprobe-dev` Mamba environment from `environment.yml`
(e.g. `mamba run -n xprobe-dev just test`); a bare shell may lack Clang,
Ninja, or autotools. Set `PYTORCH_ENV` (from `environment-pytorch.yml`) for
PyTorch live tests and `just test-release-live`.
- Rust changes: `just fmt-check`, `just lint`, `just test`.
- CLI, schema, docs, or Skill changes: `just test-agent-contract` (includes
deterministic fixture tests for bundled Skill scripts).
- Subsystem live tests (run matching recipe for touched code): `test-bpf-live`,
`test-cupti-live`, `test-nvtx-live`, `test-injection-live`,
`test-multisource-live`, `test-trigger-live`, `test-python-sample-live` (when
adding a CPython minor version, regenerate
`tests/integration/python-layout/expected.json` from its headers).
- Benchmarks (run matching recipe when touching hot paths or orchestration):
`benchmark-gpu`, `benchmark-aggregate`, `benchmark-multiprocess`,
`benchmark-python-sampling`, `benchmark-pytorch`.
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@AGENTS.md

For xprobe latency measurement tasks, follow
`skills/xprobe-measure-latency/SKILL.md` as the shared workflow.
For xprobe profiling tasks, follow
`skills/xprobe-perf-profiling/SKILL.md` as the shared skill.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)

project(xprobe VERSION 0.6.3 LANGUAGES C)
project(xprobe VERSION 0.7.0 LANGUAGES C)

include(CTest)

Expand Down
Loading
Loading