Skip to content

Add large-tensor convolution fuzzer - #401

Merged
Anerudhan merged 15 commits into
NVIDIA:developfrom
msalasooNV:msalasoo/conv-large-tensor-fuzzer
Aug 7, 2026
Merged

Add large-tensor convolution fuzzer#401
Anerudhan merged 15 commits into
NVIDIA:developfrom
msalasooNV:msalasoo/conv-large-tensor-fuzzer

Conversation

@msalasooNV

@msalasooNV msalasooNV commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Before submitting

  • I agree to license this contribution under the terms of LICENSE.txt.
  • I ran pre-commit run and committed any formatting changes.

Affected area

  • CI or test infrastructure

Summary

Adds test/python/test_conv_large_tensor_fuzzer.py, a deterministic Python
large-tensor convolution fuzzer for FPROP, DGRAD, and WGRAD. The test generates
large tensor/offset/reduction cases, compares cuDNN execution against a PyTorch
float32 reference, and skips generated graphs when cuDNN reports no supported
engine configuration for the current architecture.

FPROP and WGRAD target C*R*S > 2^27 boundary coverage when the per-worker
memory budget permits. DGRAD still exercises large tensors and filters, but
uses a conservative runtime bound rather than claiming the same reduction
boundary.

The fuzzer includes configurable L0/L1 testcase counts, a per-case work cap to
avoid pathological long-running generated problems, exact configuration JSON
emission for failures, and data policies for very large reductions that keep
reference comparisons stable while still exercising large tensor shapes.
Integer-policy comparisons use fixed dtype-specific bounds, while dense-random
comparisons scale with each operation's effective reduction depth. Developer
diagnostics can restrict generation to one operation and optionally select one
or more public graph engine indices for that operation.

Operation selection happens before shape-generation retries so budget
rejections do not skew FPROP, DGRAD, and WGRAD coverage. Output tensors are
prefilled with NaNs so incomplete writes fail comparison.

Why

Large tensor convolution shapes can expose backend and frontend issues that are
not covered by smaller deterministic tests. This adds reproducible fuzz coverage
for those cases.

The generator bounds runtime with a work cap, uses deterministic seeds, emits
copy-pasteable repro context, and treats unsupported generated graphs as skips
instead of hard failures. GPU allocation failures are reported separately as
insufficient-memory skips with configuration and lifecycle-phase context.

Related issues

None.

API and compatibility impact

None. This adds a Python test file only and does not change public frontend APIs
or compatibility behavior.

Testing

The latest default-count validation used four pytest workers:

CUDNN_FUZZ_NUM_TESTS_L0=64 \
CUDNN_FUZZ_NUM_TESTS_L1=448 \
CUDNN_FUZZ_RUNTIME_WORK_BUDGET=1e14 \
python -m pytest test/python/test_conv_large_tensor_fuzzer.py \
  -o addopts= -m "L0 or L1" -n 4 --tb=short --durations=20 -ra

The runs used a local development build of the cuDNN backend.

Architecture Result Runtime
SM90 447 passed, 65 skipped 1218.80s (0:20:18)
SM100 447 passed, 65 skipped 2010.97s (0:33:30)

Both runs completed without numeric or execution failures. The skipped cases
were generated graphs unsupported on the corresponding architecture.

Developer configuration is exposed through these environment variables:

Variable Accepted value and behavior
CUDNN_FUZZ_NUM_TESTS_L0 Positive integer L0 testcase count; default 64.
CUDNN_FUZZ_NUM_TESTS_L1 Positive integer L1 testcase count; default 448.
CUDNN_FUZZ_RUNTIME_WORK_BUDGET Positive numeric per-case runtime-work cap; default 1e14.
CUDNN_FUZZ_ENGINE_OP Restrict generation to fprop, dgrad, or wgrad; aliases fp, dg, and wg are accepted. It can be used without an engine index.
CUDNN_FUZZ_GRAPH_ENGINE_INDICES Unique comma-separated public graph engine indices for the selected operation. Requires CUDNN_FUZZ_ENGINE_OP; each index is validated against the generated graph and one is selected deterministically per testcase.
CUDNN_FUZZ_REGEN_ON_UNSUPPORTED With an operation and engine indices, retry generated configs that do not support the selected engine. Accepted true values are 1, true, yes, and on; false values are 0, false, no, off, or empty. Other values fail during collection.
CUDNN_FUZZ_REGEN_ATTEMPTS Integer regeneration-attempt cap; default 50 and effective minimum 1.
CUDNN_FUZZ_REPRO_CONFIG Inline emitted configuration JSON for test_conv_large_tensor_repro. Takes precedence over CUDNN_FUZZ_REPRO_FILE.
CUDNN_FUZZ_REPRO_FILE Path to emitted configuration JSON for test_conv_large_tensor_repro.

