Repository navigation
Fix undersized reduction workspac - #115
Open
LucasBoTang wants to merge 1 commit into
Open
LucasBoTang wants to merge 1 commit into
LucasBoTang wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On Windows with CUDA 13.4,
test_time_limitfails insidecub::DeviceReduce::Max:Cause
This regression was introduced by #112, which added these CUB reductions and their shared workspace. The workspace size comes from asking CUB what a plain
double *reduction over the longest vector needs. The real reductions use lambdas instead, and CUB's requirement depends on the kernel it builds for each lambda.On the
test_time_limitproblem, the workspace is 13,823 bytes. Every reduction fits except the six second-round infeasibility maxima,|A||d|and|A^T||y|for three candidates, which need 20,479 bytes each. The second round runs only when a candidate passes its objective-margin test, so most solves never reach it.Fix
Each group of reductions now takes a
required_bytesargument. WithNULLit runs as before. With a pointer it only asks CUB for its size and raises*required_bytesto it.At startup the solver queries every group this way, including those that may never run, and then allocates the workspace once. Planning and execution call the same functions, so CUB sees the same lambdas.
This PR also adds
test_reduce_workspace, and CMake now builds.cutests as HIP sources whenUSE_HIPis on.Reproduction
Windows 11, MSVC 19.44, conda-forge CUDA 13.4.92, RTX 5080. Run this in an x64 MSVC developer shell with the conda environment active:
/Zc:preprocessoris needed until #113 is merged. CUDA is initialized first so that the startup race fixed in #114 does not hide this error.On
724894ethe test fails with the error above. With this PR it passes.Validation
test_reduce_workspace,test_time_limitand all 107 Python tests passed, with CUDA initialized first.test_reduce_workspaceandtest_interfacepassed.