Repository navigation
Conversation
The generated GraphSolver and the Caspar runtime ignored the results of CUDA runtime calls, CUB calls, runtime kernel launches, and the StackedToCaspar/CasparToStacked mappings. A failed cudaMalloc, for example, left the solver with invalid device pointers: the following kernels then failed with a sticky cudaErrorIllegalAddress that broke every later solve in the process, and host read-backs silently returned zeros. Add CASPAR_CUDA_CHECK in solver_tools.h, which throws a std::runtime_error naming the failed expression, its location, and the CUDA error, and use it for all such calls in the solver, the runtime, and the Python mapping bindings. finish_indices() and solve() also synchronize and check for errors before returning. Return early on empty inputs from the runtime functions and mappings that launch kernels, which would otherwise launch zero blocks and fail the new checks. Signed-off-by: Paul-Edouard Sarlin <psarlin@google.com>
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.
Stacked on #3.
The generated
GraphSolverand the Caspar runtime ignored the results of CUDA runtime calls, CUB calls, runtime kernel launches, and theStackedToCaspar/CasparToStackedmappings. A failedcudaMalloc, for example, left the solver with invalid device pointers: later kernels then failed with a stickycudaErrorIllegalAddressthat broke every subsequent solve in the process, and host read-backs silently returned zeros.CASPAR_CUDA_CHECKinsolver_tools.h. It throws astd::runtime_errornaming the failed expression, its location, and the CUDA error, and is used for all such calls in the solver template, the runtime sources, and the Python mapping bindings.finish_indices()andsolve()synchronize and check for errors before returning.This complements the per-kernel launch check that upstream added in
kernel.cu.jinja(dc269a3), which is left untouched.Test plan
caspar_solver_cuda_test.cc: an allocation that cannot succeed throws with the CUDA error name, leaves no pending CUDA error, and a later solve still works; an empty problem runs through index setup, solve, and read-back without error.symforce_caspar_codegen_test.pyand the Caspar CUDA tests pass (nvcc, A100).g++ -fsyntax-onlyon a generatedpybinding.cc); no test builds the bindings.