Commit Graph

868 Commits

Author SHA1 Message Date
Alex Brachet
3af4e4031d Revert "[libc] Templatize str{,n}cmp"
This reverts commit c6dcbed2e5.

Broke tests on arm and aarch64
2023-01-09 20:24:16 +00:00
Alex Brachet
c6dcbed2e5 [libc] Templatize str{,n}cmp
This will be used to implement the case insensitive str{,n}casecmp

Differential Revision: https://reviews.llvm.org/D141235
2023-01-09 20:13:02 +00:00
Dmitri Gribenko
2d32a01b9f [bazel] Updates for 496f9a7d8d 2023-01-09 10:36:16 +01:00
Dmitri Gribenko
dd9298baec [bazel] Update the mpfr URL to a stable one
mpfr has released a new version, and now the old tar.gz URL does not
work anymore. Update the URL to a stable one.
2023-01-09 10:36:15 +01:00
Alex Zinenko
054ec47c91 [mlir] NFC: move DiagnosedSilenceableFailure to Utils in Transform dialect
It was originally placed in TransformInterfaces for convenience, but it
is really a generic utility. It may also create an include cycle between
TransformTypes and TransformInterfaces if the latter needs to include
the former because the former uses the failure util.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D140978
2023-01-06 12:23:37 +00:00
Benjamin Kramer
943d8644df [bazel] Add missing :Support dependency after 1b82245370 2023-01-06 12:51:38 +01:00
Jakub Kuderski
47232bea9e [mlir][spirv] Fix extended umul expansion for WebGPU
Fix an off-by-one error in extended umul extension for WebGPU.
Revert to the long multiplication algorithm originally added to wide
integer emulation, which was deleted in D139776. It is much easier
to see why it is correct.

Add runtime tests based on the mlir-vulkan-runner. These run both with
and without umul extension.

Issue: https://github.com/llvm/llvm-project/issues/59563

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D141085
2023-01-05 18:41:26 -05:00
Guillaume Chatelet
8ec0a36967 [llvm-exegesis] Allow building llvm_exegesis_tests on builtkite 2023-01-04 10:43:03 +00:00
Matthias Springer
3a5811a337 [mlir][affine][NFC] Extract core functionality of canonicalizeMinMaxOp
Move code from SCF to Affine: Add a new helper function `simplifyConstrainedMinMaxOp` to Affine/Analysis/Utils.h. `canonicalizeMinMaxOp` was originally designed for loop peeling, but it is not SCF-specific and can be used to simplify any affine.min/max ops.

Various functions in SCF/Transforms are simplified by dropping unnecessary parameters.

Differential Revision: https://reviews.llvm.org/D140962
2023-01-04 11:25:44 +01:00
Haojian Wu
d2ab0134ed Fix the broken bazel build for f6076bd81f 2023-01-03 00:03:27 +01:00
Adrian Kuegel
9cd113a2a8 [mlir][Bazel] Port cf487cce6f 2023-01-02 13:05:59 +01:00
NAKAMURA Takumi
5d4cebfa52 [Bazel] Exclude lib/Headers/openmp_wrappers/stdlib.h out of builtin_headers
It has been there since llvmorg-16-init-14999-g07ff3c5ccce6
2022-12-30 13:23:00 +09:00
Jordan Rupprecht
f92ae6dd30 [test] Exclude //llvm/unittests:llvm_exegesis_tests due to buildkite environment.
Buildkite does not allow user perf monitoring and fails: https://buildkite.com/llvm-project/upstream-bazel/builds/49579.

