Skip to content

[PET-to-MLIR] Rebased on the llvm-project - #8

Closed
Komisarczyk wants to merge 5238 commits into
LoopTactics:pet-mlirfrom
Komisarczyk:merged_pet-mlir
Closed

Komisarczyk wants to merge 5238 commits into
LoopTactics:pet-mlirfrom
Komisarczyk:merged_pet-mlir

Conversation

@Komisarczyk

Copy link
Copy Markdown

llvm-project with MLIR commit 3765799

efriedma-quic and others added 30 commits June 23, 2020 19:50
The indexing was messed up, so the result was completely broken.

Shuffle constant exprs are rare in practice; without vscale types,
constant folding generally elminates them. So sort of hard to trip over.

Fixes regression from D72467.

Differential Revision: https://reviews.llvm.org/D80330
Summary:
Currently, there is no way to let the `InternalSymbolizer` implemented
functions know if inline frames should be symbolized. This patch updates
the function `__sanitizer_symbolize_code` to include a parameter for
this ASAN option and toggle between LLVM symbolization functions when
appropriate.

Fixes the following two failing tests when internal symbolization is
enabled:
```
SanitizerCommon-*-x86_64-Linux :: print-stack-trace.cpp
SanitizerCommon-*-x86_64-Linux :: symbolize_pc_inline.cpp
```

Reviewers: vitalybuka, kcc, filcab

Reviewed By: vitalybuka

Subscribers: #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D79280
The cmake build of LLVM now uses the appropriate arm64 arch for the
host triple when building llvm-project on an Apple Silicon mac.

Differential Revision: https://reviews.llvm.org/D82428
is running on an Apple Silicon mac

This change allows users to use `-arch arm64` to build for mac when
running it on Apple Silicon mac without explicit `-target` option.

Differential Revision: https://reviews.llvm.org/D82428
The test should only run with a Darwin driver only.
…have isel patterns to infer them from.

Should remove part of the differences in D81833 due to some
some of these getting isel patterns.
…ctions.

Specifically: copysignl, frexpl, logbl and modfl have been added.

Reviewers: asteinhauser

Differential Revision: https://reviews.llvm.org/D82357
…e a machine mem operand if there isn't one present.

Eric Christopher informed me that FastISel memcpy handling creates
load/store instructions without mem operands. We should fix that,
but I doubt that's the only case of missed mem operands so seems
better to be defensive here.

I don't have a test case yet, but I'll try to add one if i get a
test from Eric.
Summary:
This patch enables compilation of C code for the VE target with Clang.

Differential Revision: https://reviews.llvm.org/D79411
…ers.

Summary:
otherwise we'll run into code path which expects a good base specifiers,
and lead to crashes.

The crash only occurs in template instantiations (in non-template case,
the bad base specifiers are dropped during parsing.)

crash stacktrace:

```
clang: llvm-project/clang/lib/Sema/SemaInit.cpp:7864: clang::ExprResult clang::InitializationSequence::Perform(clang::Sema &, const clang::InitializedEntity &, const clang::InitializationKind &, clang::MultiExprArg, clang::QualType *): Assertion `Kind.getKind() == InitializationKind::IK_Copy || Kind.isExplicitCast() || Kind.getKind() == InitializationKind::IK_DirectList' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82086
Summary: Looks like this is a fallout when we introduce the error-bit in Type.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82099
Summary:
This change permits scalar bfloats to be loaded, stored, moved and
used as function call arguments and return values, whenever the bf16
feature is supported by the subtarget.

Previously that was only supported in the presence of the fullfp16
feature, because the code generation strategy depended on instructions
from that extension. This change adds alternative code generation
strategies so that those operations can be done even without fullfp16.

The strategy for loads and stores is to replace VLDRH/VSTRH with
integer LDRH/STRH plus a move between register classes. I've written
isel patterns for those, conditional on //not// having the fullfp16
feature (so that in the fullfp16 case, the existing patterns will
still be used).

For function arguments and returns, instead of writing isel patterns
to match `VMOVhr` and `VMOVrh`, I've avoided generating those SDNodes
in the first place, by factoring out the code that constructs them
into helper functions `MoveToHPR` and `MoveFromHPR` which have a
fallback for non-fullfp16 subtargets.

The current output code is not especially pretty: in the new test file
you can see unnecessary store/load pairs implementing no-op bitcasts,
and lots of pointless moves back and forth between FP registers and
GPRs. But it at least works, which is an improvement on the previous
situation.

