Add large-tensor convolution fuzzer - #401
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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. ChangesLarge-tensor convolution regression testing
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
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
test/python/test_conv_large_tensor_fuzzer.py
f0a3001 to
0d489d8
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
test/python/test_conv_large_tensor_fuzzer.py
|
@cudnn-ci-bot run |
|
🚀 Running mirror pipeline Branch: cudnn-gh/pr-401-0d489d8 |
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.
9dbe563 to
6968ded
Compare
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
Before submitting
pre-commit runand committed any formatting changes.Affected area
Summary
Adds
test/python/test_conv_large_tensor_fuzzer.py, a deterministic Pythonlarge-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^27boundary coverage when the per-workermemory 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 -raThe runs used a local development build of the cuDNN backend.
447 passed,65 skipped1218.80s (0:20:18)447 passed,65 skipped2010.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:
CUDNN_FUZZ_NUM_TESTS_L064.CUDNN_FUZZ_NUM_TESTS_L1448.CUDNN_FUZZ_RUNTIME_WORK_BUDGET1e14.CUDNN_FUZZ_ENGINE_OPfprop,dgrad, orwgrad; aliasesfp,dg, andwgare accepted. It can be used without an engine index.CUDNN_FUZZ_GRAPH_ENGINE_INDICESCUDNN_FUZZ_ENGINE_OP; each index is validated against the generated graph and one is selected deterministically per testcase.CUDNN_FUZZ_REGEN_ON_UNSUPPORTED1,true,yes, andon; false values are0,false,no,off, or empty. Other values fail during collection.CUDNN_FUZZ_REGEN_ATTEMPTS50and effective minimum1.CUDNN_FUZZ_REPRO_CONFIGtest_conv_large_tensor_repro. Takes precedence overCUDNN_FUZZ_REPRO_FILE.CUDNN_FUZZ_REPRO_FILEtest_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 configuration took precedence when both were set.
architectures.
Focused engine-filter and argument validation:
architectures.
0executed successfully for FPROP, DGRAD, andWGRAD on both architectures.
0,1FPROP engine list executed successfully on botharchitectures.
operations/counts/work budgets/regeneration limits, regeneration without
indices, and all produced the expected diagnostics.
Notes:
count, and selected testcase counts.
configuration for the current architecture.
Summary by CodeRabbit
Summary