Hello there,
I switched recently a project from libtorch 1.7.0 to 1.8.0, under MS Visual Studio C++ 2017. We are using warning as error in our code, so I had to disable an additional warning 4624 (about automatically deleted destructor or something like that), but also had to patch a c10 macros header file to be able to compile.
The file is :…/libtorch_cuda11_release/include/c10/macros/Macros.h
When declaring _C10_ALWAYS_INLINE , the header uses __has_attribute preprocessor, which does not exist under MSVC.
The code :
#if __has_attribute(always_inline) || defined(__GNUC__)
	#define C10_ALWAYS_INLINE __attribute__((__always_inline__)) inline
#elif defined(_MSC_VER)
	#define C10_ALWAYS_INLINE __forceinline
#else
	#define C10_ALWAYS_INLINE inline
#endif	

Should be replaced by something like :
#if defined __has_attribute
#if __has_attribute(always_inline) || defined(GNUC)
#define C10_ALWAYS_INLINE attribute((always_inline)) inline
#elif defined(_MSC_VER)
#define C10_ALWAYS_INLINE __forceinline
#else
#define C10_ALWAYS_INLINE inline
#endif	
#elif defined(_MSC_VER)
#define C10_ALWAYS_INLINE __forceinline
#else
#define C10_ALWAYS_INLINE inline
#endif
Or anything simpler, testing first for MSVC maybe
Could it be integrated in the nightly ? That would avoid manually patching future versions.
Best