﻿# rocSOLVER GETRF: API success and device info describe different outcomes

Handle rocSOLVER LU factorization results by checking submission status, synchronized device info and numerical validation separately before using the factors.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-rocsolver-getrf-api-status-device-info-singularity/
Language: en

## Keep the call result and the numerical result separate

A wrapper returns success after invoking LU factorization, and a later solve produces unusable values for a singular matrix. Examine whether the wrapper checked only the function's API status. That status and the numerical information produced by the algorithm serve different purposes. Preserve both in the result interface rather than compressing them into an unexplained boolean that loses the reason a computation cannot proceed as intended.

## Interpret info for the exact factorization routine

The [rocSOLVER LAPACK reference](https://rocm.docs.amd.com/projects/rocSOLVER/en/latest/reference/lapack.html) defines GETRF's device info output and the meaning of a positive zero-pivot report. Read that routine's contract rather than importing an unrelated solver's status interpretation. A matrix can have factors stored in its overwritten input while the numerical status still indicates singularity. Existing output storage therefore does not establish that a downstream nonsingular solve is valid.

## Respect where and when info becomes readable

The [official function declarations](https://raw.githubusercontent.com/ROCm/rocm-libraries/develop/projects/rocsolver/library/include/rocsolver/rocsolver-functions.h) document info as device storage. A host wrapper must retrieve its completed value through an appropriate transfer and ordering boundary. The [HIP stream-management reference](https://rocm.docs.amd.com/projects/HIP/en/latest/reference/hip_runtime_api/modules/stream_management.html) defines completion operations. Check transfer and synchronization outcomes separately, since reading a stale host copy cannot meaningfully interpret the current factorization's numerical result.

## Do not turn a zero-pivot test into an accuracy certificate

A successful numerical status means the documented failure condition was not reported; it does not quantify every aspect of numerical quality. A nearly singular system can require separate residual and conditioning analysis for the application's tolerance. Preserve the original matrix where validation needs it, because factorization overwrites its input. Comparing the output with an already overwritten input can accidentally test a different mathematical relationship from the intended reconstruction or solve.

## Exercise distinct failure paths deliberately

Use a valid nonsingular matrix, a deliberately singular matrix and an invalid API argument as separate diagnostic cases. Confirm that the wrapper distinguishes call rejection, completed numerical failure and acceptable results. The existing [stream-ordering guide](/journal/learn-stream-ordering-dependencies/) and [software reproducibility guide](/journal/software-stack-reproducibility/) provide context. An informative result preserves the exact routine, completion boundary and numerical status without promising that one success value establishes a stable solution for every possible input.
