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

LLVM and SPIRV-LLVM-Translator pulldown (WW10 2024) #12939

Merged
merged 794 commits into from
Mar 7, 2024
Merged

Conversation

sys-ce-bb
Copy link
Contributor

@sys-ce-bb sys-ce-bb commented Mar 7, 2024

jmorse and others added 30 commits March 4, 2024 19:31
Seemingly I either missed this on a buildbot or otherwise didn't
cover this :(
This patch addresses an oversight in `ProcessEventDataTest::SetUp`
unittest to ensure the Debugger is initialized properly.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
When a call to `getFreelyInvertedImpl` with a select/phi node fails,
`DoesConsume` should not be changed.

Fixes llvm/llvm-project#82877.
Add `liblldb` dependency and use correct extension for compiled Lua
module.

Replace 'Python' with 'Lua' in install path name.

Fixes #55075.
We can use bitwise arithmetic to implement these, making them
considerably faster than legalization via promotion.
…#83884)

This work corrects a few inappropriate uses of HasImageInsts predicate
in vimage instruction definitions.

In MnemonicAlias for VIMAGE_Atomic_gfx12_Renamed, we also need
HasImageInsts to be in the "Requires" predicate list for the alias to
depend on whether or not the GPU has image instruction support.

For nested uses of "let OtherPredicates = ..." around vimage instruction
definitions, the inner assignment will override the outer one. This
makes the outermost "let OtherPredicates = [HasImageInsts]" unused when
we have an inner assignment. As a result, HasImageInsts is not actually
used for some vimage instructions. To resove this issue, we propogate
the predicates in an outer assignment into the inner one.

We should avoid using nested "let SubtargetPredicate = ...". However, we
can always put the predicate into OtherPtredicates list.
Fixes typo in documentation for clang-format 

Fixes #83207.
Either:
- I forgot my alphabet (that E comes before F).
- My juvenile inner brain finds unsigned literal constants with the sequence FU
  funny.

¿Por qué no los dos?
So far, all the work we've done for compute constructs has only used
'parallel'.  This patch does the work to enable the same logic for
'serial' and 'kernels' constructs as well, since they are the same
semantic behavior.
Addresses the `third-party/benchmark` part of #81859 (by happening to remove `requirements.txt`)
Several profdata tests pass the byte 012 to printf. This causes these
tests to fail when using GnuWin32's version of printf because printf
will detect that 012 is the LF character and will prepend the byte 015
(CR) in front of LF.

This change is required after
llvm/llvm-project#82711 which bumped the version
number.
This reverts commit 2e93ee6.

buildbot failures, e.g.
`/third-party/benchmark/cmake/pthread_affinity.cpp`
Add SPIR-V backend support for the HLSL SV_DispatchThreadID semantic
attribute, which is lowered to a @llvm.dx.thread.id intrinsic in LLVM
IR. In the SPIR-V backend, this is now correctly translated to a
`GlobalInvocationId` builtin variable.

Fixes #82534
Given a scalable VF of the form <NumElts * VScale>, this patch adds the
ability to discharge a backedge test for a loop whose trip count is
between (NumElts, MinVScale*NumElts).

A couple of notes on this:
* Annoyingly, I could not figure out to write a test for this case. My
attempt is checked in as test32_i8 in f67ef1a, but LV uses a fixed
vector in that case, and ignored the force flags.
* This depends on 9eb5f94 to avoid appearing like a regression. Since
SCEV doesn't know any upper bound on vscale without the vscale_range
attribute (it doesn't query TTI), the ranges overflow on the multiply.
Arguably, this is fixing a bug in the current LV code since in theory
vscale can be large enough to overflow for real, but no actual target is
going to see that case.
This was copy+pasted from count_ones without updating the test name completely.
This reverts commit aec6a04.

(google/benchmark still at hash 1576991177ba97a4b2ff6c45950f1fa6e9aa678c as it was in #83488. Also reapplied same extra local diffs)

Verified locally.
If a gep has only one phi as one of its operands and the remaining
indexes are constant, we can unfold `gep ptr, (phi idx1, idx2)` to `phi
((gep ptr, idx1), (gep ptr, idx2))`.

Take care not to unfold recursive phis.

Followup to #80983.

This was initially was #83087. Initial PR did not handle allocas in
entry block that weren't at the beginning of the function, causing GEPs
to be inserted after the first chunk of allocas but potentially before
an alloca not at the beginning. Insert GEPs at the end of the entry
block instead since constants/arguments/static allocas can all be used
there.
More information is more testing!
Also adjusts already migrated integration tests
…ConditionCache

This helps cover some missing cases in both and hopefully serves as
creating an easier framework for extending general condition based
analysis.

Closes #83161
Fixed-point arithmetic support is targeted towards baremetal targets.
Pierre-vh and others added 13 commits March 6, 2024 10:38
gfx940 does not allow abs/sext/neg on v_cvt_fp8/bf8 & pk variants.

Fixes SWDEV-447468
When a variadic argument is expected but not provided the compilation
fails later with a difficult to follow compilation error. Add a simple
check to catch one such case.

This is not yet general as it doesn't yet check leaf nodes.
This patch regroups declarations in `Sema` based on the file they are
implemented in (e.g. `SemaChecking.cpp`). This allows to logically split
`Sema` in 42 groups. No physical separation is done (e.g. splitting
`Sema` into multiple classes). Table of contents added at the very
beginning of `Sema`. Grouping is reflected in Doxygen commands, so
structure of API reference of `Sema` is also significantly improved
([example from official
documentation](https://www.doxygen.nl/manual/examples/memgrp/html/class_memgrp___test.html),
[comparison of Sema API
reference](llvm/llvm-project#82217 (comment))).

While grouping is intentional, as well as each group consisting of
`public` declarations followed by `private` ones (without changing
access in-between), exact contents and order of declarations of each
group is partially carried over from old structure, partially accidental
due to time constrains to do the regrouping over the weekend (`Sema` is
just enormously big). Data members and inline function definitions in
`Sema.h` complicate the matter, since it's not obvious which group they
belong to. Further work is expected to refine contents and order of
declarations.

What is also intentional is some kind of layering, where Concepts group
follows template groups, and ObjC, code completion, CUDA, HLSL, OpenACC,
OpenMP, and SYCL are all placed at the end of the file, after C and C++
parts of `Sema`.

I used `clang-query` to verify that access specifiers were preserved
during the process (https://gcc.godbolt.org/z/9johffY9T, thank you
@ilya-biryukov). Only the following 3 member types were converted from
`private` to `public` because of limitations of the new grouping:
`DeclareTargetContextInfo`, `TypoExprState`, `SatisfactionStackEntryTy`.

Member initializer list of `Sema` in `Sema.cpp` is rewritten to reflect
new order of data members in order to avoid `-Wreorder-ctor`.

Since this patch touches almost every line in `Sema.h`, it was
considered appropriate to run clang-format on the whole file, and not
just on changed lines.
  CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp
This merge cause two tests fail:
  SYCL-Unit :: Extensions/CommandGraph/./CommandGraphExtensionTests/32/46
  SYCL-Unit :: Extensions/CommandGraph/./CommandGraphExtensionTests/33/46

  CONFLICT (content): Merge conflict in clang/include/clang/Sema/Sema.h
  CONFLICT (content): Merge conflict in clang/lib/Sema/Sema.cpp
If SPV_KHR_bit_instructions is not enabled lower llvm.bitreverse.* to a function in LLVM IR.

Signed-off-by: Lu, John <john.lu@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@08d939609f186a4
Use unordered_map instead of map for better performance.

Signed-off-by: Lu, John <john.lu@intel.com>

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@56538038eda11b7
This patch fixes verification of Get/Async Capacity literals making
translator accept zero values which are valid by spec.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@22f9e3e67b36b36
Fix the following compiler warning:

    .../SPIRVNameMapEnum.h:704:61: warning: extra ';' [-Wpedantic]

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@ff0206f025b03bd
In translation from  __spirv_AtomicCompareExchange to OpenCL builtin
atomic_compare_exchange_strong_explicit, a new alloca `expected` is
created and read/written in the OpenCL builtin.
The OpenCL builtin call can't have tail marker since the marker requires
that callee doesn't access alloca from the caller.
Otherwise llvm alias analysis deduces that the alloca isn't accessed by
the call, and instcombine pass replaces the load from the alloca after
the call with the value stored to the alloca before the call.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@1ff4a764cd0f97c
The SPIR-V to LLVM conversion would bail out when encountering an
`OpVectorShuffle` whose vector operands differ in size.  SPIR-V
allows differing vector sizes, but LLVM's `shufflevector` does not.

Remove the assert and insert an additional `shufflevector` to align
the vector operands when needed.

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@3df5e38250a6d7c
@sys-ce-bb sys-ce-bb added the disable-lint Skip linter check step and proceed with build jobs label Mar 7, 2024
@jsji
Copy link
Contributor

jsji commented Mar 7, 2024

@bader @intel/llvm-gatekeepers This is ready for merge. No review required. Thanks.

@jsji jsji self-assigned this Mar 7, 2024
@jsji jsji marked this pull request as ready for review March 7, 2024 16:47
@jsji jsji requested review from a team and bader as code owners March 7, 2024 16:47
@bader
Copy link
Contributor

bader commented Mar 7, 2024

/merge

@bb-sycl
Copy link
Contributor

bb-sycl commented Mar 7, 2024

Thu 07 Mar 2024 04:50:19 PM UTC --- Start to merge the commit into sycl branch. It will take several minutes.

@bb-sycl
Copy link
Contributor

bb-sycl commented Mar 7, 2024

Thu 07 Mar 2024 04:59:59 PM UTC --- Merge the branch in this PR to base automatically. Will close the PR later.

@bb-sycl bb-sycl merged commit 0d2fe31 into sycl Mar 7, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disable-lint Skip linter check step and proceed with build jobs
Projects
None yet
Development

Successfully merging this pull request may close these issues.