```
[ RUN      ] PerfHelperTest.FunctionalTest
Unable to open event. ERRNO: Permission denied. Make sure your kernel allows user space perf monitoring.
You may want to try:
$ sudo sh -c 'echo -1 > /proc/sys/kernel/perf_event_paranoid'
llvm_exegesis_tests: external/llvm-project/llvm/tools/llvm-exegesis/lib/PerfHelper.cpp:111: llvm::exegesis::pfm::Counter::Counter(llvm::exegesis::pfm::PerfEvent &&): Assertion `FileDescriptor != -1 && "Unable to open event"' failed.
```
2022-12-28 08:43:04 -08:00
Jordan Rupprecht
4aa77690b9 [bazel] Restore libpfm as a conditional dependency for exegesis.
We used to have `pfm` built into exegesis, although since it's an external dependency we marked it as a manual target. Because of this we didn't have buildbot coverage and so we removed it in D134510 after we had a few breakages that weren't caught. This adds it back, but with three possible states similar to the story with `mpfr`, i.e. it can either be disabled, built from external sources (git/make), or use whatever `-lpfm` is installed on the system.

This change is modeled after D119547. Like that patch, the default is off (matching the status quo), but unlike that patch we don't enable it for CI because IIRC we don't have the package installed there, and building from source might be expensive. We could  enable it later either after installing it on buildbot machines or by measuring build cost and deeming it OK.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D138470
2022-12-28 08:13:20 -08:00
Guillaume Chatelet
4e9ac30816 [reland][libc][NFC] Add -fno-lax-vector-conversions compilation flag
Now that a3d2c344773cc4fc95136fd67245880b34d8e335 has been submitted.
2022-12-27 10:32:41 +00:00
Guillaume Chatelet
d065472c9e Revert "[libc][NFC] Add -fno-lax-vector-conversions compilation flag"
This breaks aarch64 build.

This reverts commit 32f4c3f103.
2022-12-27 08:30:19 +00:00
Guillaume Chatelet
32f4c3f103 [libc][NFC] Add -fno-lax-vector-conversions compilation flag 2022-12-27 08:25:32 +00:00
Peiming Liu
34efb3c47c [bazel] fix bazel file.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D140589
2022-12-22 23:09:25 +00:00
Michael Jones
39f370aefd [libc] change str to int tests to be templated
Previously the tests were copy/pasted into several files, this changes
them to be instead templated and sharing one file.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D140441
2022-12-22 10:40:24 -08:00
Fangrui Song
f406db91f3 [bazel] Fix some --features=layering_check issues 2022-12-22 00:12:58 -08:00
Fangrui Song
6d5bb34fc5 [bazel] Make TargetParser depend on config to fix --features=layering_check
While here, apply `buidifier`.
2022-12-21 22:59:36 -08:00
Peiming Liu
35762d0739 [bazel] fix bazel file
Reviewed By: yijia1212

Differential Revision: https://reviews.llvm.org/D140520
2022-12-22 01:30:06 +00:00
Michael Jones
8aba176377 [libc][obvious] fix bazel after removing vector
The vector class was removed from the source code and cmake but not from
the bazel which caused bazel issues. This patch fixes that.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D140510
2022-12-21 16:03:52 -08:00
Matthias Springer
108b08f2a9 [mlir] Add RuntimeVerifiableOpInterface and transform
Static op verification cannot detect cases where an op is valid at compile time but may be invalid at runtime.

An example of such an op is `memref::ExpandShapeOp`.

Invalid at compile time: `memref.expand_shape %m [[0, 1]] : memref<11xf32> into memref<2x5xf32>`

Valid at compile time (because we do not know any better): `memref.expand_shape %m [[0, 1]] : memref<?xf32> into memref<?x5xf32>`. This op may or may not be valid at runtime depending on the runtime shape of `%m`.

Invalid runtime ops such as the one above are hard to debug because they can crash the program execution at a seemingly unrelated position or (even worse) compute an invalid result without crashing.

This revision adds a new op interface `RuntimeVerifiableOpInterface` that can be implemented by ops that provide additional runtime verification. Such runtime verification can be computationally expensive, so it is only generated on an opt-in basis by running `-generate-runtime-verification`. A simple runtime verifier for `memref::ExpandShapeOp` is provided as an example.

Differential Revision: https://reviews.llvm.org/D138576
2022-12-21 10:57:14 +01:00
Haojian Wu
d3663045fc [bazel] Add missing Passes dependency to llvm-extract 2022-12-20 22:27:10 +01:00
Benjamin Kramer
9f6f9488dd Revert "[Bazel] Remove define HAVE_LSEEK64 to match cmake config."
This reverts commit 5d65f8a793. Dependent
commit ae3e228af7 was reverted in f31a36e776.
2022-12-20 20:33:20 +01:00
Mikhail Goncharov
c2a5f156d2 [bazel] add TargetParser 2022-12-20 20:09:19 +01:00
Fangrui Song
bb22e3e8c0 [bazel] Port TargetParser f09cf34d00
Moving files into a new target :TargetParser is left as an exercise.
2022-12-20 10:30:05 -08:00
Adrian Kuegel
cb7ae7716d [mlir][Bazel] Add ModuleImport sources to FromLLVMIRTranslation target. 2022-12-19 12:04:47 +01:00
Adrian Kuegel
7ccbb4dff1 [mlir][Bazel] Add missing dependency to TensorDialect. 2022-12-19 10:04:29 +01:00
Adrian Kuegel
5d65f8a793 [Bazel] Remove define HAVE_LSEEK64 to match cmake config. 2022-12-19 09:06:39 +01:00
Matthias Springer
411048c1ae [mlir][transform] Add PackedOrDynamicIndexList helper
This customer parser/printer is similar to DynamicIndexList, but has special syntax for the case where one handle represents the entire list.

Example:
```
// Regular index list
[10, 20, %val]

// Packed handle (no square parentheses)
%val
```

Differential Revision: https://reviews.llvm.org/D138825
2022-12-19 08:08:04 +01:00
Haojian Wu
1651bc60ad Update the bazel's llvm-config.h.cmake file
Reflect the change 7d2c1150d3, fix the bazel test
breakage.
2022-12-17 18:17:30 +01:00
Hanhan Wang
83396d8549 [mlir][tensor] Implement TilingInterface for unpack op
The main issue of tiling unpack op is about incomplete tile. Since all
the dimensions are orthogonal, discussing 1-d unpack case is enough. The
core idea is to make the input slice have complete tiles. In this case,
a larger unpacked tile will be created. We'll need an extract_slice op
to shift and truncate the output.

Take Nn_to_N as an example. Say that N=32, n=8, and tiling_size=15. The
coordinates of second tile (i.e., result[15..31]) are [(1, 7), (2, 0,),
(2, 1) ... (3, 6), (3, 7)]. The first row and the last row are
incomplete in terms of inputs. It's impossible to represent an unpack op
using the coordinates. Because the input has higher rank and the math
computation of coordinate is using mod and ceilDiv. That's very tricky.

To represent the unpack op, we have to complete the rows. I.e., the
input coordinates would start with (1, 0); end with (3, 7). In this
context, the tiled unpack produces a (3 * n) elements because there are
3 rows in total. Follow by a tensor.extract_slice op, we can get the
actual result.

If the tiling sizes are multiple of inner tile sizes, it is a perfect
tiling case. In this context, the larger input and output is not needed.

Reviewed By: chelini

Differential Revision: https://reviews.llvm.org/D139362
2022-12-16 13:06:52 -08:00
Jordan Rupprecht
58c38e4536 [NFC][bazel] Update comment in llvm-config.h.cmake so headers match 2022-12-15 17:41:48 -08:00
Kazu Hirata
ee0c631716 [mlgo] Retire LLVM_HAVE_TF_API
I've eliminated all uses of LLVM_HAVE_TF_API except a couple of them
being removed in llvm/lib/CodeGen/CMakeLists.txt.  This patch removes
remaining definitions and uses of LLVM_HAVE_TF_API.

Differential Revision: https://reviews.llvm.org/D140169
2022-12-15 14:40:16 -08:00
Alex Brachet
d07c54c2a5 [libc] Templatize ato* tests
This catches missing corner cases from atol tests.

Differential Revision: https://reviews.llvm.org/D140076
2022-12-15 17:30:00 +00:00
Matthias Springer
325b58d59f [mlir][cf] Print message in cf.assert to LLVM lowering
The assert message was previously ignored. The lowered IR now calls `puts` it in case of a failed assertion.

Differential Revision: https://reviews.llvm.org/D138647
2022-12-15 17:45:34 +01:00
Quentin Colombet
2d0ca6b68c [mlir][test] Add expand-strided-metadata to lower-to-llvm
This patch adds the `ExpandStridedMetadataPass` to the LowerToLLVM named
pipeline.
This is required now that "complex" memref operations, like subviews,
need to be expanded before being lowered.

Differential Revision: https://reviews.llvm.org/D139841
2022-12-15 09:07:21 +00:00
Peiming Liu
71cc0f1c04 [mlir][sparse] introduce sparse_tensor::StorageSpecifierType and related operations on it
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D139961
2022-12-14 22:27:22 +00:00
Oleg Shyshkov
07335f9460 [mlir] Fix bazel build for https://reviews.llvm.org/D139187. 2022-12-14 17:05:48 +01:00
Krasimir Georgiev
afcf8fa5ad [bazel] add some more deps to libc BUILD files 2022-12-14 10:27:45 +00:00
Krasimir Georgiev
5c8bf9de93 [bazel] Add __support_common dep 2022-12-14 10:16:17 +00:00
Jordan Rupprecht
9144ee6edf [bazel] Add __support_compiler_features dep in more places 2022-12-13 12:20:21 -08:00
Jordan Rupprecht
caee219320 [bazel] Add extract_api after 7a85192166 2022-12-13 10:57:37 -08:00
Guillaume Chatelet
6ce5e53cc7 [libc][bazel] Add missing dependency in string_memory_utils 2022-12-13 16:05:47 +00:00
Guillaume Chatelet
f52ca0926c [libc] Add compiler, builtin and feature detection
This is a first step to support GCC. This patch adds support for builtin and feature detection.

Differential Revision: https://reviews.llvm.org/D139712
2022-12-13 13:01:11 +00:00
Diego Caballero
72fd36448d [mlir][Vector] Initial masking support in Linalg vectorizer
This patch introduces the initial bits to support vector masking
using the `vector.mask` operation. Vectorization changes should be
NFC for non-masked cases. We can't test masked cases directly until
we extend the Transform dialect to support masking.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D137690
2022-12-13 01:33:06 +00:00
Jordan Rupprecht
a98bdaa9c9 [NFC][bazel] Run buildifier on all bzl/BUILD.bazel files 2022-12-12 16:30:51 -08:00
Siva Chandra Reddy
ce932556af [libc][bazel] Mark all libc public functions to have "default" visibility.
For the bazel build, we also build all source files with
-fvisibility=hidden.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D139678
2022-12-12 17:22:35 +00:00