在 windows 上构建 pytorch 时出现 C1001 内部编译器错误

Getting C1001 Internal compiler error when building pytorch on windows

我正在尝试使用 visual studio 在 windows 上构建 Pytorch,但它似乎面临一些内部编译器错误,我无法找出其原因。 在 46 个目标中,有 35 个成功构建,直到最终失败并出现以下错误。 在列出错误之前,我是这样构建它的:

git clone --branch v1.6.0 https://github.com/pytorch/pytorch.git pytorch-1.6.0
cd pytorch-1.6.0
git submodule update --init --recursive
set CUDAHOSTCXX=
set DISTUTILS_USE_SDK=1
for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=14.27
python setup.py build --cmake-only
cmake-gui

这就是我后来所做的:

构建输出:

1>------ Build started: Project: defs.bzl, Configuration: Release x64 ------
2>------ Build started: Project: ATEN_CPU_FILES_GEN_TARGET, Configuration: Release x64 ------
3>------ Build started: Project: dnnl_cpu, Configuration: Release x64 ------
4>------ Build started: Project: generate-torch-sources, Configuration: Release x64 ------
5>------ Build started: Project: python_copy_files, Configuration: Release x64 ------
6>------ Build started: Project: gen_onnx_proto, Configuration: Release x64 ------
4>Generating ../../torch/csrc/autograd/generated/Functions.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_0.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_1.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_2.cpp, ../../torch/csrc/autograd/generated/VariableType_0.cpp, ../../torch/csrc/autograd/generated/VariableType_1.cpp, ../../torch/csrc/autograd/generated/VariableType_2.cpp, ../../torch/csrc/autograd/generated/VariableType_3.cpp, ../../torch/csrc/autograd/generated/VariableType_4.cpp, ../../torch/csrc/autograd/generated/ProfiledType_0.cpp, ../../torch/csrc/autograd/generated/ProfiledType_1.cpp, ../../torch/csrc/autograd/generated/ProfiledType_2.cpp, ../../torch/csrc/autograd/generated/ProfiledType_3.cpp, ../../torch/csrc/autograd/generated/ProfiledType_4.cpp, ../../torch/csrc/autograd/generated/TraceType_0.cpp, ../../torch/csrc/autograd/generated/TraceType_1.cpp, ../../torch/csrc/autograd/generated/TraceType_2.cpp, ../../torch/csrc/autograd/generated/TraceType_3.cpp, ../../torch/csrc/autograd/generated/TraceType_4.cpp, ../../torch/csrc/autograd/generated/Functions.h, ../../torch/csrc/autograd/generated/variable_factories.h, ../../torch/csrc/autograd/generated/VariableType.h, ../../torch/csrc/autograd/generated/python_functions.cpp, ../../torch/csrc/autograd/generated/python_variable_methods.cpp, ../../torch/csrc/autograd/generated/python_torch_functions.cpp, ../../torch/csrc/autograd/generated/python_nn_functions.cpp, ../../torch/csrc/autograd/generated/python_functions.h
7>------ Build started: Project: __aten_op_header_gen, Configuration: Release x64 ------
8>------ Build started: Project: torch_python_stubs, Configuration: Release x64 ------
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cpu_concat.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cpu_layer_normalization_list.cpp
3>cpu_shuffle_list.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>gemm_convolution_utils.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>ref_convolution.cpp
3>ref_deconvolution.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>ref_eltwise.cpp
3>cl : command line warning D9025: overriding '/W1' with '/w'
3>ref_inner_product.cpp
3>ref_layer_normalization.cpp
3>ref_lrn.cpp
3>ref_pooling.cpp
3>ref_resampling.cpp
3>ref_shuffle.cpp
3>ref_softmax.cpp
3>D:\Codes\pytorch-1.6.0\third_party\ideep\mkl-dnn\src\cpu\gemm_convolution_utils.cpp(401): fatal error C1001: Internal compiler error.
3>(compiler file 'd:\agent\_work\s\src\vctools\Compiler\Utc\src\p2\main.c', line 195)
3> To work around this problem, try simplifying or changing the program near the locations listed above.
3>If possible please provide a repro here: https://developercommunity.visualstudio.com
3>Please choose the Technical Support command on the Visual C++
3> Help menu, or open the Technical Support help file for more information
3>  CL!RaiseException()+0x69
3>  CL!RaiseException()+0x69
3>  CL!CloseTypeServerPDB()+0x22e6b
3>  CL!CloseTypeServerPDB()+0xcd30a
3>simple_concat.cpp
3>simple_layer_normalization.cpp
3>simple_layer_normalization_kernels.cpp
3>simple_resampling.cpp
3>simple_sum.cpp
3>gemm_utils_f32.cpp
3>ref_gemm_f32.cpp
3>gemm.cpp
3>gemm_pack.cpp
3>ref_gemm_s8x8s32.cpp
3>simple_gemm_s8s8s32.cpp
3>cpu_matmul_list.cpp
3>cl : command line error D8040: error creating or communicating with child process
3>Done building project "dnnl_cpu.vcxproj" -- FAILED.
9>------ Build started: Project: dnnl, Configuration: Release x64 ------
9>Microsoft (R) Library Manager Version 14.27.29111.0
9>Copyright (C) Microsoft Corporation.  All rights reserved.
9>
9>"/OUT:D:\Codes\pytorch-1.6.0\build_dir\lib\Release\dnnl.lib" /NOLOGO /MACHINE:X64 /machine:x64 /ignore:4049 /ignore:4217 dnnl.dir\Release\version.res
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\batch_normalization.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\binary.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\concat.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\convolution.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\convolution_pd.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\deconvolution.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\dnnl_debug.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\dnnl_debug_autogenerated.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\eltwise.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\engine.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\inner_product.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\layer_normalization.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\lrn.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\matmul.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_debug.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_desc_wrapper.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_storage.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\memory_zero_pad.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\pooling.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_attr.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_cache.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_desc.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_exec_types.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_hashing.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\primitive_iterator.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\query.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\reorder.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\resampling.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\rnn.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\rw_mutex.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\scratchpad.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\scratchpad_debug.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\shuffle.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\softmax.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\stream.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\stream_attr.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\sum.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\utils.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\common\dnnl_common.dir\Release\verbose.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\bfloat16.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_batch_normalization_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_batch_normalization_utils.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_binary_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_concat.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_convolution_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_deconvolution_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_eltwise_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_engine.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_inner_product_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_layer_normalization_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_lrn_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_pooling_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_reorder.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_resampling_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_rnn_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_shuffle_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_softmax_list.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\cpu_sum.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution.obj"
9>"D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution_utils.obj"
9>D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution_utils.obj : fatal error LNK1136: invalid or corrupt file
9>Done building project "dnnl.vcxproj" -- FAILED.
10>------ Build started: Project: torch_cpu, Configuration: Release x64 ------
11>------ Build started: Project: compat_libs, Configuration: Release x64 ------
11>Error copying file "D:/Codes/pytorch-1.6.0/build_dir/lib/Release/dnnl.lib" to "D:/Codes/pytorch-1.6.0/build_dir/lib/Release/mkldnn.lib".
11>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6006: "cmd.exe" exited with code 1.
11>Done building project "compat_libs.vcxproj" -- FAILED.
10>Generating ../../torch/csrc/autograd/generated/Functions.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_0.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_1.cpp, ../../torch/csrc/jit/generated/generated_unboxing_wrappers_2.cpp, ../../torch/csrc/autograd/generated/VariableType_0.cpp, ../../torch/csrc/autograd/generated/VariableType_1.cpp, ../../torch/csrc/autograd/generated/VariableType_2.cpp, ../../torch/csrc/autograd/generated/VariableType_3.cpp, ../../torch/csrc/autograd/generated/VariableType_4.cpp, ../../torch/csrc/autograd/generated/ProfiledType_0.cpp, ../../torch/csrc/autograd/generated/ProfiledType_1.cpp, ../../torch/csrc/autograd/generated/ProfiledType_2.cpp, ../../torch/csrc/autograd/generated/ProfiledType_3.cpp, ../../torch/csrc/autograd/generated/ProfiledType_4.cpp, ../../torch/csrc/autograd/generated/TraceType_0.cpp, ../../torch/csrc/autograd/generated/TraceType_1.cpp, ../../torch/csrc/autograd/generated/TraceType_2.cpp, ../../torch/csrc/autograd/generated/TraceType_3.cpp, ../../torch/csrc/autograd/generated/TraceType_4.cpp, ../../torch/csrc/autograd/generated/Functions.h, ../../torch/csrc/autograd/generated/variable_factories.h, ../../torch/csrc/autograd/generated/VariableType.h, ../../torch/csrc/autograd/generated/python_functions.cpp, ../../torch/csrc/autograd/generated/python_variable_methods.cpp, ../../torch/csrc/autograd/generated/python_torch_functions.cpp, ../../torch/csrc/autograd/generated/python_nn_functions.cpp, ../../torch/csrc/autograd/generated/python_functions.h
4>Skipped writing torch/csrc\autograd\generated\python_functions.h
4>Skipped writing torch/csrc\autograd\generated\python_functions.cpp
4>Skipped writing torch/csrc\autograd\generated\python_variable_methods.cpp
4>Skipped writing torch/csrc\autograd\generated\python_torch_functions.cpp
4>Skipped writing torch/csrc\autograd\generated\python_nn_functions.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType.h
4>Skipped writing torch/csrc\autograd\generated\VariableType_0.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_0.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_0.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_1.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_1.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_1.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_2.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_2.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_2.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_3.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_3.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_3.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableType_4.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledType_4.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceType_4.cpp
4>Skipped writing torch/csrc\autograd\generated\VariableTypeEverything.cpp
4>Skipped writing torch/csrc\autograd\generated\ProfiledTypeEverything.cpp
4>Skipped writing torch/csrc\autograd\generated\TraceTypeEverything.cpp
4>Skipped writing torch/csrc\autograd\generated\RegistrationDeclarations.h
4>Skipped writing torch/csrc\autograd\generated\Functions.h
4>Skipped writing torch/csrc\autograd\generated\Functions.cpp
4>Skipped writing torch/csrc\autograd\generated\variable_factories.h
4>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_0.cpp
4>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_1.cpp
4>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_2.cpp
10>Skipped writing torch/csrc\autograd\generated\python_functions.h
10>Skipped writing torch/csrc\autograd\generated\python_functions.cpp
10>Skipped writing torch/csrc\autograd\generated\python_variable_methods.cpp
10>Skipped writing torch/csrc\autograd\generated\python_torch_functions.cpp
10>Skipped writing torch/csrc\autograd\generated\python_nn_functions.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType.h
10>Skipped writing torch/csrc\autograd\generated\VariableType_0.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_0.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_0.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_1.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_1.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_1.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_2.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_2.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_2.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_3.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_3.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_3.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableType_4.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledType_4.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceType_4.cpp
10>Skipped writing torch/csrc\autograd\generated\VariableTypeEverything.cpp
10>Skipped writing torch/csrc\autograd\generated\ProfiledTypeEverything.cpp
10>Skipped writing torch/csrc\autograd\generated\TraceTypeEverything.cpp
10>Skipped writing torch/csrc\autograd\generated\RegistrationDeclarations.h
10>Skipped writing torch/csrc\autograd\generated\Functions.h
10>Skipped writing torch/csrc\autograd\generated\Functions.cpp
10>Skipped writing torch/csrc\autograd\generated\variable_factories.h
10>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_0.cpp
10>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_1.cpp
10>Skipped writing torch/csrc\jit\generated\generated_unboxing_wrappers_2.cpp
10>LINK : fatal error LNK1181: cannot open input file '..\lib\Release\dnnl.lib'
10>Done building project "torch_cpu.vcxproj" -- FAILED.
12>------ Build started: Project: torch, Configuration: Release x64 ------
12>LINK : fatal error LNK1181: cannot open input file '..\lib\Release\torch_cpu.lib'
12>Done building project "torch.vcxproj" -- FAILED.
13>------ Build started: Project: caffe2_pybind11_state, Configuration: Release x64 ------
14>------ Build started: Project: shm, Configuration: Release x64 ------
15>------ Build started: Project: caffe2_observers, Configuration: Release x64 ------
16>------ Build started: Project: caffe2_detectron_ops, Configuration: Release x64 ------
15>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\torch.lib'
15>Done building project "caffe2_observers.vcxproj" -- FAILED.
14>LINK : fatal error LNK1181: cannot open input file '..\..\..\..\lib\Release\torch.lib'
14>Done building project "shm.vcxproj" -- FAILED.
17>------ Build started: Project: torch_python, Configuration: Release x64 ------
18>------ Build started: Project: windows_python_copy_lib, Configuration: Release x64 ------
16>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\torch.lib'
16>Done building project "caffe2_detectron_ops.vcxproj" -- FAILED.
18>Error copying file "D:/Codes/pytorch-1.6.0/build_dir/caffe2/python/Release/caffe2_pybind11_state.cp37-win_amd64.pyd" to "D:/Codes/pytorch-1.6.0/build_dir/caffe2/python".
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: The command "setlocal
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -E copy D:/Codes/pytorch-1.6.0/build_dir/caffe2/python/Release/caffe2_pybind11_state.cp37-win_amd64.pyd D:/Codes/pytorch-1.6.0/build_dir/caffe2/python
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmEnd
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmErrorLevel
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: exit /b %1
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :cmDone
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd
18>C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(149,5): error MSB3073: :VCEnd" exited with code 1.
18>Done building project "windows_python_copy_lib.vcxproj" -- FAILED.
17>LINK : fatal error LNK1181: cannot open input file '..\..\lib\Release\shm.lib'
17>Done building project "torch_python.vcxproj" -- FAILED.
========== Build: 7 succeeded, 11 failed, 28 up-to-date, 0 skipped ==========

