support sincosf on msvc

This commit is contained in:
taipingchangan 2022-08-08 15:05:24 +08:00
parent 906fdc7a69
commit 483f653480
6 changed files with 16 additions and 4 deletions

View File

@ -24,6 +24,7 @@
#include <algorithm>
#include <thread>
#include <tuple>
#include <cmath>
#include "nlohmann/json.hpp"
#include "backend/common/session/anf_runtime_algorithm.h"
#include "include/common/utils/anfalgo.h"
@ -1387,5 +1388,12 @@ bool AlignedBroadCastShape(size_t align_rank, std::vector<size_t> *broadcast, st
return true;
}
} // namespace broadcast_utils
namespace math {
void SinCosf(float x, float *sinv, float *cosv) {
*sinv = sinf(x);
*cosv = cosf(x);
}
} // namespace math
} // namespace kernel
} // namespace mindspore

View File

@ -402,6 +402,10 @@ bool AlignedBroadCastShape(size_t align_rank, std::vector<size_t> *broadcast, st
std::vector<size_t> *rhs);
} // namespace broadcast_utils
namespace math {
void SinCosf(float x, float *sinv, float *cosv);
}
#define CHECK_KERNEL_INPUTS_NUM(actual_inputs_num, expect_inputs_num, kernel_name) \
do { \
if ((actual_inputs_num) != (expect_inputs_num)) { \

View File

@ -179,7 +179,7 @@ class PMEEnergyGpuKernelMod : public DeprecatedNativeGpuKernelMod {
cufftComplex expc(cufftComplex z) {
cufftComplex res;
float t = expf(z.x);
sincosf(z.y, &res.y, &res.x);
mindspore::kernel::math::SinCosf(z.y, &res.y, &res.x);
res.x *= t;
res.y *= t;
return res;

View File

@ -209,7 +209,7 @@ class PMEEnergyUpdateGpuKernelMod : public DeprecatedNativeGpuKernelMod {
cufftComplex expc(cufftComplex z) {
cufftComplex res;
float t = expf(z.x);
sincosf(z.y, &res.y, &res.x);
mindspore::kernel::math::SinCosf(z.y, &res.y, &res.x);
res.x *= t;
res.y *= t;
return res;

View File

@ -161,7 +161,7 @@ class PMEReciprocalForceGpuKernelMod : public DeprecatedNativeGpuKernelMod {
cufftComplex expc(cufftComplex z) {
cufftComplex res;
float t = expf(z.x);
sincosf(z.y, &res.y, &res.x);
mindspore::kernel::math::SinCosf(z.y, &res.y, &res.x);
res.x *= t;
res.y *= t;
return res;

View File

@ -185,7 +185,7 @@ class PMEReciprocalForceUpdateGpuKernelMod : public DeprecatedNativeGpuKernelMod
cufftComplex expc(cufftComplex z) {
cufftComplex res;
float t = expf(z.x);
sincosf(z.y, &res.y, &res.x);
mindspore::kernel::math::SinCosf(z.y, &res.y, &res.x);
res.x *= t;
res.y *= t;
return res;