cuDSS 1.0.0: silent wrong answers in multi-RHS dense solve and RHS pointer handling (Windows)

Date of (re)verification: 2026-11-02
Library under test: cuDSS 1.0.0 GA (released 2026-10-21), pip wheel nvidia-cudss-cu13 1.0.0.35, DLL cudss64_1.dll (still the latest available wheel as of 2026-11-02)
First discovered: 2026-10-31 / 2026-11-01 (same library version)
Hardware/OS: Windows 11 x64, NVIDIA GeForce RTX 5070 Laptop 8GB (Blackwell); CUDA 13 runtime components from pip wheels
Calling path: Python ctypes → C API (no nvmath-python, which targets the 0.x API and does not match 1.0.0)

Executive summary

Two bugs and one diagnostic gap were found while exercising cuDSS 1.0.0 with multi-RHS sparse solves and dense Schur-complement assembly. Both bugs are silent: cudssExecute returns CUDSS_STATUS_SUCCESS while the solution is wrong. None of them appears in the release notes of any version from 0.1.0 through 1.0.0. All reproducers below use only matrices that can be rebuilt from a few lines of code (recipes given); no proprietary data is involved.

# Issue Affected path Severity
1 Multi-column dense solve writes wrong column stride (non-zero rows = n/nrhs) cudssMatrixCreateDn with nrhs > 1 High — any multi-RHS solve
2 RHS pointer at the start of a large buffer → wrong solution solve phase, RHS pointer handling High
3 Exact zero diagonal + SPD type declaration → silent NaN garbage, status SUCCESS SPD path input diagnostics Medium — silent wrong answer on invalid input

A fourth issue (SPD-type solves on 7-point Poisson matrices) was investigated and withdrawn: it was caused by our own input error (a symmetric-format MatrixMarket file was passed as a full matrix). See the withdrawn-finding note at the end.

Environment and calling conventions

  • Python 3.12, ctypes bindings with full argtypes (64-bit ints for dimensions/ld, ctypes.c_void_p for device pointers).
  • CUDA 13 wheel bundle: cudss64_1.dll + x86_64/cublas64_13.dll, cudart64_12.dll, nvrtc64_130_0.dll (load dirs added via os.add_dll_directory).
  • CSR input: 3-array form — cudssMatrixCreateCsr(m, nrows, ncols, nnz, rowStart, NULL, colIndices, values, CUDA_R_32I, CUDA_R_32I, CUDA_R_64F, <mtype>, CUDSS_MVIEW_FULL, CUDSS_INDEX_BASE_ZERO); rowStart is a full nrows+1 offset array, colIndices 0-based.
  • Dense x/b: cudssMatrixCreateDn(m, nrows, ncols, ld, values, /*memType*/ 1, /*layout*/ CUDSS_LAYOUT_COL_MAJOR), ld = nrows (column-major, no padding). This matches the documented convention; single-RHS solves with these exact conventions are correct to machine precision.
  • Phase order: cudssExecute(h, 1 /*reordering*/, ...) → cudssExecute(h, 2 /*symbolic*/, ...) → cudssExecute(h, 4 /*factorization*/, ..., NULL, NULL) → cudssExecute(h, 1008 /*solve*/, ..., x, b). (solve semantics: 5th argument = solution output, 6th = RHS input.)
  • Config: defaults (matching = AUTO, reordering = NESTED_DISSECTION), except where noted. All solves synchronized with cuda.synchronize().

Reference solutions are computed with NumPy linalg.solve on the dense reassembly of the same CSR input.

Bug 1 — Multi-column dense solve: wrong column stride

Signature symptom. For an n×m solve with m > 1, exactly n/m rows of the solution matrix are non-zero, and the values are wrong (relative error 1.6). Status: SUCCESS.

Reproducer.

Matrix recipe (rebuildable, ~15 lines of NumPy): standard 7-point 3-D Laplacian (diagonal 6, off-diagonal −1 on the 6 grid neighbors) on a 17×17×17 grid, then remove one corner node (Dirichlet elimination). Result: n = 4912 unknowns, 32650 nnz, SPD, stored in general (full) MatrixMarket format.

RHS: m = 8, the first 8 columns of the identity. One cudssMatrixCreateDn pair with ncols = 8, ld = n = 4912, column-major. Factor once, solve once.