Reviewers: dmgreen, SjoerdMeijer, stuij, chill, miyuki, labrinea

Reviewed By: dmgreen, labrinea

Subscribers: labrinea, kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D82372
Summary: Details: This patch enables SETCC to be selected to S_CMP_* if uniform and V_CMP_* if divergent.

Reviewers: rampitec, arsenm

Reviewed By: rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D82194
Summary:
Whenever Neon is not supported, a generic message is printed:

  error: "NEON support not enabled"

Followed by a series of other error messages that are not useful once
the first one is printed.

This patch gives a more precise message in the case where Neon is
unsupported because an invalid float ABI was specified: the soft float
ABI.

  error: "NEON intrinsics not available with the soft-float ABI. Please
  use -mfloat-abi=softfp or -mfloat-abi=hard"

This message is the same one that GCC gives, so it is also making their
diagnostics more compatible with each other.

Also, by rearranging preprocessor directives, these "unsupported" error
messages are now the only ones printed out, which is also GCC's
behaviour.

Differential Revision: https://reviews.llvm.org/D81847
Summary:
Bfloat16 support added for the following intrinsics:
 - LD1
 - LD1RQ
 - LDNT1
 - LDNF1
 - LDFF1

Reviewers: sdesmalen, c-rhodes, efriedma, stuij, fpetrogalli, david-arm

Reviewed By: fpetrogalli

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D82298
Summary:
Added for following intrinsics:

  * zip1, zip2, zip1q, zip2q
  * trn1, trn2, trn1q, trn2q
  * uzp1, uzp2, uzp1q, uzp2q
  * splice
  * rev
  * sel

Reviewed By: david-arm

Differential Revision: https://reviews.llvm.org/D82182
Let this function (try to) evaluate expressions, in addition to
declarations and compound statements.

Patch by Christian Kandeler <[email protected]>

Reviewers: nik, akyrtzi, arphaman, jkorous

Reviewed By: jkorous

Differential Revision: https://reviews.llvm.org/D80279
…s no section header.

Currently we crash when trying to print --sections and the SHN_XINDEX escape value
is used for the e_shstrndx field, but there is no section header at index 0 to
read the value from.

Differential revision: https://reviews.llvm.org/D82374
…ontAlign

