Conversation
Also add fltflt_add_same_sign(), with is more efficient than fltflt_add() for the case where we know both inputs have the same sign. Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Signed-off-by: Thomas Benson <tbenson@nvidia.com>
Greptile SummaryAdds comprehensive float-float arithmetic rounding and modulo functions with proper IEEE-754 semantics. The implementation includes Key implementation details:
Testing and benchmarking:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 0651eb6 |
| if (idx < size) { | ||
| T val[ILP_FACTOR]; | ||
| //const T init_val = static_cast<T>(std::numbers::e); | ||
| const T init_val = static_cast<T>(33554432.5); |
| // given in Algorithm 14.1 of "Handbook of Floating-Point Arithmetic" by Muller et al. Rather | ||
| // than include a conditional on the magnitude of a and b to use fltflt_fast_two_sum(), we | ||
| // use fltflt_two_sum() at the cost of more FLOPs but without a branch. | ||
| static __MATX_HOST__ __MATX_DEVICE__ __MATX_INLINE__ fltflt fltflt_add_same_sign(fltflt a, fltflt b) { |
There was a problem hiding this comment.
How would someone use this function?
There was a problem hiding this comment.
Currently you would likely call it directly in a kernel. I plan on switching the sar_bp operator to use this function when computing a distance because in that case we are adding squared values and thus we know they are non-negative. I will also benchmark if it is worth adding the conditionals required to call this function when appropriate in operator+(), but I suspect the answer is no.
|
/build |
Add support for the following float-float (fltflt) functions:
Also includes are new unit tests and benchmarks for the newly introduced functions.