microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.84k stars 2.94k forks source link

[Build] Win32 builds of DML provider fail due to "warnings as errors" #18644

Closed BengtGustafsson closed 2 months ago

BengtGustafsson commented 12 months ago

Describe the issue

Compile errors in DML provider code when building using -x86 and -use_dml.

All errors I found was due to "errors as warnings" being turned on, and the actual warnings were due to implicit conversions from 64 to 32 bit integers. I have no idea if there are real risks or just misuse of uint64_t where it should have been size_t.

Please add 32 bit VS2022 builds to your standard check builds as this is the third time 32 bit builds have failed. Also add Debug builds, as some of these errors were only occurring in debug builds.

Urgency

Quite urgent as we have a fair amount of customers who still have 32 bit executables linking to our dll. As DML is the only GPU provider available for 32 bit we're stuck with CPU if this isn't fixed.

Target platform

Win 32 bit VS 2022

Build script

build.py --build_dir 'C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows' --config Release --parallel 1 --build_shared_lib --x86 --build_dir build/Windows --skip_tests --use_dml

Error / output

DmlGraphFusionHelper.cpp C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\DmlGraphFusionHelper.cpp(666,27): error C2220: the following warning is treated as an error [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\DmlGraphFusionHelper.cpp(666,27): warning C4018: '<': signed/unsigned mismatch [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] DmlGraphFusionTransformer.cpp DmlRuntimeFusedGraphKernel.cpp DmlRuntimeGraphFusionTransformer.cpp ExecutionContext.cpp C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\DmlRuntimeFusedGraphKernel.cpp(96,13): error C2220: the following warning is treated as an error [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\DmlRuntimeFusedGraphKernel.cpp(96,13): warning C4389: '!=': signed/unsigned mismatch [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\DmlRuntimeFusedGraphKernel.cpp(129,47): warning C4018: '<': signed/unsigned mismatch [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\DmlRuntimeFusedGraphKernel.cpp(162,25): warning C4389: '!=': signed/unsigned mismatch [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] ExecutionProvider.cpp FusedGraphKernel.cpp GraphDescBuilder.cpp GraphPartitioner.cpp C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\GraphDescBuilder.cpp(252,49): error C2220: the following warning is treated as an error [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\GraphDescBuilder.cpp(252,49): warning C4018: '<': signed/unsigned mismatch [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\onnxruntime\core\providers\dml\DmlExecutionProvider\src\GraphDescBuilder.cpp(283,31): warning C4018: '<': signed/unsigned mismatch [C:\gitlab-runner\builds\jPy2EUhK\0\cv\impl\thirdpartylibs\onnxruntime\build\Windows\Release\onnxruntime_providers_dml.vcxproj] GraphTransformer.cpp MLOperatorAuthorImpl.cpp DmlOperator.cpp

Visual Studio Version

VS 2022 17.7

GCC / Compiler Version

No response

BengtGustafsson commented 12 months ago

Come to think of it, those warnings may be new in 17.6 or 17.7, I think I saw some new warnings in our builds too.

BengtGustafsson commented 11 months ago

I don't know why you removed those labels, @snnn . They seem correct. It is a build error that happens only on Windows.

snnn commented 11 months ago

Right. It is a build error that happens only on Windows. But it is not about the build scripts. It is more about the C/C++ code. The "ep:DML" flag is to notify the owners of the DmlExecutionProvider.

BengtGustafsson commented 10 months ago

Any progress on this? I notice that 1.17 seems imminent but it doesn't seem this will be fixed. How old MSVC are you actually using for your testing? If you updated your compilers you would be hit by this immediately.

This is really bad for us, we would really need the DML provider as it is the only option for 32 bit on GPU, AFAIK.

BengtGustafsson commented 2 months ago

This seems to have been fixed in 1.19.2.

BengtGustafsson commented 1 week ago

It wasn't, actually, but now it is fixed in 1.20.