From 853f3c67767c509c38a5f42564a2c0ec798e5c2a Mon Sep 17 00:00:00 2001 From: John Shumway Date: Fri, 2 Jan 2026 14:21:46 -0800 Subject: [PATCH] Remove non-standard M_PI (#3507) Just use PI=acos(-1.0) as a local static constexpr. This has been causing build issues on windows. [ROCm/composable_kernel commit: 355ce9230d9c4f2e74776e879f2bee71a26bae4a] --- include/ck/library/utility/device_tensor_generator.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/ck/library/utility/device_tensor_generator.hpp b/include/ck/library/utility/device_tensor_generator.hpp index ede6d131e7..80a91adda4 100644 --- a/include/ck/library/utility/device_tensor_generator.hpp +++ b/include/ck/library/utility/device_tensor_generator.hpp @@ -7,7 +7,6 @@ #include "ck/utility/common_header.hpp" #include "ck/library/utility/device_tensor_generator.hpp" #include "ck/utility/data_type.hpp" -#define _USE_MATH_DEFINES // Required for M_PI in MSVC #include // use xorshift for now since it is simple. Should be suitable enough, but feel free to switch in @@ -108,6 +107,7 @@ template __global__ void fill_tensor_norm_rand_fp_values(T* p, float sigma, float mean, uint64_t buffer_element_size) { + static constexpr PI = std::acos(-1.0); // initial values ran_state_u32 s = ran_init(); float norm[2]; @@ -119,9 +119,9 @@ fill_tensor_norm_rand_fp_values(T* p, float sigma, float mean, uint64_t buffer_e float u1 = ran_gen_round_u32(s) * (1.0f / 4294967296.0f); float u2 = ran_gen_round_u32(s) * (1.0f / 4294967296.0f); norm[0] = - sigma * std::sqrt(-2.0f * ck::math::log(u1)) * std::cos(2.0f * M_PI * u2) + mean; + sigma * std::sqrt(-2.0f * ck::math::log(u1)) * std::cos(2.0f * PI * u2) + mean; norm[1] = - sigma * std::sqrt(-2.0f * ck::math::log(u1)) * std::sin(2.0f * M_PI * u2) + mean; + sigma * std::sqrt(-2.0f * ck::math::log(u1)) * std::sin(2.0f * PI * u2) + mean; } if constexpr(ck::is_same_v)