atomr-accel-cuda 0.10.0

GPU acceleration via the actor model. Wraps NVIDIA CUDA libraries (cuBLAS, cuDNN, cuFFT, cuRAND, cuSOLVER, cuSPARSE, cuTENSOR, cuBLASLt, NVRTC, NCCL) as supervised atomr actors with generation-validated buffers and a uniform async surface.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
//! Crate-private FFI thunks around `cudarc::cusolver::sys`.
//!
//! cudarc 0.19's safe layer covers handle construction (`DnHandle`,
//! `SpHandle`) but leaves every dense / sparse / batched factorisation
//! behind raw `extern "C"` declarations under `cusolver::sys::lib`. The
//! [`SolverScalar`] trait lifts the per-prefix C entry points
//! (`Sgeqrf`, `Dgeqrf`, …) onto a uniform Rust surface so the actor's
//! per-op handlers can be written generically over `T: SolverSupported`.
//!
//! All unsafe FFI is contained inside this module — handlers in
//! `kernel::solver::*` only see the typed wrappers and a single
//! [`status_to_result`] adapter.

use cudarc::cusolver::sys as cs;

use crate::dtype::SolverSupported;
use crate::error::GpuError;

pub const LIB: &str = "cusolver";

/// Translate a `cusolverStatus_t` into our typed error.
pub fn status_to_result(status: cs::cusolverStatus_t, op: &'static str) -> Result<(), GpuError> {
    if status == cs::cusolverStatus_t::CUSOLVER_STATUS_SUCCESS {
        Ok(())
    } else {
        Err(GpuError::LibraryError {
            lib: LIB,
            msg: format!("{op}: {status:?}"),
        })
    }
}