链接器错误:

Severity    Code    Description Project File    Line    Suppression State
Error   C1001   Internal compiler error.    dnnl_cpu    D:\Codes\pytorch-1.6.0\third_party\ideep\mkl-dnn\src\cpu\gemm_convolution_utils.cpp 401 
Error   D8040   error creating or communicating with child process  dnnl_cpu    D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\cl   1   
Error   LNK1136 invalid or corrupt file dnnl    D:\Codes\pytorch-1.6.0\build_dir\third_party\ideep\mkl-dnn\src\cpu\dnnl_cpu.dir\Release\gemm_convolution_utils.obj  1   
Error   MSB6006 "cmd.exe" exited with code 1.   compat_libs C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets    234 
Error   LNK1181 cannot open input file '..\lib\Release\dnnl.lib'    torch_cpu   D:\Codes\pytorch-1.6.0\build_dir\caffe2\LINK    1   
Error   LNK1181 cannot open input file '..\lib\Release\torch_cpu.lib'   torch   D:\Codes\pytorch-1.6.0\build_dir\caffe2\LINK    1   
Error   LNK1181 cannot open input file '..\..\lib\Release\torch.lib'    caffe2_observers    D:\Codes\pytorch-1.6.0\build_dir\modules\observers\LINK 1   
Error   LNK1181 cannot open input file '..\..\..\..\lib\Release\torch.lib'  shm D:\Codes\pytorch-1.6.0\build_dir\caffe2\torch\lib\libshm_windows\LINK   1   
Error   LNK1181 cannot open input file '..\..\lib\Release\torch.lib'    caffe2_detectron_ops    D:\Codes\pytorch-1.6.0\build_dir\modules\detectron\LINK 1   
Error   MSB3073 The command "setlocal
"C:\Program Files\CMake\bin\cmake.exe" -E copy D:/Codes/pytorch-1.6.0/build_dir/caffe2/python/Release/caffe2_pybind11_state.cp37-win_amd64.pyd D:/Codes/pytorch-1.6.0/build_dir/caffe2/python
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd
:VCEnd" exited with code 1. windows_python_copy_lib C:\Program Files (x86)\Microsoft Visual Studio19\Enterprise\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets    149 
Error   LNK1181 cannot open input file '..\..\lib\Release\shm.lib'  torch_python    D:\Codes\pytorch-1.6.0\build_dir\caffe2\torch\LINK  1   

我在这里错过了什么?

内部编译器错误始终是编译器的错误。在这种情况下,它会阻止构建稍后在构建过程中需要的库。

您的选择有限。我建议尝试不同版本的 Visual Studio.

您还应将此报告给 Microsoft。

你不是the first to encounter this issue:

Moving from Visual Studio v16.6.4 to v16.7.1, we now see the following error when compiling oneDNN:

[path]src\cpu\gemm_convolution_utils.cpp(401) : fatal error C1001: Internal compiler error.

您的问题的解决方法是 included in Pytorch 1.6.2

编译器 bug 本身仍然是 under investigation,到今天还没有解决。