Skip to content

Update documentation guide for ONNX INT4 PTQ on Windows cuda13 host - #2022

Merged
vishalpandya1990 merged 1 commit into
mainfrom
vipandya/modelopt_windows_cuda13_1
Jul 28, 2026
Merged

Update documentation guide for ONNX INT4 PTQ on Windows cuda13 host#2022
vishalpandya1990 merged 1 commit into
mainfrom
vipandya/modelopt_windows_cuda13_1

Conversation

@vishalpandya1990

@vishalpandya1990 vishalpandya1990 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: Documentation update

  • Update documentation guide for ONNX INT4 PTQ on Windows cuda13 host - mention about compatible onnxruntim-gpu and cupy-cuda13x packages.

Testing

  • Windows's onnx_ptq\genai_llm INT4 PTQ example with a 1B genai-cuda-ep ONNX model + local doc building

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: ✅ / ❌ / N/A
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: ✅ / ❌ / N/A
  • Did you write any new necessary tests?: ✅ / ❌ / N/A
  • Did you update Changelog?: ✅ / ❌ / N/A
  • Did you get Claude approval on this PR?: ✅ / ❌ / N/A

Additional Information

Summary by CodeRabbit

  • Documentation

    • Clarified Windows CUDA prerequisites for calibration and GPU-accelerated quantization.
    • Added setup guidance for CUDA 12 and CUDA 13.x, including compatible packages and cuDNN requirements.
    • Expanded installation verification steps for CUDA, ONNX Runtime, and CuPy.
    • Updated the GenAI LLM example with CUDA version compatibility guidance.
  • Enhancements

    • Added runtime logging of detected CUDA environment paths and version details during quantization.

Signed-off-by: vipandya <vipandya@nvidia.com>
@vishalpandya1990
vishalpandya1990 requested review from a team as code owners July 27, 2026 13:30
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

The Windows installation guide now documents CUDA 12 and CUDA 13 quantization setup and verification. The GenAI LLM example adds CUDA package guidance and logs the configured CUDA path with torch runtime details.

Windows CUDA guidance

Layer / File(s) Summary
CUDA installation and verification
docs/source/getting_started/windows/_installation_standalone.rst
Prerequisites, CUDA 12/13 package instructions, cuDNN requirements, toolkit selection checks, provider checks, and CuPy GPU validation are updated.
GenAI example CUDA diagnostics
examples/windows/onnx_ptq/genai_llm/README.md, examples/windows/onnx_ptq/genai_llm/quantize.py
The setup note describes CUDA package variants, and startup diagnostics report CUDA path, torch version, and CUDA availability metadata.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: aanoosheh, achidiac-nv, ajrasane

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: updating the Windows ONNX INT4 PTQ documentation for CUDA 13 hosts.
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.
Security Anti-Patterns ✅ Passed PASS: The diff only adds CUDA env/version logging and docs; no new torch.load/np.load, hardcoded trust_remote_code, eval/exec, # nosec, or dependency changes.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch vipandya/modelopt_windows_cuda13_1

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

@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-28 06:13 UTC

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.64%. Comparing base (33d05b0) to head (3d8973b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2022      +/-   ##
==========================================
- Coverage   66.83%   66.64%   -0.19%     
==========================================
  Files         519      519              
  Lines       58916    58916              
==========================================
- Hits        39376    39266     -110     
- Misses      19540    19650     +110     
Flag Coverage Δ
examples 43.18% <ø> (-0.20%) ⬇️
unit 54.88% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 3

🤖 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 `@docs/source/getting_started/windows/_installation_standalone.rst`:
- Around line 87-89: Remove the unmatched closing parenthesis at the end of the
sentence describing CUDA environment variables, so it ends with “installation.”
while preserving the rest of the installation guidance.
- Around line 108-112: Update the ONNX Runtime verification command in the ONNX
and ONNX Runtime installation section to explicitly validate that
CUDAExecutionProvider is present in ort.get_available_providers(), causing the
command to fail when CUDA support is unavailable while still reporting the
version and providers.

In `@examples/windows/onnx_ptq/genai_llm/quantize.py`:
- Around line 315-320: Update the CUDA diagnostic variable resolution in the
quantization script to also check the versioned CUDA environment variables
supported by the installation guide, including CUDA_PATH_V12_x and
CUDA_PATH_V13_x. Preserve the existing CUDA_PATH and CUDA_HOME fallback order,
and report the first available configured toolkit path instead of “N/A”.
🪄 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: 43729e0d-dab6-4ef7-97b6-7b6994a091b3

📥 Commits

Reviewing files that changed from the base of the PR and between 33d05b0 and 3d8973b.

📒 Files selected for processing (3)
  • docs/source/getting_started/windows/_installation_standalone.rst
  • examples/windows/onnx_ptq/genai_llm/README.md
  • examples/windows/onnx_ptq/genai_llm/quantize.py

Comment on lines +87 to +89
Make sure a cuDNN 9 build for CUDA 13 is available on the host (for example, via the
NVIDIA Windows installer/zip package, or the ``nvidia-cudnn-cu13`` Python wheel), and
that the relevant environment variables like ``CUDA_PATH``, ``CUDA_HOME``, and ``PATH`` point to the CUDA 13.x installation).

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the unmatched closing parenthesis.

