Skip to content
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

Fix Coverity INVALIDATE_ITERATOR defects. #2584

Closed
wants to merge 2 commits into from

Conversation

isaacault
Copy link
Contributor

No description provided.

@isaacault isaacault requested a review from a team as a code owner January 20, 2025 03:51
@github-actions github-actions bot added the common Changes or additions to common utilities label Jan 20, 2025
if (auto iter = map.find(getKey(key)); iter != map.end()) {
iter->second.ref_count++;
} else {
__builtin_unreachable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a function:

[[noreturn]] inline void unreachable() {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer using unreachable in favour of abort() - see below.

if (auto iter = map.find(getKey(key)); iter != map.end()) {
iter->second.ref_count++;
} else {
__builtin_unreachable();
Copy link
Contributor

@RossBrunton RossBrunton Jan 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure removing the assert (what this is functionally equivalent to) is the correct resolution here - it's possible for an error in UR code to retain an error value, and I think flagging that issue in a debug build is useful. I don't think this also resolves the Coverity error either.

If we do want to improve the error checking and have it work in release mode, I think calling abort() with an error message is the best move.

Edit: To explain why it is equivalent, consider that __builtin_unreachable has undefined behaviour. Since undefined behaviour must Never Happen, the compiler may reason that the true branch of the conditional is always taken, and replace it with just auto iter = map.find(getKey(key)); iter->second.ref_count++.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Error message sent to the logger.

@isaacault isaacault force-pushed the INVALIDATE_ITERATOR branch 2 times, most recently from 9c4696f to fc8431d Compare January 22, 2025 23:28
@RossBrunton
Copy link
Contributor

This file will be removed by #2622

@martygrant
Copy link
Contributor

Unified Runtime -> intel/llvm Repo Move Notice

Information

The source code of Unified Runtime has been moved to intel/llvm under the unified-runtime top-level directory,
all future development will now be carried out there. This was done in intel/llvm#17043.

The code will be mirrored to oneapi-src/unified-runtime and the specification will continue to be hosted at oneapi-src.github.io/unified-runtime.

The contribution guide has been updated with new instructions for contributing to Unified Runtime.

PR Migration

All open PRs including this one will be labelled auto-close and shall be automatically closed after 30 days.
To allow for some breathing space, this automation will not be enabled until next week (27/02/2025).

Should you wish to continue with your PR you will need to migrate it to intel/llvm.
We have provided a script to help automate this process.


This is an automated comment.

@martygrant
Copy link
Contributor

Unified Runtime -> intel/llvm Repo Move Notice

Following on from the previous notice, we have now enabled workflows to automatically label and close PRs because the Unified Runtime source code has moved to intel/llvm.

This PR has now been marked with the auto-close label and will be automatically closed after 30 days.

Please review the previous notice for more information, including assistance with migrating your PR to intel/llvm.

Should there be a reason for this PR to remain open, manually remove the auto-close label.


This is an automated comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-close common Changes or additions to common utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants