Issue 1:
🐛 Bug

Error text:

[1054/2736] Building CXX object caffe2\CMakeFiles\torch_cpu.dir\__\aten\src\ATen\ExpandUtils.cpp.obj
FAILED: caffe2/CMakeFiles/torch_cpu.dir/__/aten/src/ATen/ExpandUtils.cpp.obj
C:\w\1\s\windows\tmp_bin\sccache.exe cl /nologo /TP -DAT_PARALLEL_OPENMP=1 -DCPUINFO_SUPPORTED_PLATFORM=1 -DMAGMA_V2 -DONNX_ML=1 -DONNX_NAMESPACE=onnx_torch -DTH_BLAS_MKL -DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE=1 -D_OPENMP_NOFORCE_MANIFEST -Dtorch_cpu_EXPORTS -Iaten\src -I..\aten\src -I. -I..\ -I..\cmake\..\third_party\benchmark\include -Icaffe2\contrib\aten -I..\third_party\onnx -Ithird_party\onnx -I..\third_party\foxi -Ithird_party\foxi -I..\caffe2\..\torch\csrc\api -I..\caffe2\..\torch\csrc\api\include -I..\caffe2\aten\src\TH -Icaffe2\aten\src\TH -I..\caffe2\..\torch\..\aten\src -Icaffe2\aten\src -Icaffe2\..\aten\src -Icaffe2\..\aten\src\ATen -I..\caffe2\..\torch\csrc -I..\caffe2\..\torch\..\third_party\miniz-2.0.8 -I..\aten\src\TH -I..\aten\..\third_party\catch\single_include -I..\aten\src\ATen\.. -Icaffe2\aten\src\ATen -I..\third_party\miniz-2.0.8 -I..\caffe2\core\nomnigraph\include -I..\c10\.. -I..\third_party\cpuinfo\include -I..\third_party\FP16\include -I..\cmake\..\third_party\googletest\googlemock\include -I..\cmake\..\third_party\googletest\googletest\include -I..\third_party\protobuf\src -IC:\w\1\s\windows\mkl\include -I..\cmake\..\third_party\eigen -IC:\w\1\s\windows\conda\envs\py37\include -IC:\w\1\s\windows\conda\envs\py37\lib\site-packages\numpy\core\include -I..\cmake\..\third_party\pybind11\include -I\opt\rocm\hip\include -I\include -I..\cmake\..\third_party\cub -IC:\w\1\s\windows\magma_cuda101_release\include -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I..\caffe2 /DWIN32 /D_WINDOWS /GR /w /EHa /MP /bigobj -openmp -DHAVE_AVX_CPU_DEFINITION -DHAVE_AVX2_CPU_DEFINITION /MD /O2 /Ob2 /w /EHa /MP /bigobj -DCUDA_HAS_FP16=1 -DUSE_GCC_GET_CPUID -DUSE_AVX -DUSE_AVX2 -DTH_HAVE_THREAD /Z7 /EHa /DNOMINMAX /wd4267 /wd4251 /wd4522 /wd4838 /wd4305 /wd4244 /wd4190 /wd4101 /wd4996 /wd4275 /bigobj -O2 -DCAFFE2_BUILD_MAIN_LIB -DONNX_BUILD_MAIN_LIB -std:c++14 /showIncludes /Focaffe2\CMakeFiles\torch_cpu.dir\__\aten\src\ATen\ExpandUtils.cpp.obj /Fdcaffe2\CMakeFiles\torch_cpu.dir\ /FS -c ..\aten\src\ATen\ExpandUtils.cpp
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(302): error C2061: syntax error: identifier 'IValue'
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(302): error C2238: unexpected token(s) preceding ';'
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(306): error C2988: unrecognizable template declaration/definition
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(306): error C2059: syntax error: 'return'
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(306): error C2653: 'Tag': is not a class or namespace name
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(306): error C2238: unexpected token(s) preceding ';'
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(307): error C2146: syntax error: missing ';' before identifier 'toGenericDict'
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(307): error C2270: 'toGenericDict': modifiers not allowed on nonmember functions
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(63): error C2653: 'Tag': is not a class or namespace name
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(63): error C2065: 'None': undeclared identifier
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(63): error C2614: 'c10::IValue': illegal member initialization: 'payload' is not a base or member
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(63): error C2614: 'c10::IValue': illegal member initialization: 'tag' is not a base or member
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(63): error C2614: 'c10::IValue': illegal member initialization: 'is_intrusive_ptr' is not a base or member
C:\w\1\s\windows\pytorch\aten\src\ATen/core/ivalue.h(63): fatal error C1903: unable to recover from previous error(s); stopping compilation
Internal Compiler Error in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe. You will be prompted to send an error report to Microsoft later.
INTERNAL COMPILER ERROR in 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX64\x64\cl.exe'
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

To Reproduce

Steps to reproduce the behavior:

python setup.py install

Expected behavior

Environment

Please copy and paste the output from our

environment collection script

(or fill out the checklist below manually).

You can get the script and run it with:

wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py
# For security purposes, please check the contents of collect_env.py before running it.
python collect_env.py

PyTorch Version (e.g., 1.0): 3c8892a

OS (e.g., Linux): Windows

How you installed PyTorch (conda, pip, source): source

Build command you used (if compiling from source): source

Python version: 3.5/3.6/3.7

CUDA/cuDNN version: Node / 9.2 / 10.1

GPU models and configuration: None

Any other relevant information:

Additional context

cc @peterjc123

Issue 2:
🐛 Bug

When trying to compile with VS2019 but targeting v141 toolchain and cuda 10.0 there seems to be some issues with rewrite of dispatching that was done in recent weeks.

This snippet was from building using facebook internal Buck, but I was able to reproduce same thing using cmake.

Compiling with /permissive- fixed the "no matching overload" error, but raises some other cuda errors related to __nv_hdl_create_wrapper_t

To Reproduce

Steps to reproduce the behavior:

checkout pytorch master

pass v141 as toolchain to cmake when generating

set cuda sdk root to 10.0

try and build torch_cuda

Error without /permissive-

caffe2\aten\src\aten\core\boxing\KernelFunction_impl.h(67): error C2672: 'c10::impl::boxAndCallBoxedFunc': no matching overloaded function found
caffe2/aten/src\ATen/core/dispatch/Dispatcher.h(180): note: see reference to function template instantiation 'Return c10::KernelFunction::callUnboxed<Return,const at::Tensor&,const at::Tensor&,bool,bool>(const c10::OperatorHandle &,const at::Tensor &,const at::Tensor &,bool,bool) const' being compiled
with
[
Return=void
]
caffe2/aten/src\ATen/core/dispatch/Dispatcher.h(155): note: see reference to function template instantiation 'Return c10::Dispatcher::callUnboxed<Return,const at::Tensor&,const at::Tensor&,bool,bool>(const c10::OperatorHandle &,const at::Tensor &,const at::Tensor &,bool,bool) const' being compiled
with
[
Return=void
]
caffe2\ATen/core/TensorMethods.h(66): note: see reference to function template instantiation 'Return c10::OperatorHandle::callUnboxed<void,const at::Tensor&,const at::Tensor&,bool,bool>(const at::Tensor &,const at::Tensor &,bool,bool) const' being compiled
with
[
Return=void
]
caffe2\aten\src\aten\core\boxing\KernelFunction_impl.h(67): error C2770: invalid explicit template argument(s) for 'Result c10::impl::boxAndCallBoxedFunc(c10::KernelFunction::InternalBoxedKernelFunction (__cdecl *),c10::OperatorKernel *,const c10::OperatorHandle &,Args...,enable_if<_Test,_Ty>::type)'
with
[
_Ty=int
]
caffe2/aten/src\ATen/core/boxing/boxing.h(53): note: see declaration of 'c10::impl::boxAndCallBoxedFunc'
caffe2\aten\src\aten\core\boxing\KernelFunction_impl.h(67): error C2893: Failed to specialize function template 'Result c10::impl::boxAndCallBoxedFunc(c10::KernelFunction::InternalBoxedKernelFunction (__cdecl *),c10::OperatorKernel *,const c10::OperatorHandle &,Args...,enable_if<_Test,_Ty>::type)'
with
[
_Ty=int
]
caffe2\aten\src\aten\core\boxing\KernelFunction_impl.h(67): note: With the following template arguments:
caffe2\aten\src\aten\core\boxing\KernelFunction_impl.h(67): note: 'Result=Return'
caffe2\aten\src\aten\core\boxing\KernelFunction_impl.h(67): note: 'Args={}'

Error with /permissive-

nvcc_internal_extended_lambda_implementation(542): error C3861: 'args': identifier not found
caffe2/aten/src/ATen/native/cuda/Copy.cu(62): note: see reference to class template instantiation '__nv_hdl_create_wrapper_t<false,true,__nv_dl_tag<void (__cdecl *)(at::TensorIterator &,bool),at::native::copy_device_to_device,1>>' being compiled

Expected behavior

files compile

cc @ezyang @gchanan @zou3519 @yf225 @peterjc123