8000 [SYCL][XPTI] Fix static analysis tool warnings by alexbatashev · Pull Request #5040 · intel/llvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[SYCL][XPTI] Fix static analysis tool warnings #5040

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 3 commits into from
Dec 15, 2021

Conversation

alexbatashev
Copy link
Contributor

Make sure nullptr is not dereferenced accidentally.

s-kanaev
s-kanaev previously approved these changes Nov 29, 2021
Copy link
Contributor
@s-kanaev s-kanaev left a comment

Choose a reason for hiding this comment

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

LGTM

vladimirlaz
vladimirlaz previously approved these changes Nov 29, 2021
@@ -528,6 +528,7 @@ RT::PiProgram ProgramManager::getBuiltPIProgram(
std::make_pair(std::make_pair(std::move(SpecConsts), KSId),
std::make_pair(PiDevice, CompileOpts + LinkOpts)),
AcquireF, GetF, BuildF);
assert(BuildResult != nullptr && "Invalid build result");
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have asserts always on? Wouldn't it be safe to have exception throw here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In CI we always build and test with assertions. Honestly, I don’t see a code path, that returns nullptr. And I assume assert makes more sense here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@alexbatashev If BuildResult is guaranteed to not be nullptr, can we document it somewhere that this is the case, hence the use of assert()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tovinkere I can add a comment to getOrBuild
Generally, I think this is a perfect case for C++ contracts, but they have not been standardized yet, unfortunately.

@alexbatashev alexbatashev dismissed stale reviews from vladimirlaz and s-kanaev via 24163e0 December 10, 2021 11:26
Copy link
Contributor
@tovinkere tovinkere left a comment

Choose a reason for hiding this comment

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

LGTM

@bader bader merged commit 673d741 into intel:sycl Dec 15, 2021
alexbatashev added a commit to alexbatashev/llvm that referenced this pull request Dec 15, 2021
* upstream/sycl: (5961 commits)
  [SYCL] Implement discard_events extension (intel#5026)
  [SYCL][NFC] Fix unused parameter warning in piQueueFlush (intel#5139)
  [SYCL][XPTI] Fix static analysis tool warnings (intel#5040)
  [CI] Switch post-commit jobs to self-hosted runners (intel#5147)
  [SYCL] Fix support for classes implicitly converted from items in parallel_for (intel#5118)
  [SYCL][HIP] Fix platform query in USM alloc info (intel#5140)
  [Docker] Add workarounds for two SYCL issues (intel#5143)
  [CI] Install cm-compiler in drivers image (intel#5128)
  [ESIMD] Add support for an arbitrary number of elements to simd::copy_from/to (intel#5135)
  [SYCL] Add number HW threads per EU query (intel#4901)
  [CI] Refactor workflow files (intel#5134)
  [CI] Enable HIP and CUDA plugins in GitHub Actions builds (intel#5087)
  [SYCL] Implement queue flushing (intel#5052)
  Disable issue labeler in LLVM forks
  Modify translation for disable_loop_pipelining metadata
  Add SPIR-V friendly translation for OpLoad and OpStore
  Fix return type postfix for SPIR-V Friendly IR
  Restrict special handling of sampler OpVariable only to UniformConstant
  Add lowering for llvm.bswap intrinsic
  Fix translation of OpVariable with OpSamplerType
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0