Commit Graph

1258 Commits

Author SHA1 Message Date
Jacques Pienaar
f007bcbc3c [mlir] Convert quantized dialect bytecode to generated.
Serves as rather self-contained documentation for using the generator
from https://reviews.llvm.org/D144820.

Differential Revision: https://reviews.llvm.org/D152118
2023-06-06 11:16:07 -07:00
Aart Bik
eb5308adc4 bazel build fix
Reviewed By: Peiming, manishucsd

Differential Revision: https://reviews.llvm.org/D152214
2023-06-05 17:24:14 -07:00
Aart Bik
62a06d8224 fix build issue on bazel
Needed to fix:
53a5c3ab4d
db7cc0348c

Reviewed By: Peiming, anlunx

Differential Revision: https://reviews.llvm.org/D152202
2023-06-05 15:33:31 -07:00
Siva Chandra Reddy
2bd82c5462 [bazel][libc] Add targets for integer abs and div functions.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D152084
2023-06-05 22:15:12 +00:00
Johannes Reifferscheid
70bd660709 [bazel] Merge BytecodeOpInterface target into IR.
Reviewed By: akuegel

Differential Revision: https://reviews.llvm.org/D152133
2023-06-05 11:57:12 +02:00
Guillaume Chatelet
e49a608511 Revert D148717 "[libc] Improve memcmp latency and codegen"
This reverts commit 9ec6ebd3ce.

The patch broke RISCV and aarch64 builtbots.
2023-06-05 09:50:30 +00:00
Guillaume Chatelet
9ec6ebd3ce [libc] Improve memcmp latency and codegen
This is based on ideas from @nafi to:
 - use a branchless version of 'cmp' for 'uint32_t',
 - completely resolve the lexicographic comparison through vector
   operations when wide types are available. We also get rid of byte
   reloads and serializing '__builtin_ctzll'.

I did not include the suggestion to replace comparisons of 'uint16_t'
with two 'uint8_t' as it did not seem to help the codegen. This can
be revisited in sub-sequent patches.

The code been rewritten to reduce nested function calls, making the
job of the inliner easier and preventing harmful code duplication.

Reviewed By: nafi3000

Differential Revision: https://reviews.llvm.org/D148717
2023-06-05 09:46:05 +00:00
Adrian Kuegel
bc7f65cbd8 [mlir][Bazel] Adjust BUILD files for a9d003ef85 2023-06-05 09:57:01 +02:00
Mikhail Goncharov
34866154d6 [bazel] add missing dep for GPUTransforms 2023-06-05 09:20:20 +02:00
Benjamin Kramer
9d531c2dcf [bazel] Port 36f351098c 2023-06-04 21:39:52 +02:00
Tue Ly
5a4e344bd9 [libc][NFC] Add LIBC_INLINE and attribute.h header includes to targets' FMA.h.
Targets' FMA.h headers are missing LIBC_INLINE and attributes.h header.

Reviewed By: brooksmoses

Differential Revision: https://reviews.llvm.org/D152024
2023-06-02 21:15:58 -04:00
Haojian Wu
c5564a0075 [bazel] Add include-cleaner targets, fix clang-tidy build for c28506ba4b 2023-06-02 19:38:08 +02:00
Matthias Springer
000bc58b63 [mlir][transform] Utilize op interface instead of tensor::TrackingListener
Add a new interface `FindPayloadReplacementOpInterface` to specify ops that should be skipped when looking for payload replacement ops. Such ops are typically metadata-only ops.

With this change, we no longer need to maintain a custom TrackingListener in the tensor dialect.

Note: `CastOpInterface` by itself is not sufficient. Some metadata-only ops such as "tensor.reshape" are not casts, and it would be incorrect for them to implement the `CastOpInterface`.