Standard pytest controls remain available, including -m "L0 or L1",
-n <workers>, and -k test_conv_large_tensor_repro.

Focused repro validation:

  • Inline and file-based repro configurations passed on both architectures; the
    inline configuration took precedence when both were set.
  • Malformed repro JSON failed with a clear parser error.
  • Marker-filtered L0/L1 runs excluded the unmarked manual repro test.
  • Representative integer-policy FPROP, DGRAD, and WGRAD repros passed on both
    architectures.

Focused engine-filter and argument validation:

  • Operation-only filtering with a non-default work cap passed on both
    architectures.
  • Public graph engine index 0 executed successfully for FPROP, DGRAD, and
    WGRAD on both architectures.
  • A comma-separated 0,1 FPROP engine list executed successfully on both
    architectures.
  • Missing operation selectors, duplicate or out-of-range indices, invalid
    operations/counts/work budgets/regeneration limits, regeneration without
    indices, and all produced the expected diagnostics.

Notes:

  • Runtime depends on GPU architecture, cuDNN plan selection, pytest worker
    count, and selected testcase counts.
  • Unsupported generated graphs are skipped when cuDNN has no valid engine
    configuration for the current architecture.

Summary by CodeRabbit

Summary

  • Tests
    • Added large-tensor cuDNN convolution regression/fuzz coverage for 2D and 3D across forward, data-gradient, and weight-gradient.
    • Introduced two configurable randomized test tiers with engine/op selection, optional regeneration, and work/memory budgets.
    • Added deterministic failure repro support with detailed shape/config context and computed tolerance information.
    • Improved handling of unsupported or insufficient-resource scenarios by skipping appropriately; unexpected runtime errors still fail.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a configurable large-tensor cuDNN convolution fuzzer for forward, data-gradient, and filter-gradient operations, with generated configurations, PyTorch references, engine filtering, workspace poisoning, repro payloads, regeneration, and L0/L1 pytest tiers.

Changes

Large-tensor convolution regression testing

Layer / File(s) Summary
Configuration and input generation
test/python/test_conv_large_tensor_fuzzer.py
Defines convolution contracts, environment controls, data policies, tolerances, shape generation, workload filtering, and deterministic tensor initialization.
Reproducible failure payloads
test/python/test_conv_large_tensor_fuzzer.py
Serializes configurations, loads inline or file-based repros, records execution metadata, builds repro commands, and formats bounded failure context.
Reference and cuDNN execution
test/python/test_conv_large_tensor_fuzzer.py
Computes float32 PyTorch references, executes cuDNN graphs with optional engine selection and workspace poisoning, compares outputs, and classifies execution results.
Regeneration and tiered test entry points
test/python/test_conv_large_tensor_fuzzer.py
Retries unsupported generated configurations, skips unavailable cases, pre-generates L0/L1 parameters, and adds exact-repro plus randomized pytest tests.

Estimated code review effort: 5 (Critical) | ~90 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Pytest
  participant Runner as _run_single_config
  participant Reference as PyTorch reference
  participant CuDNN as cudnn.pygraph
  participant GPU as CUDA tensors
  Pytest->>Runner: execute LargeTensorConfig
  Runner->>Reference: compute float32 convolution reference
  Runner->>GPU: transfer initialized inputs
  Runner->>CuDNN: build and execute convolution graph
  CuDNN->>GPU: write convolution result
  Runner->>Runner: compare result with reference
Loading

Suggested labels: cat-enhancements