/// Per-dtype dispatcher to the cuSOLVER `S/D/C/Z` entry points.
///
/// Methods take raw pointers because the actor side has already
/// extracted them via `device_ptr_mut`; threading lifetimes through
/// `&mut CudaSlice<T>` would force every wrapper to be generic over
/// keep-alive guards. The actor is responsible for keeping the slices
/// alive for the duration of the call.
///
/// # Safety
///
/// Each `unsafe` method is safe to call when:
/// - the `handle` is a live `DnHandle::cu()` value bound to the same
///   stream the slices were allocated/written through,
/// - all device pointers reference the buffer sizes implied by the
///   `(m, n, lda)` triple per the cuSOLVER reference,
/// - `lwork` matches what the corresponding `*_buffer_size` returned,
/// - `info` points to at least one writable `i32`.
pub trait SolverScalar: SolverSupported {
    /// QR `geqrf`: workspace query.
    unsafe fn geqrf_buffer_size(
        handle: cs::cusolverDnHandle_t,
        m: i32,
        n: i32,
        a: *mut Self,
        lda: i32,
        lwork: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn geqrf(
        handle: cs::cusolverDnHandle_t,
        m: i32,
        n: i32,
        a: *mut Self,
        lda: i32,
        tau: *mut Self,
        work: *mut Self,
        lwork: i32,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// LU `getrf`: workspace query.
    unsafe fn getrf_buffer_size(
        handle: cs::cusolverDnHandle_t,
        m: i32,
        n: i32,
        a: *mut Self,
        lda: i32,
        lwork: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn getrf(
        handle: cs::cusolverDnHandle_t,
        m: i32,
        n: i32,
        a: *mut Self,
        lda: i32,
        work: *mut Self,
        ipiv: *mut i32,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn getrs(
        handle: cs::cusolverDnHandle_t,
        trans: cs::cublasOperation_t,
        n: i32,
        nrhs: i32,
        a: *const Self,
        lda: i32,
        ipiv: *const i32,
        b: *mut Self,
        ldb: i32,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// Cholesky `potrf`.
    unsafe fn potrf_buffer_size(
        handle: cs::cusolverDnHandle_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a: *mut Self,
        lda: i32,
        lwork: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn potrf(
        handle: cs::cusolverDnHandle_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a: *mut Self,
        lda: i32,
        work: *mut Self,
        lwork: i32,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// SVD `gesvd`. (`gesvd` workspace query takes only m/n.)
    unsafe fn gesvd_buffer_size(
        handle: cs::cusolverDnHandle_t,
        m: i32,
        n: i32,
        lwork: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn gesvd(
        handle: cs::cusolverDnHandle_t,
        jobu: i8,
        jobvt: i8,
        m: i32,
        n: i32,
        a: *mut Self,
        lda: i32,
        s: *mut Self,
        u: *mut Self,
        ldu: i32,
        vt: *mut Self,
        ldvt: i32,
        work: *mut Self,
        lwork: i32,
        rwork: *mut Self,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// Symmetric eigendecomposition `syevd`.
    unsafe fn syevd_buffer_size(
        handle: cs::cusolverDnHandle_t,
        jobz: cs::cusolverEigMode_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a: *const Self,
        lda: i32,
        w: *const Self,
        lwork: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn syevd(
        handle: cs::cusolverDnHandle_t,
        jobz: cs::cusolverEigMode_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a: *mut Self,
        lda: i32,
        w: *mut Self,
        work: *mut Self,
        lwork: i32,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// Generalized symmetric eigendecomposition `sygvd` (real)
    /// / `hegvd` (complex). Phase 1 routes both messages through
    /// the same trait method since the f32/f64 surface is purely
    /// real.
    unsafe fn sygvd_buffer_size(
        handle: cs::cusolverDnHandle_t,
        itype: cs::cusolverEigType_t,
        jobz: cs::cusolverEigMode_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a: *const Self,
        lda: i32,
        b: *const Self,
        ldb: i32,
        w: *const Self,
        lwork: *mut i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn sygvd(
        handle: cs::cusolverDnHandle_t,
        itype: cs::cusolverEigType_t,
        jobz: cs::cusolverEigMode_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a: *mut Self,
        lda: i32,
        b: *mut Self,
        ldb: i32,
        w: *mut Self,
        work: *mut Self,
        lwork: i32,
        info: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// Batched Cholesky `potrfBatched`. cuSOLVER takes an
    /// array-of-pointers to `n × n` matrices; the actor stages
    /// them into a contiguous device buffer of pointers.
    unsafe fn potrf_batched(
        handle: cs::cusolverDnHandle_t,
        uplo: cs::cublasFillMode_t,
        n: i32,
        a_array: *mut *mut Self,
        lda: i32,
        info_array: *mut i32,
        batch_size: i32,
    ) -> cs::cusolverStatus_t;

    /// Batched Jacobi SVD `gesvdjBatched` workspace query + launch.
    unsafe fn gesvdj_batched_buffer_size(
        handle: cs::cusolverDnHandle_t,
        jobz: cs::cusolverEigMode_t,
        m: i32,
        n: i32,
        a: *const Self,
        lda: i32,
        s: *const Self,
        u: *const Self,
        ldu: i32,
        v: *const Self,
        ldv: i32,
        lwork: *mut i32,
        params: cs::gesvdjInfo_t,
        batch_size: i32,
    ) -> cs::cusolverStatus_t;
    unsafe fn gesvdj_batched(
        handle: cs::cusolverDnHandle_t,
        jobz: cs::cusolverEigMode_t,
        m: i32,
        n: i32,
        a: *mut Self,
        lda: i32,
        s: *mut Self,
        u: *mut Self,
        ldu: i32,
        v: *mut Self,
        ldv: i32,
        work: *mut Self,
        lwork: i32,
        info: *mut i32,
        params: cs::gesvdjInfo_t,
        batch_size: i32,
    ) -> cs::cusolverStatus_t;
}

macro_rules! impl_solver_scalar {
    (
        $T:ty,
        geqrf:           $geqrf:ident,        $geqrf_bs:ident;
        getrf:           $getrf:ident,        $getrf_bs:ident,        $getrs:ident;
        potrf:           $potrf:ident,        $potrf_bs:ident;
        gesvd:           $gesvd:ident,        $gesvd_bs:ident;
        syevd:           $syevd:ident,        $syevd_bs:ident;
        sygvd:           $sygvd:ident,        $sygvd_bs:ident;
        potrf_batched:   $potrf_b:ident;
        gesvdj_batched:  $gesvdj_b:ident,     $gesvdj_b_bs:ident;
    ) => {
        impl SolverScalar for $T {
            unsafe fn geqrf_buffer_size(
                handle: cs::cusolverDnHandle_t,
                m: i32,
                n: i32,
                a: *mut Self,
                lda: i32,
                lwork: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$geqrf_bs(handle, m, n, a, lda, lwork)
            }
            unsafe fn geqrf(
                handle: cs::cusolverDnHandle_t,
                m: i32,
                n: i32,
                a: *mut Self,
                lda: i32,
                tau: *mut Self,
                work: *mut Self,
                lwork: i32,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$geqrf(handle, m, n, a, lda, tau, work, lwork, info)
            }

            unsafe fn getrf_buffer_size(
                handle: cs::cusolverDnHandle_t,
                m: i32,
                n: i32,
                a: *mut Self,
                lda: i32,
                lwork: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$getrf_bs(handle, m, n, a, lda, lwork)
            }
            unsafe fn getrf(
                handle: cs::cusolverDnHandle_t,
                m: i32,
                n: i32,
                a: *mut Self,
                lda: i32,
                work: *mut Self,
                ipiv: *mut i32,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$getrf(handle, m, n, a, lda, work, ipiv, info)
            }
            unsafe fn getrs(
                handle: cs::cusolverDnHandle_t,
                trans: cs::cublasOperation_t,
                n: i32,
                nrhs: i32,
                a: *const Self,
                lda: i32,
                ipiv: *const i32,
                b: *mut Self,
                ldb: i32,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$getrs(handle, trans, n, nrhs, a, lda, ipiv, b, ldb, info)
            }

            unsafe fn potrf_buffer_size(
                handle: cs::cusolverDnHandle_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a: *mut Self,
                lda: i32,
                lwork: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$potrf_bs(handle, uplo, n, a, lda, lwork)
            }
            unsafe fn potrf(
                handle: cs::cusolverDnHandle_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a: *mut Self,
                lda: i32,
                work: *mut Self,
                lwork: i32,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$potrf(handle, uplo, n, a, lda, work, lwork, info)
            }

            unsafe fn gesvd_buffer_size(
                handle: cs::cusolverDnHandle_t,
                m: i32,
                n: i32,
                lwork: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$gesvd_bs(handle, m, n, lwork)
            }
            unsafe fn gesvd(
                handle: cs::cusolverDnHandle_t,
                jobu: i8,
                jobvt: i8,
                m: i32,
                n: i32,
                a: *mut Self,
                lda: i32,
                s: *mut Self,
                u: *mut Self,
                ldu: i32,
                vt: *mut Self,
                ldvt: i32,
                work: *mut Self,
                lwork: i32,
                rwork: *mut Self,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$gesvd(
                    handle, jobu, jobvt, m, n, a, lda, s, u, ldu, vt, ldvt, work, lwork, rwork,
                    info,
                )
            }

            unsafe fn syevd_buffer_size(
                handle: cs::cusolverDnHandle_t,
                jobz: cs::cusolverEigMode_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a: *const Self,
                lda: i32,
                w: *const Self,
                lwork: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$syevd_bs(handle, jobz, uplo, n, a, lda, w, lwork)
            }
            unsafe fn syevd(
                handle: cs::cusolverDnHandle_t,
                jobz: cs::cusolverEigMode_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a: *mut Self,
                lda: i32,
                w: *mut Self,
                work: *mut Self,
                lwork: i32,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$syevd(handle, jobz, uplo, n, a, lda, w, work, lwork, info)
            }

            unsafe fn sygvd_buffer_size(
                handle: cs::cusolverDnHandle_t,
                itype: cs::cusolverEigType_t,
                jobz: cs::cusolverEigMode_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a: *const Self,
                lda: i32,
                b: *const Self,
                ldb: i32,
                w: *const Self,
                lwork: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$sygvd_bs(handle, itype, jobz, uplo, n, a, lda, b, ldb, w, lwork)
            }
            unsafe fn sygvd(
                handle: cs::cusolverDnHandle_t,
                itype: cs::cusolverEigType_t,
                jobz: cs::cusolverEigMode_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a: *mut Self,
                lda: i32,
                b: *mut Self,
                ldb: i32,
                w: *mut Self,
                work: *mut Self,
                lwork: i32,
                info: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$sygvd(
                    handle, itype, jobz, uplo, n, a, lda, b, ldb, w, work, lwork, info,
                )
            }

            unsafe fn potrf_batched(
                handle: cs::cusolverDnHandle_t,
                uplo: cs::cublasFillMode_t,
                n: i32,
                a_array: *mut *mut Self,
                lda: i32,
                info_array: *mut i32,
                batch_size: i32,
            ) -> cs::cusolverStatus_t {
                cs::$potrf_b(handle, uplo, n, a_array, lda, info_array, batch_size)
            }

            unsafe fn gesvdj_batched_buffer_size(
                handle: cs::cusolverDnHandle_t,
                jobz: cs::cusolverEigMode_t,
                m: i32,
                n: i32,
                a: *const Self,
                lda: i32,
                s: *const Self,
                u: *const Self,
                ldu: i32,
                v: *const Self,
                ldv: i32,
                lwork: *mut i32,
                params: cs::gesvdjInfo_t,
                batch_size: i32,
            ) -> cs::cusolverStatus_t {
                cs::$gesvdj_b_bs(
                    handle, jobz, m, n, a, lda, s, u, ldu, v, ldv, lwork, params, batch_size,
                )
            }
            unsafe fn gesvdj_batched(
                handle: cs::cusolverDnHandle_t,
                jobz: cs::cusolverEigMode_t,
                m: i32,
                n: i32,
                a: *mut Self,
                lda: i32,
                s: *mut Self,
                u: *mut Self,
                ldu: i32,
                v: *mut Self,
                ldv: i32,
                work: *mut Self,
                lwork: i32,
                info: *mut i32,
                params: cs::gesvdjInfo_t,
                batch_size: i32,
            ) -> cs::cusolverStatus_t {
                cs::$gesvdj_b(
                    handle, jobz, m, n, a, lda, s, u, ldu, v, ldv, work, lwork, info, params,
                    batch_size,
                )
            }
        }
    };
}

impl_solver_scalar!(
    f32,
    geqrf:          cusolverDnSgeqrf,            cusolverDnSgeqrf_bufferSize;
    getrf:          cusolverDnSgetrf,            cusolverDnSgetrf_bufferSize, cusolverDnSgetrs;
    potrf:          cusolverDnSpotrf,            cusolverDnSpotrf_bufferSize;
    gesvd:          cusolverDnSgesvd,            cusolverDnSgesvd_bufferSize;
    syevd:          cusolverDnSsyevd,            cusolverDnSsyevd_bufferSize;
    sygvd:          cusolverDnSsygvd,            cusolverDnSsygvd_bufferSize;
    potrf_batched:  cusolverDnSpotrfBatched;
    gesvdj_batched: cusolverDnSgesvdjBatched,    cusolverDnSgesvdjBatched_bufferSize;
);

impl_solver_scalar!(
    f64,
    geqrf:          cusolverDnDgeqrf,            cusolverDnDgeqrf_bufferSize;
    getrf:          cusolverDnDgetrf,            cusolverDnDgetrf_bufferSize, cusolverDnDgetrs;
    potrf:          cusolverDnDpotrf,            cusolverDnDpotrf_bufferSize;
    gesvd:          cusolverDnDgesvd,            cusolverDnDgesvd_bufferSize;
    syevd:          cusolverDnDsyevd,            cusolverDnDsyevd_bufferSize;
    sygvd:          cusolverDnDsygvd,            cusolverDnDsygvd_bufferSize;
    potrf_batched:  cusolverDnDpotrfBatched;
    gesvdj_batched: cusolverDnDgesvdjBatched,    cusolverDnDgesvdjBatched_bufferSize;
);

/// Sparse cuSOLVER (`cusolverSp`) entry points.
///
/// Only the device-side `csrlsv*` triplet (Cholesky / QR) is exposed
/// here — `csrlsvluHost` is host-only and out of scope. Each method
/// solves `A x = b` in one shot for an `m × m` CSR matrix.
#[cfg(feature = "cusolver-sp")]
pub trait SparseSolverScalar: SolverSupported {
    /// `csrlsvchol`: SPD CSR system via Cholesky.
    unsafe fn csrlsvchol(
        handle: cs::cusolverSpHandle_t,
        m: i32,
        nnz: i32,
        descr_a: cs::cusparseMatDescr_t,
        csr_val: *const Self,
        csr_row_ptr: *const i32,
        csr_col_ind: *const i32,
        b: *const Self,
        tol: f64,
        reorder: i32,
        x: *mut Self,
        singularity: *mut i32,
    ) -> cs::cusolverStatus_t;

    /// `csrlsvqr`: general CSR system via QR.
    unsafe fn csrlsvqr(
        handle: cs::cusolverSpHandle_t,
        m: i32,
        nnz: i32,
        descr_a: cs::cusparseMatDescr_t,
        csr_val: *const Self,
        csr_row_ptr: *const i32,
        csr_col_ind: *const i32,
        b: *const Self,
        tol: f64,
        reorder: i32,
        x: *mut Self,
        singularity: *mut i32,
    ) -> cs::cusolverStatus_t;
}

#[cfg(feature = "cusolver-sp")]
macro_rules! impl_sparse_solver_scalar {
    ($T:ty, $tol:ty, chol: $chol:ident, qr: $qr:ident) => {
        impl SparseSolverScalar for $T {
            unsafe fn csrlsvchol(
                handle: cs::cusolverSpHandle_t,
                m: i32,
                nnz: i32,
                descr_a: cs::cusparseMatDescr_t,
                csr_val: *const Self,
                csr_row_ptr: *const i32,
                csr_col_ind: *const i32,
                b: *const Self,
                tol: f64,
                reorder: i32,
                x: *mut Self,
                singularity: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$chol(
                    handle,
                    m,
                    nnz,
                    descr_a,
                    csr_val,
                    csr_row_ptr,
                    csr_col_ind,
                    b,
                    tol as $tol,
                    reorder,
                    x,
                    singularity,
                )
            }

            unsafe fn csrlsvqr(
                handle: cs::cusolverSpHandle_t,
                m: i32,
                nnz: i32,
                descr_a: cs::cusparseMatDescr_t,
                csr_val: *const Self,
                csr_row_ptr: *const i32,
                csr_col_ind: *const i32,
                b: *const Self,
                tol: f64,
                reorder: i32,
                x: *mut Self,
                singularity: *mut i32,
            ) -> cs::cusolverStatus_t {
                cs::$qr(
                    handle,
                    m,
                    nnz,
                    descr_a,
                    csr_val,
                    csr_row_ptr,
                    csr_col_ind,
                    b,
                    tol as $tol,
                    reorder,
                    x,
                    singularity,
                )
            }
        }
    };
}

#[cfg(feature = "cusolver-sp")]
impl_sparse_solver_scalar!(f32, f32, chol: cusolverSpScsrlsvchol, qr: cusolverSpScsrlsvqr);
#[cfg(feature = "cusolver-sp")]
impl_sparse_solver_scalar!(f64, f64, chol: cusolverSpDcsrlsvchol, qr: cusolverSpDcsrlsvqr);