Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7b5ce77
message format
pcarruscag Aug 11, 2026
4cb8044
Add quantized Jacobi and identity preconditioners
pcarruscag Aug 12, 2026
31b6b8a
Enable quantized matrix-vector product on GPU for Jacobi/identity
pcarruscag Aug 12, 2026
e16cad7
Group quantized storage into LDU<T> and overlap diagonal quantize wit…
pcarruscag Aug 12, 2026
9bdd89c
Fold quantized diagonal build into the base preconditioner wrappers
pcarruscag Aug 12, 2026
76c27f2
Inline the diagonal quantization upload instead of a separate GPU hook
pcarruscag Aug 12, 2026
08d0406
Merge remote-tracking branch 'origin/develop' into pedro/q_jacobi
pcarruscag Aug 15, 2026
e6e020b
Merge remote-tracking branch 'origin/develop' into pedro/q_jacobi
pcarruscag Aug 15, 2026
c62a413
Pin the quantized L/U/D host arrays so the async H2D transfer actuall…
pcarruscag Aug 15, 2026
a1aaabf
Batch rows per block and vectorize int8 loads in the SpMV kernels
pcarruscag Aug 15, 2026
a113c70
Thread-per-row layout for the Jacobi preconditioner apply kernel
pcarruscag Aug 15, 2026
56fe054
Try thread-per-block-entry layout for the Jacobi apply kernel
pcarruscag Aug 15, 2026
feeae49
Revert "Try thread-per-block-entry layout for the Jacobi apply kernel"
pcarruscag Aug 15, 2026
e65bfa8
Batch rows per block in the Jacobi diagonal-inversion kernel
pcarruscag Aug 15, 2026
7c308e6
Revert "Batch rows per block in the Jacobi diagonal-inversion kernel"
pcarruscag Aug 15, 2026
40007df
Quantize the diagonal on the GPU straight from gpu.d, sharing the enc…
pcarruscag Aug 15, 2026
0bfd05b
Warp-align the row batching in the Jacobi diagonal-inversion kernel
pcarruscag Aug 15, 2026
dc95fd8
Revert "Warp-align the row batching in the Jacobi diagonal-inversion …
pcarruscag Aug 15, 2026
2492099
Parallelize the Jacobi diagonal-inversion kernel across all block ent…
pcarruscag Aug 15, 2026
1e71a1b
Parallelize the diagonal-block quantization kernel across rows
pcarruscag Aug 15, 2026
ccd2564
Overlap the quantized L/U H2D transfer with default-stream kernels
pcarruscag Aug 15, 2026
36e98c4
Reuse the parallel Gauss-Jordan inversion for ILU's diagonal blocks
pcarruscag Aug 15, 2026
54a93a4
Share one non-default stream between ILU and the quantized L/U transfer
pcarruscag Aug 16, 2026
957e8d0
Apply suggestions from code review
pcarruscag Aug 16, 2026
2b5e3a5
Merge remote-tracking branch 'origin/pedro/q_jacobi' into pedro/q_jacobi
pcarruscag Aug 16, 2026
81fc7d6
Fix forward-mode AD build: restore PassiveValue in EncodeQuantRow
pcarruscag Aug 16, 2026
da428d0
Replace multiDotGPU's cublas<t>gemmBatched with a fused reduction kernel
pcarruscag Aug 16, 2026
e525848
Pass MultiDotKernel's V/W pointers as launch parameters, not a device…
pcarruscag Aug 16, 2026
f9de6d4
Split multiDotGPU's pointer-array cap into an asymmetric large/small …
pcarruscag Aug 16, 2026
e6554d0
Use the default stream in multiDotGPU instead of a dedicated one
pcarruscag Aug 16, 2026
d0e9499
Replace dotGPU's cuBLAS call with a custom kernel, drop the cuBLAS de…
pcarruscag Aug 16, 2026
3b8e13c
Clean up dot/multiDot GPU comments: describe current state, not history
pcarruscag Aug 16, 2026
945ba12
Apply suggestions from code review
pcarruscag Aug 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Common/include/code_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
#define NEVERINLINE inline
#endif

/*--- Marks a function callable from both host and device code, a no-op outside nvcc. ---*/
#ifdef __CUDACC__
#define SU2_CUDA_HOST_DEVICE __host__ __device__
#else
#define SU2_CUDA_HOST_DEVICE
#endif

#if defined(__INTEL_COMPILER)
/*--- Disable warnings related to inline attributes. ---*/
#pragma warning disable 2196
Expand Down
8 changes: 1 addition & 7 deletions Common/include/linear_algebra/CMatrixInverse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@

#include <cmath>

#ifdef __CUDACC__
#define SU2_CUDA_HOST_DEVICE __host__ __device__
#else
#define SU2_CUDA_HOST_DEVICE
#endif
#include "../code_config.hpp"

namespace SU2_LinAlg {

Expand Down Expand Up @@ -95,5 +91,3 @@ SU2_CUDA_HOST_DEVICE inline void MatrixInverse(unsigned long nVar, ScalarType* m
}

} // namespace SU2_LinAlg

#undef SU2_CUDA_HOST_DEVICE
56 changes: 22 additions & 34 deletions Common/include/linear_algebra/CPreconditioner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,25 @@ CPreconditioner<ScalarType>::~CPreconditioner() {}
/*!
* \class CIdentityPreconditioner
* \brief No-op preconditioner used when Krylov solvers run without preconditioning.
* \note Also serves Q_IDENTITY: Build() requests quantization of the diagonal blocks, needed by
* the matrix-vector product shared with the Krylov solver even though this preconditioner's own
* operation is a no-op. CSysMatrix::QuantizeDiagonalBlocks() when quantization is off.
*/
template <class ScalarType>
class CIdentityPreconditioner final : public CPreconditioner<ScalarType> {
private:
CSysMatrix<ScalarType>& sparse_matrix;

public:
inline explicit CIdentityPreconditioner(CSysMatrix<ScalarType>& matrix_ref) : sparse_matrix(matrix_ref) {}

CIdentityPreconditioner() = delete;

inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override { v = u; }

inline bool IsIdentity() const override { return true; }

inline void Build() override { sparse_matrix.QuantizeDiagonalBlocks(); }
};

/*!
Expand Down Expand Up @@ -157,7 +169,9 @@ class CJacobiPreconditioner final : public CPreconditioner<ScalarType> {
}

/*!
* \note Request the associated matrix to build the preconditioner.
* \note Request the associated matrix to build the preconditioner. Also serves Q_JACOBI:
* BuildJacobiPreconditioner() quantizes the diagonal blocks itself when the matrix was
* set up for it.
*/
inline void Build() override { sparse_matrix.BuildJacobiPreconditioner(); }
};
Expand Down Expand Up @@ -248,36 +262,10 @@ class CLU_SGSPreconditioner final : public CPreconditioner<ScalarType> {
inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
ApplyPreconditionerOnHost(u, v, [&] { sparse_matrix.ComputeLU_SGSPreconditioner(u, v, geometry, config); });
}
};

/*!
* \class CQuantizedLUSGSPreconditioner
* \brief Specialization of preconditioner that uses CSysMatrix class.
*/
template <class ScalarType>
class CQuantizedLUSGSPreconditioner final : public CPreconditioner<ScalarType> {
private:
CSysMatrix<ScalarType>& sparse_matrix;
CGeometry* geometry;
const CConfig* config;

public:
inline CQuantizedLUSGSPreconditioner(CSysMatrix<ScalarType>& matrix_ref, CGeometry* geometry_ref,
const CConfig* config_ref)
: sparse_matrix(matrix_ref) {
if ((geometry_ref == nullptr) || (config_ref == nullptr))
SU2_MPI::Error("Preconditioner needs to be built with valid references.", CURRENT_FUNCTION);
geometry = geometry_ref;
config = config_ref;
}

CQuantizedLUSGSPreconditioner() = delete;

inline void operator()(const CSysVector<ScalarType>& u, CSysVector<ScalarType>& v) const override {
ApplyPreconditionerOnHost(u, v, [&] { sparse_matrix.ComputeLU_SGSPreconditioner(u, v, geometry, config); });
}

/*! \brief Quantize the diagonal blocks (off diagonals are quantized on the fly). */
/*!
* \note Also serves Q_LU_SGS: quantizes the diagonal blocks, no-op for plain LU_SGS.
*/
inline void Build() override { sparse_matrix.QuantizeDiagonalBlocks(); }
};

Expand Down Expand Up @@ -404,19 +392,19 @@ CPreconditioner<ScalarType>* CPreconditioner<ScalarType>::Create(ENUM_LINEAR_SOL

switch (kind) {
case IDENTITY:
prec = new CIdentityPreconditioner<ScalarType>();
case Q_IDENTITY:
prec = new CIdentityPreconditioner<ScalarType>(jacobian);
break;
case JACOBI:
case Q_JACOBI:
prec = new CJacobiPreconditioner<ScalarType>(jacobian, geometry, config);
break;
case LINELET:
prec = new CLineletPreconditioner<ScalarType>(jacobian, geometry, config);
break;
case LU_SGS:
prec = new CLU_SGSPreconditioner<ScalarType>(jacobian, geometry, config);
break;
case Q_LU_SGS:
prec = new CQuantizedLUSGSPreconditioner<ScalarType>(jacobian, geometry, config);
prec = new CLU_SGSPreconditioner<ScalarType>(jacobian, geometry, config);
break;
case ILU:
prec = new CILUPreconditioner<ScalarType>(jacobian, geometry, config);
Expand Down
Loading
Loading