Suggested reviewers: anerudhan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the addition of a large-tensor convolution fuzzer.
Description check ✅ Passed The description covers the required sections and provides detailed testing information, but it does not confirm that repository labels were added.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/python/test_conv_large_tensor_fuzzer.py`:
- Around line 452-476: Update _tolerances to derive accum from
_effective_reduction_size(cfg) rather than always using cfg.c multiplied by
filter_spatial, while preserving the existing tolerance formulas and bounds.
Ensure the effective size is capped by the applicable sparse nonzero count, and
extend the related tests to validate tolerance policies for sparse FPROP, DGRAD,
and WGRAD cases.
- Around line 376-390: Update _estimate_work_flops so the DGRAD branch
calculates work from output_spatial, matching the convolution contribution count
used by FPROP/WGRAD, while retaining the existing batch, channel, filter, and
spatial factors needed for C*R*S coverage. Remove the input_spatial factor from
DGRAD to avoid overestimating valid cases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d3a1713a-cb6c-4828-bdea-d66440134550

📥 Commits

Reviewing files that changed from the base of the PR and between 1085001 and 41d53c1.

📒 Files selected for processing (1)
  • test/python/test_conv_large_tensor_fuzzer.py

Comment thread test/python/test_conv_large_tensor_fuzzer.py Outdated
Comment thread test/python/test_conv_large_tensor_fuzzer.py
@msalasooNV
msalasooNV force-pushed the msalasoo/conv-large-tensor-fuzzer branch from f0a3001 to 0d489d8 Compare July 24, 2026 03:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/python/test_conv_large_tensor_fuzzer.py`:
- Around line 1419-1431: Mark the test_conv_large_tensor_repro test with an
appropriate L0–L4 pytest level marker, consistent with its fast-skip behavior
when repro configuration environment variables are unset, so it participates in
marker-filtered runs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d12ebe82-e3b3-4eed-95ef-20b7d23fb6b6

📥 Commits

Reviewing files that changed from the base of the PR and between f0a3001 and 0d489d8.

📒 Files selected for processing (1)
  • test/python/test_conv_large_tensor_fuzzer.py

Comment thread test/python/test_conv_large_tensor_fuzzer.py
@Anerudhan Anerudhan added mod-backend cuDNN backend API, graph execution, descriptors, engines, or backend integration. cat-ci CI failures, test flakiness, workflow breakage, or automation issues. orig-nv-eng Reported or requested by NVIDIA engineering. labels Jul 27, 2026
@Anerudhan Anerudhan added this to the Frontend 1.27.0 milestone Jul 27, 2026
@Anerudhan

Copy link
Copy Markdown
Collaborator

@cudnn-ci-bot run

@cudnn-ci-bot

Copy link
Copy Markdown

🚀 Running mirror pipeline

Branch: cudnn-gh/pr-401-0d489d8
Pipeline: 59805257

Comment thread test/python/test_conv_large_tensor_fuzzer.py
Comment thread test/python/test_conv_large_tensor_fuzzer.py
Comment thread test/python/test_conv_large_tensor_fuzzer.py Outdated
Comment thread test/python/test_conv_large_tensor_fuzzer.py
Comment thread test/python/test_conv_large_tensor_fuzzer.py Outdated
Comment thread test/python/test_conv_large_tensor_fuzzer.py Outdated
Document why regeneration replays the candidate stream from config_seed. Reuse collection-time engine-filter constants during execution and repro reporting instead of rereading environment variables. Raise a descriptive error for unsupported tensor dtypes.
Use Counter to report every duplicate graph engine index in one diagnostic. Use random.choices to generate sparse filter signs, intentionally changing the seeded sparse-filter stream.
Run 64 L0 cases and 448 L1 cases by default while preserving environment overrides for local and downstream tuning.
@msalasooNV
msalasooNV force-pushed the msalasoo/conv-large-tensor-fuzzer branch from 9dbe563 to 6968ded Compare July 30, 2026 18:59
Rename the runtime-work budget, qualify reduction coverage, and separate config-generation retries from engine-regeneration attempts.
Validate kernel knobs and repro JSON, skip without a cuDNN handle, and budget each worker from PyTorch's active CUDA device.
Choose each testcase's operation before shape-generation retries so budget rejections cannot skew FPROP, DGRAD, and WGRAD coverage.
Use a 3e-2 base absolute coefficient for FPROP and 1.5e-2 for DGRAD/WGRAD
@Anerudhan
Anerudhan merged commit 6b5c659 into NVIDIA:develop Aug 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat-ci CI failures, test flakiness, workflow breakage, or automation issues. mod-backend cuDNN backend API, graph execution, descriptors, engines, or backend integration. orig-nv-eng Reported or requested by NVIDIA engineering.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants