From 95575579b3304f3cdd6bc1f9715535d424768b87 Mon Sep 17 00:00:00 2001 From: Bruno Date: Thu, 1 Oct 2020 03:55:27 -0300 Subject: [PATCH] Use parentesis around min and max to enable Windows build (#449) * Towards Windows build * formatting Co-authored-by: Bruno Cabral Co-authored-by: Jeff Rasley Co-authored-by: Olatunji Ruwase --- csrc/includes/context.h | 4 ++-- csrc/includes/gemm_test.h | 4 ++-- csrc/transformer/ds_transformer_cuda.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/csrc/includes/context.h b/csrc/includes/context.h index e05c41dc..f8ae6fc4 100755 --- a/csrc/includes/context.h +++ b/csrc/includes/context.h @@ -33,8 +33,8 @@ inline int DS_GET_BLOCKS(const int N) { - return std::max( - std::min((N + DS_CUDA_NUM_THREADS - 1) / DS_CUDA_NUM_THREADS, DS_MAXIMUM_NUM_BLOCKS), + return (std::max)( + (std::min)((N + DS_CUDA_NUM_THREADS - 1) / DS_CUDA_NUM_THREADS, DS_MAXIMUM_NUM_BLOCKS), // Use at least 1 block, since CUDA does not allow empty block 1); } diff --git a/csrc/includes/gemm_test.h b/csrc/includes/gemm_test.h index ff06f884..b920896b 100644 --- a/csrc/includes/gemm_test.h +++ b/csrc/includes/gemm_test.h @@ -97,7 +97,7 @@ public: template int Run(int loops, Func f) { - float fast_latency = std::numeric_limits::max(); + float fast_latency = (std::numeric_limits::max)(); int fast_algo = 0; for (int algo = (int)CUBLAS_GEMM_DEFAULT_TENSOR_OP; @@ -252,7 +252,7 @@ public: template int Run(int loops, Func f) { - float fast_latency = std::numeric_limits::max(); + float fast_latency = (std::numeric_limits::max)(); int fast_algo = 0; for (int algo = (int)CUBLAS_GEMM_DEFAULT_TENSOR_OP; diff --git a/csrc/transformer/ds_transformer_cuda.cpp b/csrc/transformer/ds_transformer_cuda.cpp index d6c09fb7..85ec0418 100644 --- a/csrc/transformer/ds_transformer_cuda.cpp +++ b/csrc/transformer/ds_transformer_cuda.cpp @@ -27,8 +27,8 @@ size_t get_workspace_size(int maxBatchSize, { size_t workSpacesize = 4 * (size_t(maxBatchSize) * seq_len * hidden_size); if (training) { - workSpacesize += (std::max((size_t(maxBatchSize) * seq_len * intermediate_size), - 2 * (size_t(maxBatchSize) * heads * seq_len * seq_len))); + workSpacesize += ((std::max)((size_t(maxBatchSize) * seq_len * intermediate_size), + 2 * (size_t(maxBatchSize) * heads * seq_len * seq_len))); if (gelu_checkpoint) workSpacesize += 2 * (size_t(maxBatchSize) * seq_len * hidden_size); } return workSpacesize * sizeof(T); -- GitLab