[PATCH] D120254: [OpenCL] Align subgroup builtin guards

Harald van Dijk via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 06:41:56 PDT 2022


hvdijk added a comment.
Herald added a project: All.

In D120254#3342551 <https://reviews.llvm.org/D120254#3342551>, @dyung wrote:

> Hi, our internal release build bots are showing failures in two clang-tidy tests that I bisected back to your commit, clang-tidy/checkers/altera-id-dependent-backward-branch.cpp and clang-tidy/checkers/altera-single-work-item-barrier.cpp. After this change, both are exhibiting this error:
>
>   Error while processing /home/dyung/src/upstream/aa9c2d19d9b73589d72114d6e0a4fb4ce42b922b-linux/tools/clang/tools/extra/test/clang-tidy/checkers/Output/altera-single-work-item-barrier.cpp.tmp.cpp.
>   error: enum type memory_scope not found; include the base header with -finclude-default-header [clang-diagnostic-error]
>
> Oddly, this only fails in a release configuration. Can you take a look?

This was worked around by modifying tests, but I believe this is a fundamental problem in this change and was able to reproduce the error with plain old clang:

  $ cat test.cl
  void sub_group_barrier();
  
  $ bin/clang -cl-std=CL1.2 -S -o - test.cl
  error: enum type memory_scope not found; include the base header with -finclude-default-header
  1 error generated.
  
  $ bin/clang --version
  clang version 15.0.0 (git at github.com:llvm/llvm-project c204cee642ee794901d2e8a9819b52ac12f92bc9)
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: /home/harald/llvm-project/build/bin

The problem is that this change enables certain built-ins in OpenCL 1.2 that take a memory_scope argument, but the memory_scope type is not defined in OpenCL 1.2 mode. When we then process the function, sub_group_barrier in my example, things break when checking whether the declaration matches the built-in. I am not sure what the right fix here is. Can we just define the type if any extension is enabled that requires the type, or is that not allowed?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120254/new/

https://reviews.llvm.org/D120254



More information about the cfe-commits mailing list