Skip to content

Add hipSOLVER checklist tests (geqrf, orgqr/ungqr, potrs, syevj, gesvdj) - #468

Draft
Ozone-Whiskey wants to merge 2 commits into
ROCm:developfrom
Ozone-Whiskey:hipsolver-checklist-tests
Draft

Add hipSOLVER checklist tests (geqrf, orgqr/ungqr, potrs, syevj, gesvdj)#468
Ozone-Whiskey wants to merge 2 commits into
ROCm:developfrom
Ozone-Whiskey:hipsolver-checklist-tests

Conversation

@Ozone-Whiskey

Copy link
Copy Markdown
Collaborator

Summary

Adds s/d/c/z tests for the hipSOLVER routine groups on the "most important routines to test" checklist in #411, in both the Fortran 2003 and Fortran 2008 binding tiers.

Routines covered (18 total, f2003 + f2008 each = 36 new test programs):

Group Routines
QR factorization Sgeqrf Dgeqrf Cgeqrf Zgeqrf
Generate Q Sorgqr Dorgqr Cungqr Zungqr
Cholesky solve Spotrs Dpotrs Cpotrs Zpotrs
Jacobi eigensolver Ssyevj Dsyevj
Jacobi SVD Sgesvdj Dgesvdj Cgesvdj Zgesvdj

Each routine is one commit (f2003 + f2008 pair + CMake registration).

Verification approach

Every test is self-verifying against a fixed small input, using a check robust to sign/phase/ordering ambiguity where relevant:

  • geqrf: recover R from the output and confirm AH*A = RH*R.
  • orgqr / ungqr: factorize with geqrf, generate Q, confirm Q**H*Q = I.
  • potrs: pick a known x, form b = A*x for an SPD/HPD A, factorize with potrf, solve, confirm the solution recovers x.
  • syevj: confirm Av = lambdav for each eigenpair.
  • gesvdj: reconstruct A = USV**H and compare to the input.

All use the hipSOLVER workspace pattern (_bufferSize query + explicit dWork, create/destroy handle, and syevjInfo/gesvdjInfo params objects for the Jacobi routines).

Not included (blocked)

Two hipSOLVER checklist items could not be tested and are intentionally left out:

  • ?getri — not present in the hipfort bindings at all (no hipsolver?getri interface is generated), so there is nothing to test.
  • ?potrfBatched — the generated binding declares the batched pointer-array argument A as type(c_ptr) (by reference) rather than type(c_ptr), value. The C API is T* A[] (a T** passed by value), so every call faults at the next device sync with HIP error 700. Verified against the C header and confirmed that a corrected by-value interface works. This is a generator issue and should be fixed there; the test can be added once the binding is corrected.

Notes

  • syevj/gesvdj have no generated array-pointer overload, so their f2008 tests pass device pointers via c_loc(...) to the generic interface; the other groups use the array-pointer form.
  • All 36 new tests pass on gfx90a (MI210), ROCm 7.1.0, gfortran 13.3, both binding tiers. f2003 tests also compile with the Fortran 2008 pointer-interface macro OFF.

Part of #411.

Test plan

  • Both tiers build and PASS for all 18 routines on gfx90a
  • f2003 tests compile with the Fortran 2008 pointer-interface macro OFF

@amontoison amontoison left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use .f08 extension for files in f2008/hipsolver.
Excellent work!
For the product with Q, Q', we could also check that ||C||_2 = ||op(Q) * C||_2.

…, f2003 + f2008)

Verify orthogonality/unitarity of Q by checking that applying Q to C
preserves the Frobenius norm: ||op(Q)*C||_F = ||C||_F. Q is obtained as
Householder vectors from geqrf, then applied with ormqr (real) / unmqr
(complex). Norm preservation is phase-convention independent, so no
reference matrix is required.
@Ozone-Whiskey
Ozone-Whiskey force-pushed the hipsolver-checklist-tests branch from 883fbfc to 43d4c0b Compare August 6, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants