Description
Describe the Code Quality Issue
Description
Currently, the software package has a two-layer encapsulation for LAPACK functionalities:
Heterogeneous Encapsulation (CPU/GPU): Different implementations are provided for CPU and GPU.
Multi-Precision Encapsulation (float/double/complex): Separate implementations exist for different precision levels (single-precision, double-precision, and complex numbers).
This dual-layer encapsulation leads to significant maintenance challenges, as changes or updates need to be propagated across multiple implementations, increasing the risk of inconsistencies and bugs.
See: so many different implementation actually doing the same things.
lapack_connector.h
x2 & lapack_wrapper.h
- Multi-Precision Encapsulation
lapack.h
- Heterogeneous Encapsulation
Proposed Solution
To improve maintainability and reduce redundancy, I suggest refactoring the LAPACK encapsulation similar to the BLAS encapsulation. Specifically, we should consolidate all LAPACK functionalities into a single module, such as module_base/lapack_connector.
This module would:
Provide a unified interface for both CPU and GPU implementations.
Handle multi-precision (float, double, complex) through a single, consistent API.
Benefits
Easier Maintenance: A single module reduces the complexity of managing multiple implementations.
Consistency: Unified interfaces ensure consistent behavior across different precision levels and hardware backends.
Scalability: Future additions or modifications can be implemented more efficiently.