determinism-tests
Skill994 starsChanged 10 days agoApache-2.0View on GitHub
Add and run L0 bitwise determinism and batch-invariance tests for new or changed cuDNN Frontend numerical APIs, kernel paths, datatypes, or GPU targets, then update docs/operations/determinism.md from measured evidence.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- include/cudnn_frontend/AGENTS.mdAGENTS.md
- python/cudnn/AGENTS.mdAGENTS.md
- python/cudnn/sdpa/AGENTS.mdAGENTS.md
- samples/AGENTS.mdAGENTS.md
- test/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- cutedsl-kernel-integrationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 9 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this workflow with each new numerical API or kernel change.
- Distinctive: line 13
Read the root determinism rules and test guide.
- Very specific: line 31
Place test_<op>_determinism.py beside the operation's tests.
- Distinctive: line 58
Keep an independent numerical reference separate from byte comparisons.
- Distinctive: line 61
Add a small golden case per direction and distinct numerical path.
- Distinctive: line 65
Use the API's deterministic mode when provided.
- Distinctive: line 71
Run the new or changed suites on each supported GPU available to the task.
- Distinctive: line 87
Use the golden workflow to prepare a missing baseline before the strict check above.
- Distinctive: line 105
Update docs/operations/determinism.md in the same change, even when a new API can only be marked unverified.
- Very specific: line 108
Keep the current GPU headers, including the combined SM100/103 column.
- Distinctive: line 123
Do not upgrade a status because failing cases were skipped or a golden passed.
- Very specific: line 124
Keep test counts, commands, runtime logs, and failure diagnostics in the test report, outside the support page.
- Very specific: line 128
Before finishing, report the added coverage, actual pass/fail/skip counts, unmeasured GPUs, and changed support rows in the PR description.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Determinism tests
Use this workflow with each new numerical API or kernel change. Finish with forward/backward coverage, measured results, and an updated API support row in the same PR. If execution is unavailable, add the tests and mark that GPU unverified. A skill guides the agent; CI enforcement is separate.
Read the root determinism rules and test guide. Use the coverage report for shapes, test methods, golden handling, and existing gaps.
Identify the contract
- List the public API, forward/backward entry points, supported datatypes and GPUs, deterministic mode, and selected backend. State unsupported directions.
- List every output, saved statistic, input/parameter/state gradient, and mutable buffer. Include FP32 intermediates even when output uses FP16/BF16.
- Identify the batch axis, packed offsets, sparse indices, shared reductions, quantization scales, and upstream gradients that must stay fixed.
- Confirm the checkout under test with
import cudnn; print(cudnn.__file__). An editable install can resolve to another checkout despitePYTHONPATH.
Extend the closest suite
Place test_<op>_determinism.py beside the operation's tests. Mark every case
L0, including boundary and stress cases. Keep parameter IDs explicit about
direction, dtype, and shape. Reuse
determinism_utils.py for Torch byte
comparisons, snapshots, replay, and goldens. Keep operation-specific invocation
and batch packing in the suite.
Choose the nearest example; do not copy its temporary skips into a new API:
| Operation contract | Example |
| Recurrent output/state and autograd | Linear attention |
| Packed sparse attention and saved statistics | QSA |
| Sparse indices, shared sink gradient, empty-row sentinels | DSA attention |
| Mutable scores and sparse/dense gradient reductions | DSA indexer |
| Fixed quantized payloads and repacked scales | FP8/MXFP8 indexer |
Cover these checks in each supported direction:
- Replay fixed inputs with fresh buffers and concurrent GPU work. Snapshot results before the next launch. Check names, shapes, dtypes, and raw bytes.
- Compare a sequence alone, packed with neighbors, reordered, and duplicated. Preserve its exact data, upstream gradients, and loss scale. Change neighbor data separately to check isolation. Remap offsets and sparse IDs correctly.
- Include tile/dispatch boundaries, ragged lengths, empty inputs where valid, grouped reductions, and enough work to cross scheduling boundaries. Exercise each supported precision, including its scale format and gradient dtype.
- Keep an independent numerical reference separate from byte comparisons. Reject NaNs; allow infinity sentinels only where the API declares them and check their sign and location. Check unintended input mutation.
- Add a small golden case per direction and distinct numerical path. Require replay and the reference to pass before recording its hashes. A small golden does not establish determinism for larger reductions.
Use the API's deterministic mode when provided. Pin the intended backend; do not let a missing plan silently select another provider. Quantize each sequence once and preserve its payload and logical scales across batch changes.
Run and record
Run the new or changed suites on each supported GPU available to the task. Record unavailable GPUs as unverified. Confirm the runtime and import path on each host; do not copy outcomes between devices or software versions.
From the repo root, replace the example suite path below with the actual path:
cd test/python
determinism_suite=path/to/test_new_op_determinism.py
python -c 'import cudnn; print(cudnn.__file__)'
python -m pytest "$determinism_suite" -m L0 --collect-only -q
CUBLAS_WORKSPACE_CONFIG=:4096:8 \
CUDNN_DETERMINISM_GOLDENS="$PWD/determinism_goldens" \
python -m pytest "$determinism_suite" -m L0 -q -rsUse the golden workflow
to prepare a missing baseline before the strict check above. Record into a new
directory, inspect input/output hash changes and reference results, then commit
the reviewed JSON files. Normal checks must leave CUDNN_DETERMINISM_RECORD
unset. A missing baseline must not become a CI pass.
Record GPU, runtime, source revision, exact command, expanded case counts, and failures/skips in the coverage report. Preserve earlier measurements as dated records. A failed case stops at its first mismatch; later comparisons have no result. Do not replace raw-byte equality with a tolerance.
Retain existing skip until fix cases and their diagnostics. Add a temporary
skip only when explicitly requested, scoped to the known failing parameters,
with a defect reason and removal condition. Remove it with the fix and rerun
the affected cases. Never infer a fix from an intermittent pass.
Update the support page
Update docs/operations/determinism.md
in the same change, even when a new API can only be marked unverified. Add or
revise rows by API, direction, and datatype; state required modes and limits.
Keep the current GPU headers, including the combined SM100/103 column.
| Status | Required evidence for the documented configurations |
| Supported | Repeatability and batch invariance verified |
| Replay only | Repeatability verified; batch invariance has a known failure |
| Not guaranteed | Repeatability has a known failure |
| Unverified | Insufficient execution evidence on this GPU |
| Unsupported | The API precision path is unavailable by contract |
Require evidence for both GPUs before marking SM100/103 supported. If their
evidence differs, state the GPU-specific limit within the existing column;
do not add a separate SM103 status column. Missing hardware or dependencies
are verification gaps, not proof that an API path is unsupported.
Do not upgrade a status because failing cases were skipped or a golden passed.
Keep test counts, commands, runtime logs, and failure diagnostics in the test
report, outside the support page. Run fern check from docs/fern after a
status-page edit, and run pre-commit on changed files.
Before finishing, report the added coverage, actual pass/fail/skip counts, unmeasured GPUs, and changed support rows in the PR description. Identify which results are new and which are retained from earlier runs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