Differential Revision: https://reviews.llvm.org/D151888
2023-06-02 14:50:43 +02:00
Matthias Springer
e66f2beba8 [mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces
These helpers should not be part of the IR build unit.

The interface is now implemented on `builtin.unrealized_conversion_cast` with an external model.

Also rename the CastOpInterfaces Bazel target name to CastInterfaces to be consistent with the CMake target name.

Differential Revision: https://reviews.llvm.org/D146972
2023-06-02 08:39:46 +02:00
Matthias Springer
26864d8fb4 [mlir][tensor] Add pattern to drop redundant insert_slice rank expansion
Drop insert_slice rank expansions if they are directly followed by an inverse rank reduction.

Differential Revision: https://reviews.llvm.org/D151800
2023-06-01 08:47:53 +02:00
Benjamin Chetioui
981766a3d6 [mlir][bazel] Disable Transform/test-repro-dump.mlir test in bazel build. 2023-05-31 11:50:48 +00:00
Haojian Wu
b2f4e75b66 [bazel] Port for 301eb6b68f 2023-05-31 12:49:21 +02:00
Benjamin Chetioui
96816a1249 [mlir][bazel] Follow-up fix for ce954e1cda. 2023-05-31 08:20:10 +00:00
Adrian Kuegel
6118cb4bd4 [mlir][Bazel] Adapt Bazel BUILD for ce954e1cda 2023-05-31 10:13:19 +02:00
yijia1212
d146fc8fba add missing dependency for TosaToLinalg 2023-05-31 01:37:14 +00:00
Fangrui Song
43bec3376c Remove HAVE_STRERROR
Most systems support strerror_r. For the remaining systems (e.g. MSVC) strerror_s and
strerror can be used as fallbacks. We don't have a supported operating
system/compiler that doesn't provide `strerror`.

Close https://github.com/llvm/llvm-project/issues/62804

https://github.com/flang-compiler/f18/pull/1068 added a fallback
when strerror is unavailable, but I think the code path is dead.

Reviewed By: serge-sans-paille, vzakhari

Differential Revision: https://reviews.llvm.org/D151718
2023-05-30 14:12:20 -07:00
Benjamin Kramer
c644341c2c Revert "[mlir][bazel] Port for 660f714, third attempt"
This reverts commit 421a7f814f. Dependency
doesn't seem to be necessary and would pull in all of LLVM's codegen
into mlir users that don't require it.
2023-05-30 11:41:24 +02:00
Haojian Wu
d9118b9eea [bazel] Port for 9f6250f591, part2.
The part1 was missing the generation of
arm_sme_draft_spec_subject_to_change.h, this patch adds it.
2023-05-30 08:05:39 +02:00
Haojian Wu
a0b0bf38e5 [bazel] Port for 9f6250f591. 2023-05-29 07:19:57 +02:00
Eugene Burmako
421a7f814f [mlir][bazel] Port for 660f714, third attempt
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D151618
2023-05-27 13:26:06 -07:00
Eugene Burmako
35d7fa45bd [MLIR] Reformat the Bazel build
This patch normalizes formatting of the the root BUILD.bazel file by: 1) adjusting indentation a little bit, 2) alphabetically ordering dependencies. These small deviations were introduced by some yesterday's patches:
  * https://reviews.llvm.org/D151104
  * https://reviews.llvm.org/D151346
  * https://reviews.llvm.org/rG16fe2b37365c00b0c6d0ed22c2e6521f2d5de01a
  * https://reviews.llvm.org/rG4d1cd1d8caab13d6b76ce6fc4ff76a01a7931c34

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D151499
2023-05-27 13:00:52 -07:00
Benjamin Kramer
a218c99181 [bazel] Add missing dependency for ddeab07ca6 2023-05-27 12:04:36 +02:00
Haojian Wu
fe01c08424 [mlir][bazel] Port for 660f714e26, second
attempt.
2023-05-27 08:37:45 +02:00
Haojian Wu
5217498dc8 [mlir][bazel] Port for 660f714e26 2023-05-27 08:05:19 +02:00
Benjamin Kramer
198a887fcf [bazel][libc] Add another missing dependency 2023-05-26 13:12:21 +02:00
Benjamin Kramer
596887da2e [bazel][libc] Add file missing for 25174976e1 2023-05-26 12:24:36 +02:00
Benjamin Kramer
3d91caec4b [bazel][libc] Adjust for 4f1fe19df3
This also required a build rule for error_to_string, so add that too.
2023-05-26 12:16:48 +02:00
Benjamin Kramer
e1d1cd43ff [bazel] Run buildifier on libc BUILD. NFC. 2023-05-26 12:16:47 +02:00
Eugene Burmako
ecc70b4474 [MLIR] Fixup Bazel build for Add a pattern for transforming gpu.global_id to thread + blockId * blockDim
This patch updates the Bazel build to catch up with changes in https://reviews.llvm.org/D148978.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D151496
2023-05-25 14:28:28 -07:00
Siva Chandra Reddy
daeee56798 [libc] Add macro LIBC_THREAD_LOCAL.
It resolves to thread_local on all platform except for the GPUs on which
it resolves to nothing. The use of thread_local in the source code has been
replaced with the new macro.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D151486
2023-05-25 19:53:52 +00:00
Sterling Augustine
023504f29a Add missing dependency for tests. 2023-05-25 10:52:18 -07:00
Matthias Springer
7d36a468aa [mlir][tensor] TrackingListener: Support cast-like InsertSliceOps with dynamic shape
When looking for payload op replacements, rank-expanding InsertSliceOps of dynamically-typed tensors are now supported.