Result (2026-11-02, cuDSS 1.0.0.35):

solve rc = SUCCESS
||Y - K^{-1}B|| / ||K^{-1}B|| = 1.613e+00
nonzero rows = 614 / 4912   (= n / m = 4912 / 8)

The same solve with m = 1 is correct to 5.9e-15. The n/m non-zero-row pattern is the signature of the library interpreting the row stride of the dense matrices as ncols (or writing with the wrong leading dimension) so that successive columns overwrite/stride through the buffer incorrectly.

Impact. Any multi-RHS solve (ncols > 1 on cudssMatrixCreateDn) returns silently wrong results. This is the building block for Schur-complement assembly, batched inverse applications, and adjoint sensitivity solves. The release notes do not mention any fix for dense multi-RHS layouts in any version 0.1.0–1.0.0; the 0.8.0 announcement only advertises a performance improvement for “multiple right-hand sides”.

Bug 2 — RHS pointer at the start of a large buffer → wrong solution

Signature symptom. When the RHS device pointer points to the beginning of a large contiguous buffer, the solve returns SUCCESS but a wrong solution (relative error 5.6). The identical solve with the RHS in its own small allocation is correct to machine precision.

Reproducer. Same matrix and factor as Bug 1. Upload the full 8-column RHS as one 1-D device array of n·m doubles (~300 KB — the bug triggers well below megabyte scale); create a single-column RHS view (nrows = n, ncols = 1, ld = n) whose pointer is the start of that buffer; create a normal single-column solution array. Solve.

Result (2026-11-02):

solve rc = SUCCESS
||x - K^{-1}b|| / ||K^{-1}b|| = 5.612e+00
|x| = 5.710e+00   (reference |K^{-1}e_0| = 9.408e-01)

The bug depends only on the RHS pointer provenance, not on the solution buffer. This suggests the solve path performs a size/stride assumption on the RHS allocation (or an internal 2-D-aware copy) that breaks for large base buffers. For a caller that pre-uploads many columns and then issues per-column solves with column pointers (a natural CUDA-side streaming pattern), this silently corrupts results.

Additional observation — exact zero diagonal + SPD type declaration → silent NaN, status SUCCESS

Signature symptom. Declaring an SPD matrix type for a matrix with an exactly-zero diagonal entry produces NaN/Inf in the solution while cudssExecute returns SUCCESS for factorization and solve. No warning, no error code. (The input is admittedly invalid for SPD — the point is the absence of any diagnostic: a good solver should reject the input, not return SUCCESS with garbage. Declaring the same matrix as SYMMETRIC — a matching declaration — solves it correctly to 4.9e-14.)

Reproducer. n = 100 tridiagonal matrix A[i,i] = 2, A[i,i±1] = −1, with A[50,50] set to exactly 0.0. One random RHS. Declare CUDSS_MTYPE_SPD. Defaults (matching = AUTO).

Result (2026-11-02):

mtype=SPD:   rc=SUCCESS  residual = nan   |x|max = inf
mtype=SYM:   rc=SUCCESS  residual = 4.9e-14

Related public evidence: on the NVIDIA developer forum (July 2026 thread CUDSS reordering discrepancy), an NVIDIA engineer confirmed that zero diagonal entries combined with symmetric reordering “perturb pivots” and “degrade the accuracy quite badly so that iterative refinement cannot recover it,” and noted that matching would be enabled by default in a future release. v1.0.0 did make matching = AUTO the default, which fixes near-zero diagonal cases, but the exact-zero case above still silently returns garbage. Also relevant: v0.3.0 removed CUDSS_STATUS_ZERO_PIVOT from the public status enum, so no dedicated error channel exists.

Impact. Silent NaN/Inf with a success status means downstream users cannot distinguish garbage from a converged solution without an external residual check. A status code or warning for a failed factorization would convert this from a silent corruption into a recoverable error.

Withdrawn finding — SPD-type solves on 7-point Poisson matrices

