-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Fixed bug reported by a static verifier #10452
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
6df2c6a
Coverity - Copy without assign issues
eunakim0103 e5c94c7
Coverity - logically dead code removal
eunakim0103 f337375
Coverity - Missing assignment operator issues fixed
eunakim0103 bed2656
added a default case in switch to check BinaryType
eunakim0103 e86d89a
added assert and return in the default case
eunakim0103 4bf1d35
added print out to check the BinaryType value
eunakim0103 a6172cb
fixed print statement to flush the message
eunakim0103 f0f732d
initialzed the BinaryType
eunakim0103 d81d3fc
Merge branch 'sycl' into coverity_bug_fix_new
eunakim0103 c537282
removed assert() to check the default case of the BinaryType value
eunakim0103 dd51099
clang format error fixed
eunakim0103 6f06a55
user defined assignment operator added
eunakim0103 cf98c3f
added a user defined assignment operator
eunakim0103 95cae55
user defined assignment operator fixed to delete since they are not used
eunakim0103 81d0cee
Added an user-defined assignment operator
eunakim0103 c2738e7
Fixed clang-format error
eunakim0103 e3ccb19
Update program_impl.cpp
eunakim0103 3db657a
Change the comment phrase
eunakim0103 9a7da9a
The comment has been improved
eunakim0103 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 a good diagnostic to find errors during some code refactoring, now it is removed, so suggest adding the default case and add assert(false) in it.
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.
Good suggestion but basically this "Logically dead code" is because there is code to check if BinaryType is PI_PROGRAM_BINARY_TYPE_NONE and throw an exception in line 173. Coverity reported case PI_PROGRAM_BINARY_TYPE_NONE is redundancy and logically dead code.
173 if (BinaryType == PI_PROGRAM_BINARY_TYPE_NONE) {
174 throw invalid_object_error(
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.
Still it is helpful for us during the refactoring if the exception is removed
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.
Added a default case as advised
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.
Maybe do
instead?
Uh oh!
There was an error while loading. Please reload this page.
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 agree logically. I need to check the BinaryType values if there is any cases it shouldn't return in the any other part of code since the original code doesn't have default case and return. It may cause behavior changes when BinaryType is neither PI_PROGRAM_BINARY_TYPE_NONE nor when other values are not covered in the case selections if we add assert or return. I will investigate and update shortly.
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.
There are no other values of BinaryType which are not covered in switch case. I believe we can add assert(false) and return in the default case. Thanks!
Uh oh!
There was an error while loading. Please reload this page.
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.
It seems the BinaryType value is invalid and switch-default addition caught it. The BinaryType was 3 in Intel Gen9 system which did not happen with my testing machine.
cl_program_binary_type BinaryType;
typedef enum {
PI_PROGRAM_BINARY_TYPE_NONE = 0x0,
PI_PROGRAM_BINARY_TYPE_COMPILED_OBJECT = 0x1,
PI_PROGRAM_BINARY_TYPE_LIBRARY = 0x2,
PI_PROGRAM_BINARY_TYPE_EXECUTABLE = 0x4
} _pi_program_binary_type;
command stderr:
online_compiler_L0.cpp.tmp.out: /__w/llvm/llvm/src/sycl/source/detail/program_impl.cpp:200: sycl::_V1::detail::program_impl::program_impl(sycl::_V1::detail::ContextImplPtr, pi_native_handle, sycl::_V1::detail::pi::PiProgram): Assertion `false && "BinaryType is invalid."' failed.