Summary:
After D50078, we're experiencing unexpected un-indent using a style combining `AlignOperands: DontAlign` with `BreakBeforeTernaryOperators: false`, such as Google's JavaScript style:
```
% bin/clang-format -style=google ~/test.js
aaaaaaaaaaa = bbbbbbbb ? cccccccccccccccccc() :
dddddddddd             ? eeeeeeeeeeeeee :
                         fffff;
```
The issue lies with the interaction of `AlignOperands: DontAlign` and the edited code section in ContinuationIndenter.cpp, which de-dents the intent by `Style.ContinuationIndentWidth`. From [[ https://github.com/llvm/llvm-project/blob/ac3e5c4d93fbe7fb2db3c745c721aff41cc1b851/clang/include/clang/Format/Format.h#L170 | the documentation ]] of AlignOperands: DontAlign:
> The wrapped lines are indented `ContinuationIndentWidth` spaces from the start of the line.
So the de-dent effectively erases the necessary `ContinuationIndentWidth` in that case.

This patch restores the `AlignOperands: DontAlign` behavior, producing:
```
% bin/clang-format -style=google ~/test.js
aaaaaaaaaaa = bbbbbbbb ? cccccccccccccccccc() :
    dddddddddd         ? eeeeeeeeeeeeee :
                         fffff;
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82199
I have been trying to reduce the installed size of our CHERI toolchain and
noticed that this tool was being installed even with -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON.
This appears to be a test binary that should not be installed.

Reviewed By: v.g.vassilev
Differential Revision: https://reviews.llvm.org/D82169
chelini and others added 27 commits June 25, 2020 14:50
This revision adds handling for print call operation withing the Scop. This
gives us a way to test the entire flow end-to-end. Future revisions will handle
more complex cases.
- Handle pet_kill_op: Kill statements are introduced automatically for locally
  defined scalars or arrays, one at the point of the declaration and one at the
  point where the declaration goes out of scope.

- Rename getShapeExpr to getDimensionalityExpr. Compute the dimensionality
  via pet array instead of using isl::space.

- Move helpers fuctions (getDimensionalityExpr, isMultiDimensionalArray
  and convertExprToMemRef) in the MLIRCodegen class.

- Fix convertToMemRef to handle multi-dimensional arrays.

- Re-work createAllocOp. In case of rescheduling pet_kill_op are
  lost, therefore createStoreOp may need to allocate.
The lower and upper bounds specify a half-open range: the range includes the
lower bound but does not include the upper bound. Thus +1.
- Test end-to-end flow. Note that we use an
  absolute path for the util lib.

- Drop loopDownward.

- Merge tests in runner.mlir

- Fix test for gemm and gemver.
Originally the increment generated in postInc was of type float only. Enable
also int (32bit) and double. Add proper test case for int. Currently, we cannot
distinguish between float and double as a pet_expr can be only of type
pet_expr_int and pet_expr_double. For pet_expr_double we always generate float.
Originally we extended mlir/Types.h with isInt and IsFloat to check if the type
was int or float like. It is not necessary to touch MLIR.
PET distinguishes between two types of const expressions integer and
floating-point, but it does not differentiate on the bit width, which is an
implementation choice. When creating a floating-point expression, get the type
of the LHS to distinguish between F32 and F64.
This commit is related to 08b9d24.
Specifically, PET doesn't allow us to distinguish the width for a float
expression. This causes an issue if you need to create a pet_expr_double as we
don't know the width (i.e., f32 or f64). This commit passes the type to
createOp, which in turn may need the type to handle a pet_expr_double.
1. Remove hardcoded paths from FindISL and FindPET, the user can provide
-DCMAKE_PREFIX_PATH instead.
2. Guard the mlir-pet configuration by the MLIR_PET_BUILD option that is
off by default, allowing one to build a correct version of clang, that
can be used to build pet, which is necessary for mlir-pet. Otherwise we
have a circular build dependency.
3. Make mlir-pet an LLVM tool so that it can be installed.
4. Add a README.md with instructions.
@Komisarczyk
Komisarczyk deleted the merged_pet-mlir branch June 25, 2020 16:47
chelini pushed a commit that referenced this pull request Sep 2, 2020
A couple of AArch64 tests were failing on Solaris, both sparc and x86:

  LLVM :: MC/AArch64/SVE/add-diagnostics.s
  LLVM :: MC/AArch64/SVE/cpy-diagnostics.s
  LLVM :: MC/AArch64/SVE/cpy.s
  LLVM :: MC/AArch64/SVE/dup-diagnostics.s
  LLVM :: MC/AArch64/SVE/dup.s
  LLVM :: MC/AArch64/SVE/mov-diagnostics.s
  LLVM :: MC/AArch64/SVE/mov.s
  LLVM :: MC/AArch64/SVE/sqadd-diagnostics.s
  LLVM :: MC/AArch64/SVE/sqsub-diagnostics.s
  LLVM :: MC/AArch64/SVE/sub-diagnostics.s
  LLVM :: MC/AArch64/SVE/subr-diagnostics.s
  LLVM :: MC/AArch64/SVE/uqadd-diagnostics.s
  LLVM :: MC/AArch64/SVE/uqsub-diagnostics.s

For example, reduced from `MC/AArch64/SVE/add-diagnostics.s`:

  add     z0.b, z0.b, #0, lsl #8

missed the expected diagnostics

  $ ./bin/llvm-mc -triple=aarch64 -show-encoding -mattr=+sve add.s
  add.s:1:21: error: immediate must be an integer in range [0, 255] with a shift amount of 0
  add     z0.b, z0.b, #0, lsl #8
                      ^

The message is `Match_InvalidSVEAddSubImm8`, emitted in the generated
`lib/Target/AArch64/AArch64GenAsmMatcher.inc` for `MCK_SVEAddSubImm8`.
When comparing the call to `::AArch64Operand::isSVEAddSubImm<char>` on both
Linux/x86_64 and Solaris, I find

  875	    bool IsByte = std::is_same<int8_t, std::make_signed_t<T>>::value;

is `false` on Solaris, unlike Linux.

The problem boils down to the fact that `int8_t` is plain `char` on
Solaris: both the sparc and i386 psABIs have `char` as signed.  However,
with

  9887	    DiagnosticPredicate DP(Operand.isSVEAddSubImm<int8_t>());

in `lib/Target/AArch64/AArch64GenAsmMatcher.inc`, `std::make_signed_t<int8_t>`
above yieds `signed char`, so `std::is_same<int8_t, signed char>` is `false`.

This can easily be fixed by also allowing for `int8_t` here and in a few
similar places.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D85225
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.