During early testing we observed SPD-type solves on 27,000-unknown 7-point Poisson matrices returning residual ~7e-1 while GENERAL returned 2e-16, and suspected a bug in the SPD path. On re-examination for this report we found the cause in our own input pipeline: the test matrices were stored in MatrixMarket symmetric format (lower triangle only), but the reader did not mirror the upper triangle and the matrix was handed to cuDSS as CUDSS_MVIEW_FULL. The SPD path trusts the FULL declaration and reads the missing upper triangle (garbage); the GENERAL path happened to be unaffected. With the symmetry properly expanded (full storage), the SPD solve is correct to 3.7e-16. We withdraw this item and note it here only so that other ctypes users of symmetric-format MatrixMarket files do not repeat our mistake.

Why this report matters

  • cuDSS 1.0.0 is the first GA release (2026-10-21) and is being integrated into major simulation stacks (COMSOL 6.4 uses cuDSS as its GPU direct solver; Cadence/Siemens/Synopsys integrations are publicly announced). Silent wrong-answer modes in such a library propagate into engineering decisions.
  • We are happy to provide the full reproducer script (single-file Python, ~250 lines, ctypes only, no external deps beyond NumPy + numba-cuda) and the recipe-generated test matrices under any license NVIDIA finds convenient.

Suggested fixes / diagnostics to consider

  1. Bug 1: audit dense solve column stride handling for ncols > 1 with layout = COL_MAJOR, ld = nrows; add a CI case n×8 with identity RHS asserting machine-precision error.
  2. Bug 2: audit RHS-buffer size/stride assumptions in the solve path; reproduce with a pre-uploaded n·m buffer and a per-column view.
  3. Observation 3: return an explicit error (e.g., restore a zero-pivot status, or NOT_SUPPORTED) when the factorization fails on symmetric-type paths, instead of returning SUCCESS with NaN/Inf.

Hi! Thanks for detailed report. Although I was not able to reproduce 1 and 2 from your description. Could you please provide a reproducer that we can run on our side.

Regarding point 3. The behaviour is expected and you should check CUDSS_DATA_INFO

Best regards, Anton

Hi Anton,

Thank you for the reply and for taking the time to look at this. We have re-investigated
the report with fresh eyes, and we owe you an apology: issues 1 and 2 are caller-side
errors in our test harness, not cuDSS defects.
We withdraw both. Point 3 we confirm as
expected behaviour — CUDSS_DATA_INFO is exactly the diagnostic channel you pointed us
to, and it works as documented. Full account below, with a standalone C++ verifier
attached that reproduces our original symptoms and shows machine-precision results with
correct usage, so everything here is independently checkable.

1. What actually caused the “multi-column wrong answer” (thread issue 1)

Two independent mistakes in our Python harness:

(a) Row-major memory declared as COL_MAJOR. We allocated the RHS/solution as
np.zeros((n, 8)), which is C-order (row-major) memory, but declared
CUDSS_LAYOUT_COL_MAJOR in cudssMatrixCreateDn. For ncols = 1 the two layouts are
identical, which is why every single-column solve in the report looked correct and
“proved” the conventions were right — they were not.

(b) The RHS was not “the first 8 columns of the identity”. We built it with

B = np.zeros((n, 8))
B[:m, np.arange(m)] = 1.0

In NumPy this line does not set an 8-element diagonal. Mixing a basic slice (:m) with
an advanced index (np.arange(m)) broadcasts the scalar over all combinations, so the
entire 8x8 top-left block becomes ones (64 entries) — every one of the 8 columns was the
same 8-pulse vector, not a unit column. The corrected construction is
B[np.arange(m), np.arange(m)] = 1.0 (or np.fill_diagonal(B[:m, :m], 1.0)).

With both fixed (column-major memory, proper diagonal block), the identical solve gives:

multi-column (m = 8), column-major, ld = n:  relative error = 4.98e-17

2. What actually caused the “large buffer RHS” result (thread issue 2)

Same block-fill mistake, one step further downstream. The buffer was built with
B.flatten(), which is a C-order flatten of the 8x8 all-ones block, so its first n
elements were 64 contiguous ones (a 64-pulse vector) — not e_0. The thread compared
that solve against a reference computed from B[:,0], which was an 8-pulse vector (the
report called it e_0, but it was not e_0). The reported numbers are exactly the
difference between those two solves:

single-column view at start of the 64-pulse buffer:
        |x| = 5.710e+00,  relerr vs K^-1(8-pulse) = 5.612e+00   (thread: 5.612e+00)
        |K^-1(8-pulse)| = 9.408e-01                            (thread: 9.408e-01)

