![]() |
Chisei v1.0
Lightweight AI/ML Framework
|
Provides utilities to optimize computations using CPU-specific features, such as FMA and AVX. More...
#include <cpu_feature_optimizer.hpp>
Static Public Member Functions | |
static void | init_cpu_features (std::mt19937 gen) |
Initializes CPU-specific features for optimization. | |
static double | dot_product_fma (const double *a, const double *b, int size) |
Computes the dot product of two arrays using FMA (Fused Multiply-Add) instructions. | |
This class includes methods to initialize CPU-specific features and perform optimized mathematical operations such as dot products. It utilizes hardware acceleration where available for improved performance.
Definition at line 60 of file cpu_feature_optimizer.hpp.
|
inlinestatic |
If FMA or AVX instructions are available, this method will leverage hardware acceleration for computing the dot product of two arrays. FMA reduces rounding errors and improves performance by combining multiplication and addition in a single instruction.
a | Pointer to the first array of double-precision floating-point numbers. |
b | Pointer to the second array of double-precision floating-point numbers. |
size | The size of the arrays (number of elements in each array). |
a
and b
must have at least size
elements to avoid undefined behavior.
|
static |
This method is used to initialize and configure CPU features based on the available hardware capabilities. It can utilize features such as RDRAND, RDSEED, and AVX if supported by the CPU.
gen | A random number generator of type std::mt19937 , which may be used internally for testing or feature initialization. |