-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix the warnings found by VC++ static code analyzer and add it to the CPU CI build #7121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| condition: and(succeeded(), eq(variables['BuildConfig'], 'Debug')) | ||
| inputs: | ||
| scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py' | ||
| arguments: '--config Debug --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --update --cmake_generator "Visual Studio 16 2019" --build_wheel --build_shared_lib --enable_onnx_tests --cmake_extra_defines onnxruntime_ENABLE_STATIC_ANALYSIS=ON' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--enable_onnx_tests [](start = 197, length = 19)
do we need stuff like enabling the onnx tests if we're doing static analysis, or can we just keep it to the core code (could maybe turn off building of all the unit tests to make it faster as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "enable_onnx_tests" build flags doesn't control if the unit tests would be built. onnxruntime_BUILD_UNIT_TESTS does that. I think it's OK to keep it ON, it won't cost much time. Either works.
| } | ||
|
|
||
| void Cancel() override { | ||
| cancelled_ = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we need this if we did anything more for parallel and/or async execution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is mainly needed for fast failing. Suppose you have summited a "parallel for" code block with 4 threadpool tasks to a thread pool, and one of the tasks failed. If you want to quickly cancel the other 3 without continue to wait them being finished, then a cancel method would help. If everything was fine, then we don't need to cancel the pending or running tasks.
|
I'm still working on this. |
c35ff35 to
f1839b4
Compare
|
Now it's ready for review. |
| endif() | ||
|
|
||
| if (onnxruntime_USE_OPENVINO) | ||
| if(NOT onnxruntime_ENABLE_STATIC_ANALYSIS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a "if() ... endif()". The code between them is unchanged.
| switch (code) { | ||
| case ORT_OK: | ||
| return 0; | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed tabs to spaces.
| onnxruntime_add_shared_library_module(onnxruntime4j_jni ${onnxruntime4j_native_src}) | ||
| set_property(TARGET onnxruntime4j_jni PROPERTY CXX_STANDARD 11) | ||
|
|
||
| # Tell the JNI code about the requested providers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this code removed? It's used to cause the JNI code to emit a well formed exception if the provider isn't available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved it to CMakeLists.txt. And I think the things like "USE_OPENVINO" should not be used in the JNI project. I suggest the macro should be always on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the provider list exists in the C API I guess I can check that and throw the exception, but if you look in SessionOptions.c it's used to either compile the JNI method so it always throws a Java exception, or to compile it so it adds the requested provider. I'm not sure how stable that provider list is though, as it's not in the C API itself, I've got to manually copy the string constants into Java and check them.
| * @param deviceId The id of the OpenVINO execution device. | ||
| * @throws OrtException If there was an error in native code. | ||
| */ | ||
| public void addOpenVINO(String deviceId) throws OrtException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realise these need shared library support which isn't currently possible in Java, but is there some other reason they are being removed? Are these two providers deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean isn't currently possible ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes which broke out OpenVINO, DNNL and TensorRT into separate shared libraries broke the Java API wrappers around those providers. I opened #6553 as we'll package those shared libraries into the jar, and so need to be able to load them from a non-standard place, but as there's been no progress there they are broken in the current release and it's been broken since those providers are converted into shared libraries. When this (https://communities.sas.com/t5/SAS-Communities-Library/SAS-and-Microsoft-collaborate-to-democratize-the-use-of-Deep/ta-p/730072) lands it'll break CUDA too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW I've got the code ready to go to move these providers over to the new API point (with the struct), but I can't test it because Java can't load the library.
| * \param device_type openvino device type and precision. Could be any of | ||
| * CPU_FP32, GPU_FP32, GPU_FP16, MYRIAD_FP16, VAD-M_FP16 or VAD-F_FP32. | ||
| */ | ||
| ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_OpenVINO, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are these api's being removed for OpenVINO and TensorRT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the deprecated one, and it misses features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay. originally i was going to let Intel handle it, but looks like they didn't remove this yet.
| // End of Version 6 - DO NOT MODIFY ABOVE (see above text for more information) | ||
|
|
||
| public IntPtr ModelMetadataGetGraphDescription; | ||
| public IntPtr SessionOptionsAppendExecutionProvider_TensorRT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the new API we should use
|
I'll wait #7315 merge first. |
|
I will split it to smaller pieces. |
Description:
Motivation and Context
Before this change, we even didn't test any EPs(other than CPU) in the java code.