Skip to content

Commit

Permalink
fmath_init is automatically called on Windows as well.
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Jan 14, 2025
1 parent c791427 commit dfdfbc6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 1 addition & 6 deletions include/fmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
extern "C" {
#endif

void fmath_init(); // select AVX-512 functions if it is available
void fmath_init(); // select AVX-512 functions if it is available (This function is automatically called.)

void fmath_expf_v_avx512(float *dst, const float *src, size_t n);
void fmath_logf_v_avx512(float *dst, const float *src, size_t n);
Expand All @@ -28,11 +28,6 @@ extern void (*fmath_logf_v)(float *dst, const float *src, size_t n);
#ifdef __cplusplus
namespace fmath {

inline void init()
{
fmath_init();
}

inline void expf_v(float *dst, const float *src, size_t n)
{
fmath_expf_v(dst, src, n);
Expand Down
2 changes: 0 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const size_t n = 1000;
float src[n] = {1.0f, 2.0f, 3.0f, /* ... */};
float dst[n];

fmath_init(); // Required initialization on Windows (It is automatically called on Linux)

// Calculate natural logarithm for array
fmath_logf_v(dst, src, n); // dst[i] = log(src[i])

Expand Down
4 changes: 4 additions & 0 deletions src/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ void ATTRIBUTE fmath_init()

}

#ifdef _MSC_VER
#pragma section(".CRT$XCU", read)
__declspec(allocate(".CRT$XCU")) void(*fmath_init_ptr)() = fmath_init;
#endif

0 comments on commit dfdfbc6

Please sign in to comment.