agentleFS
NVIDIAKnown publisherNVIDIA/cudnn-frontend/skills/determinism_tests/SKILL.md

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.

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
  1. Distinctive:

    Use this workflow with each new numerical API or kernel change.

    line 8
  2. Distinctive:

    Read the root determinism rules and test guide.

    line 13
  3. Very specific:

    Place test_<op>_determinism.py beside the operation's tests.

    line 31
  4. Distinctive:

    Keep an independent numerical reference separate from byte comparisons.

    line 58
  5. Distinctive:

    Add a small golden case per direction and distinct numerical path.

    line 61
  6. Distinctive:

    Use the API's deterministic mode when provided.

    line 65
  7. Distinctive:

    Run the new or changed suites on each supported GPU available to the task.

    line 71
  8. Distinctive:

    Use the golden workflow to prepare a missing baseline before the strict check above.

    line 87
  9. Distinctive:

    Update docs/operations/determinism.md in the same change, even when a new API can only be marked unverified.

    line 105
  10. Very specific:

    Keep the current GPU headers, including the combined SM100/103 column.

    line 108
  11. Distinctive:

    Do not upgrade a status because failing cases were skipped or a golden passed.

    line 123
  12. Very specific:

    Keep test counts, commands, runtime logs, and failure diagnostics in the test report, outside the support page.

    line 124
  13. Very specific:

    Before finishing, report the added coverage, actual pass/fail/skip counts, unmeasured GPUs, and changed support rows in the PR description.

    line 128

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 despite PYTHONPATH.

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 contractExample
Recurrent output/state and autogradLinear attention
Packed sparse attention and saved statisticsQSA
Sparse indices, shared sink gradient, empty-row sentinelsDSA attention
Mutable scores and sparse/dense gradient reductionsDSA indexer
Fixed quantized payloads and repacked scalesFP8/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 -rs

Use 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.

StatusRequired evidence for the documented configurations
SupportedRepeatability and batch invariance verified
Replay onlyRepeatability verified; batch invariance has a known failure
Not guaranteedRepeatability has a known failure
UnverifiedInsufficient execution evidence on this GPU
UnsupportedThe 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.