Differential Revision: https://reviews.llvm.org/D151444
2023-05-25 19:15:13 +02:00
Matthias Springer
047e7ff253 [mlir][tensor] TrackingListener: Find replacement ops through cast-like InsertSliceOps
Certain InsertSliceOps, that do not use elements from the destination, are treated like casts when looking for replacement ops. Such InsertSliceOps are typically rank expansions.

Tensors with dynamic shape are not supported at the moment.

Also adds test cases for the TrackingListener.

Differential Revision: https://reviews.llvm.org/D151422
2023-05-25 18:49:24 +02:00
Guillaume Chatelet
298843cd66 [libc][test] Drastically reduce mem test runtime
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D151450
2023-05-25 15:05:21 +00:00
Aliia Khasanova
6a939aa80a Fix build file for 1264849299
Differential Revision: https://reviews.llvm.org/D151427
2023-05-25 15:44:48 +02:00
Tobias Hieta
f98ee40f4b [NFC][Py Reformat] Reformat python files in the rest of the dirs
This is an ongoing series of commits that are reformatting our
Python code. This catches the last of the python files to
reformat. Since they where so few I bunched them together.

Reformatting is done with `black`.

If you end up having problems merging this commit because you
have made changes to a python file, the best way to handle that
is to run git checkout --ours <yourfile> and then reformat it
with black.

If you run into any problems, post to discourse about it and
we will try to help.

RFC Thread below:

https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style

Reviewed By: jhenderson, #libc, Mordante, sivachandra

Differential Revision: https://reviews.llvm.org/D150784
2023-05-25 11:17:05 +02:00
Siva Chandra Reddy
aaf758c44a [libc][bazel] Add targets for fmod* and scalbn*.
Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D151354
2023-05-25 06:29:04 +00:00
Sterling Augustine
4d1cd1d8ca remove useless visibility spec from bazel build. 2023-05-24 15:11:31 -07:00
Eugene Burmako
9598fe54e2 [MLIR] Update Bazel build to finish moving PDL-related transform ops into an extension
https://reviews.llvm.org/D151104 moved PDL-related transform ops into an extension and updated the Bazel build, but one tiny thing fell through the cracks - TransformOpsPyFiles also needs to include the newly introduced `mlir/python/mlir/dialects/_transform_pdl_extension_ops_ext.py`.

Reviewed By: saugustine, bkramer

Differential Revision: https://reviews.llvm.org/D151368
2023-05-24 22:04:10 +02:00
Sterling Augustine
16fe2b3736 Disable MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS for bazel builds. 2023-05-24 11:05:43 -07:00
Sterling Augustine
1894c741b0 Fix bazel build for https://reviews.llvm.org/D144552
Differential Revision: https://reviews.llvm.org/D151346
2023-05-24 09:39:53 -07:00
Alex Zinenko
94d608d410 [mlir] move PDL-related transform ops into an extension
The initial bring-up of the Transform dialect relied on PDL to provide
the default handle type (`!pdl.operation`) and the matching capability.
Both are now provided natively by the Transform dialect removing the
reason to have a hard dependency on the PDL dialect and its interpreter.
Move PDL-related transform operations into a separate extension.

This requires us to introduce a dialect state extension mechanism into
the Transform dialect so it no longer needs to know about PDL constraint
functions that may be injected by extensions similarly to operations and
types. This mechanism will be reused to connect pattern application
drivers and the Transform dialect.

This completes the restructuring of the Transform dialect to remove
overrilance on PDL.

Note to downstreams: flow that are using `!pdl.operation` with Transform
dialect operations will now require `transform::PDLExtension` to be
applied to the transform dialect in order to provide the transform
handle type interface for `!pdl.operation`.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D151104
2023-05-24 12:25:06 +00:00
Tue Ly
a2ac3678cd [libc][bazel] Add log, log2, log10, log1p to bazel layout.
Add log, log2, log10, log1p and their unit tests to bazel layout.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D151252
2023-05-24 07:43:58 -04:00
Benjamin Kramer
b0a09bce8d [bazel] Fix build after 0bf120a820 2023-05-24 11:14:18 +02:00
Aaron Siddhartha Mondal
75632fec58 [bazel] Add clang-offload-packager and clang-linker-wrapper
Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D151131
2023-05-24 00:24:14 +02:00