With the intended RHS (a true e_0 at the start of a 2n buffer, tail content e_1),
the same single-column view solves to:

single-column view at start of [e0; e1] buffer:  relative error = 1.77e-17

The “large vs small allocation” difference in the original report was a content
difference in disguise: the small allocation happened to hold e_0, the large one held
64 ones.

3. Point 3 (zero diagonal + SPD) — confirmed expected behaviour

cudssDataGet(handle, data, CUDSS_DATA_INFO, &info, sizeof(int), &sizeWritten) on the
n = 100 tridiagonal with A[50,50] = 0.0 gives:

mtype = SYMMETRIC:  factor/solve rc = SUCCESS, DATA_INFO = 0,  residual = 3.6e-14
mtype = SPD:        factor/solve rc = SUCCESS, DATA_INFO = 12, |x|max = inf

The DATA_INFO value is an int32. Your pointer was exactly right — the channel exists
and reports the failed factorization; we had bound cudssDataGet but never called it.
We also note that the two items from the original post that were already withdrawn
there (factor-phase binding, destroy-then-solve) re-verify clean under the corrected
layouts (1.8e-17 … 4.2e-17).

4. Reproducer

Since you asked for a reproducer: both issues are withdrawn, so instead of a bug
reproducer we are attaching a small verification program that (a) builds the exact
matrix recipe from the thread (17³ 7-point Laplacian minus one corner node,
n = 4912, nnz = 32650), (b) replays the original caller-side constructions and
reproduces the reported symptoms digit-for-digit, and (c) shows machine-precision
results with correct column-major usage, plus the DATA_INFO checks above.

cudss_verify.cpp — single file, no dependencies beyond cuDSS 1.0.0 and the CUDA
runtime. Build: nvcc cudss_verify.cpp -lcudss -lcudart (Linux) or MSVC cl /EHsc /O2
against the same headers/libs (Windows). Full output:

matrix: n = 4912, nnz = 32650

=== Test 1: multi-column dense solve (m = 8) ===
  [1a correct, column-major] rc = SUCCESS, relerr = 4.982e-17 (expect ~1e-15)
  [1b original error replay] rc = SUCCESS, relerr = 1.613e+00, nonzero rows = 614/4912
      (thread reported: relerr = 1.613e+00, nonzero rows = 614/4912)

=== Test 2: single-column view at the start of a large buffer ===
    |K^-1(pulse8)| = 9.408e-01   (thread's "reference |K^-1 e_0|" = 9.408e-01)
  [2a correct, view of [e0;e1]] rc = SUCCESS, relerr = 1.769e-17 (expect ~1e-15)
  [2b original error replay] rc = SUCCESS, relerr = 5.612e+00, |x| = 5.710e+00
      (thread reported: relerr = 5.612e+00, |x| = 5.710e+00)

=== Test 3: exact zero diagonal + SPD vs SYM (n = 100) ===
  [SYMMETRIC] factor/solve rc = SUCCESS, DATA_INFO = 0,  residual = 3.586e-14, |x|max = 1.546e+02
  [SPD      ] factor/solve rc = SUCCESS, DATA_INFO = 12, residual = -nan(ind), |x|max = inf

Also for completeness, the corrected Python constructions (in case anyone else reads
this thread with a ctypes/numpy setup):

# Correct multi-column RHS: column-major memory + real diagonal block
B = np.zeros((n, 8), order='F')            # column-major memory
np.fill_diagonal(B[:8, :8], 1.0)           # the intended 8 unit columns
# declare CUDSS_LAYOUT_COL_MAJOR, ld = n   -> machine precision

# Correct large-buffer single-column view
b0 = np.zeros(n); b0[0] = 1.0
e1 = np.zeros(n); e1[1] = 1.0
buf = np.concatenate([b0, e1])             # first n elements are exactly e0
# single-column view (nrows=n, ncols=1, ld=n, COL_MAJOR) at buf start
#                                           -> machine precision

Again, our apologies for the noise — the library behaved correctly in every case, and
our report mischaracterised both the data we fed it and the layout we declared. Thank
you for the detailed reply; it pointed us straight at the right diagnostics.
cudss_verify.txt (19.4 KB)