Repository navigation
fix(coverage): fix CUDA graph test timeouts in Windows coverage CI #3199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
3a582c9
ci: run coverage pytest on main thread with larger stack
rluo8 9a73fa8
ci: keep manual PR coverage runs from deploying
rluo8 c985716
Merge remote-tracking branch 'upstream/main' into fix/coverage-graph-…
rluo8 05cfa54
ci: fix Windows coverage test stacks
rluo8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| param( | ||
| [Parameter(Mandatory = $true)] | ||
| [string]$Executable, | ||
|
|
||
| [Parameter(Mandatory = $true)] | ||
| [UInt64]$ReserveBytes | ||
| ) | ||
|
|
||
| $ErrorActionPreference = "Stop" | ||
|
|
||
| if (-not $env:RUNNER_TEMP) { | ||
| throw "RUNNER_TEMP is required" | ||
| } | ||
| $path = [IO.Path]::GetFullPath($Executable) | ||
| $installRoot = [IO.Path]::GetFullPath((Join-Path $env:RUNNER_TEMP "setup-hardened-python/interpreters")) | ||
| if (-not $path.StartsWith($installRoot + [IO.Path]::DirectorySeparatorChar, [StringComparison]::OrdinalIgnoreCase)) { | ||
| throw "Refusing to modify Python outside $installRoot`: $path" | ||
| } | ||
|
|
||
| $image = [IO.File]::ReadAllBytes($path) | ||
| if ($image.Length -lt 64 -or $image[0] -ne 0x4d -or $image[1] -ne 0x5a) { | ||
| throw "Not a PE executable: $path" | ||
| } | ||
| $peOffset = [BitConverter]::ToInt32($image, 0x3c) | ||
| if ($peOffset -lt 64 -or $peOffset -gt $image.Length - 24 -or | ||
| $image[$peOffset] -ne 0x50 -or $image[$peOffset + 1] -ne 0x45 -or | ||
| $image[$peOffset + 2] -ne 0 -or $image[$peOffset + 3] -ne 0) { | ||
| throw "Invalid PE header: $path" | ||
| } | ||
| $optionalOffset = $peOffset + 24 | ||
| $optionalSize = [BitConverter]::ToUInt16($image, $peOffset + 20) | ||
| if ($optionalSize -lt 2 -or $optionalOffset + $optionalSize -gt $image.Length) { | ||
| throw "Truncated PE optional header: $path" | ||
| } | ||
| $magic = [BitConverter]::ToUInt16($image, $optionalOffset) | ||
| if ($magic -eq 0x20b) { | ||
| $width = 8 | ||
| } elseif ($magic -eq 0x10b) { | ||
| $width = 4 | ||
| if ($ReserveBytes -gt [UInt32]::MaxValue) { | ||
| throw "Stack reserve is too large for a 32-bit PE executable" | ||
| } | ||
| } else { | ||
| throw "Unsupported PE optional header: $magic" | ||
| } | ||
| if ($optionalSize -lt 72 + $width) { | ||
| throw "PE optional header does not contain a stack reserve: $path" | ||
| } | ||
|
|
||
| $reserveOffset = $optionalOffset + 72 | ||
| $current = if ($width -eq 8) { | ||
| [BitConverter]::ToUInt64($image, $reserveOffset) | ||
| } else { | ||
| [BitConverter]::ToUInt32($image, $reserveOffset) | ||
| } | ||
| if ($current -lt $ReserveBytes) { | ||
| $replacement = if ($width -eq 8) { | ||
| [BitConverter]::GetBytes($ReserveBytes) | ||
| } else { | ||
| [BitConverter]::GetBytes([UInt32]$ReserveBytes) | ||
| } | ||
| $stream = [IO.File]::Open($path, [IO.FileMode]::Open, [IO.FileAccess]::ReadWrite, [IO.FileShare]::None) | ||
| try { | ||
| $stream.Position = $reserveOffset | ||
| $stream.Write($replacement, 0, $width) | ||
| $stream.Flush() | ||
| } finally { | ||
| $stream.Dispose() | ||
| } | ||
| } | ||
|
|
||
| $updated = [IO.File]::ReadAllBytes($path) | ||
| $actual = if ($width -eq 8) { | ||
| [BitConverter]::ToUInt64($updated, $reserveOffset) | ||
| } else { | ||
| [BitConverter]::ToUInt32($updated, $reserveOffset) | ||
| } | ||
| if ($actual -lt $ReserveBytes) { | ||
| throw "Stack reserve verification failed: $actual < $ReserveBytes" | ||
| } | ||
| Write-Output "[stack-reserve] $path`: $current -> $actual bytes" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: NVIDIA/cuda-python
Length of output: 5595
🌐 Web query:
official Python documentation resource.setrlimit ValueError soft limit exceeds hard limit💡 Result:
suggestion: Reject requests above the hard limit.
resource.setrlimitraisesValueErrorwhen the requested soft limit exceeds a finite hard limit. Silently clamping would violate the wrapper's contract because it would not provide the requested stack.📝 Committable suggestion