The sentence ends with installation). without a matching opening parenthesis.

🤖 Prompt for 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.

In `@docs/source/getting_started/windows/_installation_standalone.rst` around
lines 87 - 89, Remove the unmatched closing parenthesis at the end of the
sentence describing CUDA environment variables, so it ends with “installation.”
while preserving the rest of the installation guidance.

Comment on lines +108 to +112
- **ONNX and ONNX Runtime**: Ensure that imports succeed and that CUDA EP is available for CUDA workflows:

.. code-block:: python

python -c "import onnx; import onnxruntime as ort; print(ort.__version__, ort.get_available_providers())"

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Make the CUDA EP check fail when CUDA is unavailable.

The command only prints providers, so it exits successfully even when CUDAExecutionProvider is missing. Add an assertion or explicit check for CUDA workflows. ONNX Runtime documents CUDAExecutionProvider as the CUDA backend. (onnxruntime.ai)

Proposed fix
-                python -c "import onnx; import onnxruntime as ort; print(ort.__version__, ort.get_available_providers())"
+                python -c "import onnx; import onnxruntime as ort; providers=ort.get_available_providers(); assert 'CUDAExecutionProvider' in providers, providers; print(ort.__version__, providers)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- **ONNX and ONNX Runtime**: Ensure that imports succeed and that CUDA EP is available for CUDA workflows:
.. code-block:: python
python -c "import onnx; import onnxruntime as ort; print(ort.__version__, ort.get_available_providers())"
- **ONNX and ONNX Runtime**: Ensure that imports succeed and that CUDA EP is available for CUDA workflows:
.. code-block:: python
python -c "import onnx; import onnxruntime as ort; providers=ort.get_available_providers(); assert 'CUDAExecutionProvider' in providers, providers; print(ort.__version__, providers)"
🤖 Prompt for 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.

In `@docs/source/getting_started/windows/_installation_standalone.rst` around
lines 108 - 112, Update the ONNX Runtime verification command in the ONNX and
ONNX Runtime installation section to explicitly validate that
CUDAExecutionProvider is present in ort.get_available_providers(), causing the
command to fail when CUDA support is unavailable while still reporting the
version and providers.

Comment on lines +315 to +320
cuda_path = os.environ.get("CUDA_PATH") or os.environ.get("CUDA_HOME") or "N/A"
print(
f"\n--Quantize-Script-- torch={torch.__version__}, "
f"torch.version.cuda={torch.version.cuda}, "
f"torch.cuda.is_available={torch.cuda.is_available()}, "
f"CUDA_PATH={cuda_path}\n"

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Resolve the same CUDA variables documented by the installation guide.

The guide permits CUDA_PATH_V12_x/CUDA_PATH_V13_x, but this diagnostic only reads CUDA_PATH and CUDA_HOME. On hosts where only the versioned variable is set, it reports N/A and misrepresents the selected toolkit.

Proposed fix
-    cuda_path = os.environ.get("CUDA_PATH") or os.environ.get("CUDA_HOME") or "N/A"
+    cuda_path = (
+        os.environ.get("CUDA_PATH")
+        or os.environ.get("CUDA_HOME")
+        or next(
+            (
+                value
+                for key, value in sorted(os.environ.items())
+                if key.startswith(("CUDA_PATH_V12_", "CUDA_PATH_V13_")) and value
+            ),
+            "N/A",
+        )
+    )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cuda_path = os.environ.get("CUDA_PATH") or os.environ.get("CUDA_HOME") or "N/A"
print(
f"\n--Quantize-Script-- torch={torch.__version__}, "
f"torch.version.cuda={torch.version.cuda}, "
f"torch.cuda.is_available={torch.cuda.is_available()}, "
f"CUDA_PATH={cuda_path}\n"
cuda_path = (
os.environ.get("CUDA_PATH")
or os.environ.get("CUDA_HOME")
or next(
(
value
for key, value in sorted(os.environ.items())
if key.startswith(("CUDA_PATH_V12_", "CUDA_PATH_V13_")) and value
),
"N/A",
)
)
print(
f"\n--Quantize-Script-- torch={torch.__version__}, "
f"torch.version.cuda={torch.version.cuda}, "
f"torch.cuda.is_available={torch.cuda.is_available()}, "
f"CUDA_PATH={cuda_path}\n"
🤖 Prompt for 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.

In `@examples/windows/onnx_ptq/genai_llm/quantize.py` around lines 315 - 320,
Update the CUDA diagnostic variable resolution in the quantization script to
also check the versioned CUDA environment variables supported by the
installation guide, including CUDA_PATH_V12_x and CUDA_PATH_V13_x. Preserve the
existing CUDA_PATH and CUDA_HOME fallback order, and report the first available
configured toolkit path instead of “N/A”.

@vishalpandya1990
vishalpandya1990 merged commit 87c9f8c into main Jul 28, 2026
72 of 76 checks passed
@vishalpandya1990
vishalpandya1990 deleted the vipandya/modelopt_windows_cuda13_1 branch July 28, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants