| 1 |
/* ---------------------------------------------------------------------------- |
| 2 |
* SymForce - Copyright 2025, Skydio, Inc. |
| 3 |
* This source code is under the Apache 2.0 license found in the LICENSE file. |
| 4 |
* ---------------------------------------------------------------------------- */ |
| 5 |
|
| 6 |
#pragma once |
| 7 |
|
| 8 |
namespace caspar { |
| 9 |
|
| 10 |
template <typename T> |
| 11 |
void Zero(T* start, T* end); |
| 12 |
|
| 13 |
template <typename T> |
| 14 |
void Copy(const T* start, const T* end, T* target); |
| 15 |
|
| 16 |
template <typename T> |
| 17 |
void AlphaFromNumDenom(const T* alpha_numerator, const T* alpha_denominator, T* alpha, |
| 18 |
T* neg_alpha); |
| 19 |
|
| 20 |
template <typename T> |
| 21 |
void BetaFromNumDenom(const T* beta_num, const T* beta_denum, T* beta); |
| 22 |
|
| 23 |
template <typename T> |
| 24 |
T Sum(const T* start, const T* end, T* target_ptr, T* scratch_ptr, bool copy_to_host = true); |
| 25 |
|
| 26 |
template <typename T> |
| 27 |
T ReadCuMem(const T* const data); |
| 28 |
|
| 29 |
// Explicit instantiations |
| 30 |
extern template void Zero<float>(float* start, float* end); |
| 31 |
extern template void Zero<double>(double* start, double* end); |
| 32 |
|
| 33 |
extern template void Copy<float>(const float* start, const float* end, float* target); |
| 34 |
extern template void Copy<double>(const double* start, const double* end, double* target); |
| 35 |
|
| 36 |
extern template void AlphaFromNumDenom<float>(const float* alpha_numerator, |
| 37 |
const float* alpha_denominator, float* alpha, |
| 38 |
float* neg_alpha); |
| 39 |
extern template void AlphaFromNumDenom<double>(const double* alpha_numerator, |
| 40 |
const double* alpha_denominator, double* alpha, |
| 41 |
double* neg_alpha); |
| 42 |
|
| 43 |
extern template void BetaFromNumDenom<float>(const float* beta_num, const float* beta_denum, |
| 44 |
float* beta); |
| 45 |
extern template void BetaFromNumDenom<double>(const double* beta_num, const double* beta_denum, |
| 46 |
double* beta); |
| 47 |
|
| 48 |
extern template float Sum<float>(const float* start, const float* end, float* target_ptr, |
| 49 |
float* scratch_ptr, bool copy_to_host); |
| 50 |
extern template double Sum<double>(const double* start, const double* end, double* target_ptr, |
| 51 |
double* scratch_ptr, bool copy_to_host); |
| 52 |
|
| 53 |
extern template float ReadCuMem<float>(const float* const data); |
| 54 |
extern template double ReadCuMem<double>(const double* const data); |
| 55 |
|
| 56 |
} // namespace caspar |