From 9add11ffc143257fe1e3579702155f39eed85dc4 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Wed, 5 Aug 2020 18:54:33 -0700 Subject: [PATCH] Fix IS_SPMM_AVAILABLE macro definition (#42643) Summary: This should fix CUDA-11 on Windows build issue `defined` is not a function, and so it can not be used in macro substitution. Pull Request resolved: https://github.com/pytorch/pytorch/pull/42643 Reviewed By: pbelevich, xw285cornell Differential Revision: D22963420 Pulled By: malfet fbshipit-source-id: cccf7db0d03cd62b655beeb154db9e628aa749f0 --- aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu b/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu index 219df09815e3b..bd627091a164a 100644 --- a/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu +++ b/aten/src/ATen/native/sparse/cuda/SparseCUDABlas.cu @@ -15,9 +15,11 @@ // Using these APIs in any other systems will result in compile-time or run-time failures. // Their support will be extended in the next releases. -#define IS_SPMM_AVAILABLE() (defined(__CUDACC__) && \ - (CUSPARSE_VERSION >= 11000 || \ - (!defined(_MSC_VER) && CUSPARSE_VERSION >= 10301))) +#if defined(__CUDACC__) && (CUSPARSE_VERSION >= 11000 || (!defined(_MSC_VER) && CUSPARSE_VERSION >= 10301)) +#define IS_SPMM_AVAILABLE() 1 +#else +#define IS_SPMM_AVAILABLE() 0 +#endif #if IS_SPMM_AVAILABLE() #include