Skip to content

Fix uncaught ValueError in flatten_pass_by_value on malformed hex input - #343

Merged
hwanseoc merged 1 commit into
NVIDIA:developfrom
Anerudhan:fix/repro-malformed-hex-pass-by-value
Jul 9, 2026
Merged

Fix uncaught ValueError in flatten_pass_by_value on malformed hex input#343
hwanseoc merged 1 commit into
NVIDIA:developfrom
Anerudhan:fix/repro-malformed-hex-pass-by-value

Conversation

@Anerudhan

@Anerudhan Anerudhan commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

The hex branch of flatten_pass_by_value converted "0x"-prefixed strings without error handling, so malformed values such as "0x" or "0xZZ" in a log's pass_by_value field crashed the cudnn_repro CLI with an unhandled ValueError. Guard the conversion with the same try/except pattern the decimal branch already uses, returning an empty list for unparseable strings, and add regression tests.

Fixes #342

Summary by CodeRabbit

  • Bug Fixes

    • Improved parsing of numeric strings so values with a 0x prefix are handled as hexadecimal, while other strings continue to be treated as decimal.
    • Non-convertible values still safely return an empty result, preserving existing behavior.
  • Tests

    • Added coverage for valid hex and decimal inputs, malformed strings, mixed lists, and None/numeric values to verify parsing behavior across common cases.

The hex branch of flatten_pass_by_value converted "0x"-prefixed strings
without error handling, so malformed values such as "0x" or "0xZZ" in a
log's pass_by_value field crashed the cudnn_repro CLI with an unhandled
ValueError. Guard the conversion with the same try/except pattern the
decimal branch already uses, returning an empty list for unparseable
strings, and add regression tests.

Fixes NVIDIA#342

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Anerudhan Anerudhan added the cat-bug Reports of incorrect behavior, crashes, regressions, or unexpected results. label Jul 5, 2026
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b2a961a5-17b7-4214-a710-25597d59b049

📥 Commits

Reviewing files that changed from the base of the PR and between 52119ee and dea890c.

📒 Files selected for processing (2)
  • tools/cudnn_repro/cudnn_repro/utils.py
  • tools/cudnn_repro/tests/test_cudnn_repro_utils.py

📝 Walkthrough

Walkthrough

The flatten_pass_by_value function in cudnn_repro/utils.py was refactored to determine an integer base from the string prefix (0x → 16, else → 10) and perform conversion in a single guarded try/except ValueError block. A new test file was added covering valid and malformed inputs.

Changes

flatten_pass_by_value fix and tests

Layer / File(s) Summary
Guarded hex/decimal parsing
tools/cudnn_repro/cudnn_repro/utils.py
Unified hex and decimal string parsing into one try/except ValueError block, fixing an uncaught crash on malformed 0x-prefixed strings.
Unit tests for parsing behavior
tools/cudnn_repro/tests/test_cudnn_repro_utils.py
Adds seven tests covering valid hex/decimal, malformed hex/decimal, mixed lists, and None/numeric inputs.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Related issues

  • #342: Fixes uncaught ValueError in flatten_pass_by_value on malformed hex pass_by_value strings.

Suggested labels: bug, tools

Suggested reviewers: (none identified)

🐰 A hex string once made me crash,
Now caught in a try/except stash,
Base sixteen or ten,
Parsed safely again,
Tests confirm—no more traceback flash!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the malformed-hex ValueError fix in flatten_pass_by_value.
Linked Issues check ✅ Passed The code now handles malformed hex like decimal parsing and adds regression tests for 0x and 0xZZ.
Out of Scope Changes check ✅ Passed The changes stay focused on the crash fix and regression coverage; no unrelated behavior was introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@Anerudhan Anerudhan added mod-frontend cuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers. orig-nv-eng Reported or requested by NVIDIA engineering. labels Jul 5, 2026
@Anerudhan Anerudhan self-assigned this Jul 5, 2026
@Anerudhan Anerudhan added this to the Frontend 1.27.0 milestone Jul 5, 2026
@Anerudhan
Anerudhan requested a review from hwanseoc July 5, 2026 09:09
@hwanseoc
hwanseoc merged commit cb78c80 into NVIDIA:develop Jul 9, 2026
1 check passed
@Anerudhan Anerudhan mentioned this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat-bug Reports of incorrect behavior, crashes, regressions, or unexpected results. mod-frontend cuDNN frontend APIs, operation graph construction, plans, and user-facing wrappers. orig-nv-eng Reported or requested by NVIDIA engineering.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cudnn_repro CLI: uncaught ValueError in flatten_pass_by_value on malformed-hex pass_by_value (e.g. "0x")

2 participants