Commit Graph

1516 Commits

Author SHA1 Message Date
Matthias Springer
a2bb365733 [mlir] Fix Bazel build 2023-09-18 16:29:21 +02:00
Matthias Springer
64839fbd45 [mlir][bufferization] Empty tensor elimination for materialize_in_destination (#65468)
This revision adds support for empty tensor elimination to
"bufferization.materialize_in_destination" by implementing the
`SubsetInsertionOpInterface`.

Furthermore, the One-Shot Bufferize conflict detection is improved for
"bufferization.materialize_in_destination".
2023-09-18 15:34:28 +02:00
Haojian Wu
5eabbde6d9 [bazel] Port for 88e3358f33 2023-09-18 08:58:07 +02:00
Christian Sigg
1c8c365de2 [mlir][bytecode] Check that bytecode source buffer is sufficiently aligned. (#66380)
Before this change, the `ByteCode` test failed on CentOS 7 with
devtoolset-9, because strings happen to be only 8 byte aligned. In
general though, strings have no alignment guarantee.

Increase resource alignment in test to 32 bytes. 
Adjust test to sufficiently align buffer.
Add test to check error when buffer is insufficiently aligned.
2023-09-17 13:46:01 +02:00
Guillaume Chatelet
2dbdc9fc85 [libc] Add invoke / invoke_result type traits (#65750) 2023-09-15 11:15:41 +02:00
Oleg Shyshkov
85370b3068 [mlir][bazel] Fix build. 2023-09-15 10:32:21 +02:00
Martin Erhart
08b7a71bcc [mlir][bufferization] Define a pipeline for buffer deallocation (#66352)
Since ownership based buffer deallocation requires a few passes to be run in a somewhat fixed sequence, it makes sense to have a pipeline for convenience (and to reduce the number of transform ops to represent default deallocation).
2023-09-15 09:39:17 +02:00
Martin Erhart
3c81a0bea2 [mlir][bufferization] Fix BAZEL build 2023-09-14 12:57:49 +00:00
Martin Erhart
8160bce969 [mlir][bufferization][NFC] Introduce BufferDeallocationOpInterface (#66349)
This new interface allows operations to implement custom handling of ownership values and insertion of dealloc operations which is useful when an op cannot implement the interfaces supported by default by the buffer deallocation pass (e.g., because they are not exactly compatible or because there are some additional semantics to it that would render the default implementations in buffer deallocation invalid, or because no interfaces exist for this
kind of behavior and it's not worth introducing one plus a default implementation in buffer deallocation). Additionally, it can also be used to provide more efficient handling for a specific op than the interface based default
implementations can.
2023-09-14 13:58:30 +02:00
Oleg Shyshkov
bf8fd086d0 [llvm][mlir][bazel] Fix build. 2023-09-14 13:28:37 +02:00
Martin Erhart
01334d1abb [mlir][bufferization] Add an ownership based buffer deallocation pass (#66337)
Add a new Buffer Deallocation pass with the intend to replace the old
one. For now it is added as a separate pass alongside in order to allow
downstream users to migrate over gradually. This new pass has the goal
of inserting fewer clone operations and supporting additional use-cases.
Please refer to the Buffer Deallocation section in the updated
Bufferization.md file for more information on how this new pass works.
2023-09-14 12:13:37 +02:00
Guillaume Chatelet
aee8f8784a [libc][utils] cpp::always_false to enable static_assert(false) (#66209) 2023-09-14 10:28:43 +02:00
Martin Erhart
520407a7c8 Revert "[mlir][bufferization] Improve buffer deallocation pass"
This reverts commit 1bebb60a75.

This caused problems in downstream projects. We are reverting to give
them more time for integration.
2023-09-13 13:53:48 +00:00
Martin Erhart
792caac0f8 Revert "[mlir][bufferization][NFC] Introduce BufferDeallocationOpInterface"
This reverts commit 29d86175e6.

This caused problems in downstream projects. We are reverting to give
them more time for integration.
2023-09-13 13:53:47 +00:00
Martin Erhart
7995a4701d Revert "[mlir][bufferization] Define a pipeline for buffer deallocation"
This reverts commit f0c4663942.

This caused problems in downstream projects. We are reverting to give
them more time for integration.
2023-09-13 13:53:47 +00:00
Matthias Springer
8143307b33 [mlir][bufferization] Generalize tensor slice rules to subset ops (#65619)
This commit generalizes the special
tensor.extract_slice/tensor.insert_slice bufferization rules to tensor
subset ops.

Ops that insert a tensor into a tensor at a specified subset (e.g.,
tensor.insert_slice, tensor.scatter) can implement the
`SubsetInsertionOpInterface`.

Apart from adding a new op interface (extending the API), this change is
NFC. The only ops that currently implement the new interface are
tensor.insert_slice and tensor.parallel_insert_slice, and those ops were
are supported by One-Shot Bufferize.
2023-09-13 12:27:19 +02:00
Martin Erhart
f0c4663942 [mlir][bufferization] Define a pipeline for buffer deallocation
Since buffer deallocation requires a few passes to be run in a somewhat fixed
sequence, it makes sense to have a pipeline for convenience (and to reduce the
number of transform ops to represent default deallocation).

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D159432
2023-09-13 09:30:24 +00:00
Martin Erhart
29d86175e6 [mlir][bufferization][NFC] Introduce BufferDeallocationOpInterface
This new interface allows operations to implement custom handling of ownership
values and insertion of dealloc operations which is useful when an op cannot
implement the interfaces supported by default by the buffer deallocation pass
(e.g., because they are not exactly compatible or because there are some
additional semantics to it that would render the default implementations in
buffer deallocation invalid, or because no interfaces exist for this kind of
behavior and it's not worth introducing one plus a default implementation in
buffer deallocation). Additionally, it can also be used to provide more
efficient handling for a specific op than the interface based default
implementations can.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D158756
2023-09-13 09:30:23 +00:00
Martin Erhart
1bebb60a75 [mlir][bufferization] Improve buffer deallocation pass
Add a new Buffer Deallocation pass replacing the old one with the goal of
inserting fewer clone operations and supporting additional use-cases.
Please refer to the Buffer Deallocation section in the updated
Bufferization.md file for more information on how this new pass works.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D158421
2023-09-13 09:30:23 +00:00
Guillaume Chatelet
7329816285 [libc] Add is_object (#65749)
Add the is_object type traits.
Implementation comes from
https://en.cppreference.com/w/cpp/types/is_object
2023-09-12 10:35:22 +02:00
Guillaume Chatelet
a1f5a495e0 [libc] Add type_traits tests (#65956)
This is not exhaustive for now but it provides a placeholder for
`invoke_result` test mentioned in #65750.
2023-09-11 14:15:12 +00:00
Guillaume Chatelet
6632882a38 [libc][bazel] Add CPP tests (#65941)
This PR adds tests for the `src/__support/CPP` folder to the bazel build
system.
2023-09-11 11:52:05 +02:00
Dmitri Gribenko
5af556f6d8 [bazel] Add new TableGen output files for 46f3ade508 2023-09-08 16:01:28 +02:00
Dmitri Gribenko
a0022ccc72 Revert "[Bazel] Update "basic_attr_gen" (D141714, 46f3ade508)"
This reverts commit dbd548d062. The
correct target to update is ast_attr_gen.
2023-09-08 16:01:28 +02:00
Guillaume Chatelet
74971db140 [libc] Add is_scalar (#65740)
Adds the is_scalar traits based on implementation in
https://en.cppreference.com/w/cpp/types/is_scalar
2023-09-08 12:45:17 +00:00
Guillaume Chatelet
eebf8faf3e [libc] Add is_member_pointer_v (#65631)
Implementation from
https://en.cppreference.com/w/cpp/types/is_member_pointer
2023-09-08 11:36:19 +02:00
NAKAMURA Takumi
dbd548d062 [Bazel] Update "basic_attr_gen" (D141714, 46f3ade508) 2023-09-08 10:17:58 +09:00
Dmitri Gribenko
b5fc4a8b2e [bazel] Add missing dependencies 2023-09-07 18:24:38 +02:00
Guillaume Chatelet
260036ab1e [libc] move in_place_t in utility (#65623)
This is needed because `cpp::in_place_t` is also used by `cpp::expected`
https://en.cppreference.com/w/cpp/utility/in_place
2023-09-07 18:12:50 +02:00
Dmitri Gribenko
51e7ab28a7 [bazel] Add missing dependencies, remove headers that don't belong to the target 2023-09-07 18:03:48 +02:00
Dmitri Gribenko
26f71500f8 [bazel] Add missing dependencies for 8cd4ecfa 2023-09-07 17:50:27 +02:00
Guillaume Chatelet
8d18671d81 [libc][bazel] Fix missing dependencies for lseek (#65618)
Failure introduced in 8cd4ecfa60
2023-09-07 17:11:47 +02:00
Dmitri Gribenko
7bac6823bd [bazel] Add missing dependencies necessary for the recent MLIR changes 2023-09-07 16:03:21 +02:00
wenzhi-cui
5ccda55772 Fix AtomicInterfacesTdFiles missing deps/typos in Bazel (#65562) 2023-09-07 08:26:03 +02:00
Razvan Lupusoru
61278ec348 [openacc][openmp] Add dialect representation for acc atomic operations (#65493)
The OpenACC standard specifies an `atomic` construct in section 2.12 (of
3.3 spec), used to ensure that a specific location is accessed or
updated atomically. Four different clauses are allowed: `read`, `write`,
`update`, or `capture`. If no clause appears, it is as if `update` is
used.

The OpenMP specification defines the same clauses for `omp atomic`. The
types of expression and the clauses in the OpenACC spec match the OpenMP
spec exactly. The main difference is that the OpenMP specification is a
superset - it includes clauses for `hint` and `memory order`. It also
allows conditional expression statements. But otherwise, the expression
definition matches.

Thus, for OpenACC, we refactor and reuse the OpenMP implementation as
follows:
* The atomic operations are duplicated in OpenACC dialect. This is
preferable so that each language's semantics are precisely represented
even if specs have divergence.
* However, since semantics overlap, a common interface between the
atomic operations is being added. The semantics for the interfaces are
not generic enough to be used outside of OpenACC and OpenMP, and thus
new folders were added to hold common pieces of the two dialects.
* The atomic interfaces define common accessors (such as getting `x` or
`v`) which match the OpenMP and OpenACC specs. It also adds common
verifiers intended to be called by each dialect's operation verifier.
* The OpenMP write operation was updated to use `x` and `expr` to be
consistent with its other operations (that use naming based on spec).

The frontend lowering necessary to generate the dialect can also be
reused. This will be done in a follow up change.
2023-09-06 13:54:39 -07:00
NAKAMURA Takumi
cd25a50a8f [Bazel] Introduce //compiler-rt:profile
At the moment,

  - Provide only `profile`
  - Will invoke error unless the platform is linux

Differential Revision: https://reviews.llvm.org/D156095
2023-09-06 22:10:30 +09:00
Guillaume Chatelet
4acc3ffbb0 [reland][libc][NFC] split type_traits / utility in separate files (#65314)
`type_traits` and `utility` refer to each other in their
implementations. Also `type_traits` starts to become too big to be
manageable. This PR splits each function into individual files. FTR this
is [how libcxx handles large headers as
well](https://github.com/llvm/llvm-project/tree/main/libcxx/include/__type_traits).

The reland adds two missing functions : is_destructible_v and is_reference_v
2023-09-06 09:23:00 +00:00
Guillaume Chatelet
bcdbd0bd0b Revert "[libc][NFC] split type_traits / utility in separate files (#65314)"
This reverts commit b793c7e530.
It broke the libc-x86_64-debian-gcc-fullbuild-dbg build bot.
https://lab.llvm.org/buildbot/#/builders/250/builds/9776
2023-09-06 08:47:45 +00:00
Guillaume Chatelet
b793c7e530 [libc][NFC] split type_traits / utility in separate files (#65314)
`type_traits` and `utility` refer to each other in their
implementations. Also `type_traits` starts to become too big to be
manageable. This PR splits each function into individual files. FTR this
is [how libcxx handles large headers as
well](https://github.com/llvm/llvm-project/tree/main/libcxx/include/__type_traits).
2023-09-06 10:31:08 +02:00
Guillaume Chatelet
56426c6cdf [libc] customizable namespace 1/4 (#65321)
This implements the first step of
https://discourse.llvm.org/t/rfc-customizable-namespace-to-allow-testing-the-libc-when-the-system-libc-is-also-llvms-libc/73079

Make required Bazel and CMake preparatory changes which define the var
for the customizable namespace and use it (pass it as a compile option
-DLIBC_NAMESPACE=<...>).

Differential Revision: https://reviews.llvm.org/D159112
2023-09-06 10:27:56 +02:00
Benjamin Kramer
1078627cf8 [bazel] Add missing dependency for e55e36de7a 2023-09-05 19:58:38 +02:00
Benjamin Kramer
e8144c7011 [bazel] Port bc45acbddc 2023-09-05 11:48:04 +02:00
Martin Erhart
8037deb7af [mlir][memref] Add pass to expand realloc operations, simplify lowering to LLVM
There are two motivations for this change:
1. It considerably simplifies adding support for the realloc operation to the
   new buffer deallocation pass by lowering the realloc such that no
   deallocation operation is inserted and the deallocation pass itself can
   insert that dealloc
2. The lowering is expressed on a higher level and thus easier to understand,
   and the lowerings of the memref operations it is composed of don't have to
   be duplicated in the MemRefToLLVM lowering (also see discussion in
   https://reviews.llvm.org/D133424)

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D159430
2023-09-05 08:58:40 +00:00
Christian Sigg
4ae0db4ee6 [bazel][mlir] Add missing file after @62e90db 2023-09-05 08:07:15 +02:00
Nicolas Vasilache
62e90db21b [mlir][Transform] Add an example of a preloaded reference lowering to LLVM
Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D159364
2023-09-04 16:20:24 +02:00
Adrian Kuegel
ba6af8f63c [mlir][Bazel] Adapt to 2ae5d1c790 2023-09-04 14:08:37 +02:00
Aart Bik
9ce445b8c7 [mlir][sparse] simplification of sparse runtime support lib
Incorporated two header files directly into other since
other parts were used (and it makes it hard to find the
definitions). Removed TODOs that are less likely to be done.

Reviewed By: yinying-lisa-li

Differential Revision: https://reviews.llvm.org/D159381
2023-09-01 14:00:19 -07:00
Hanhan Wang
c5dee18b63 [mlir][memref] Add support for erasing dead allocations.
Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D159135
2023-09-01 13:30:26 -07:00
Mehdi Amini
471004c5c9 Revert "[mlir][sparse] simplification of sparse runtime support lib"
This reverts commit 14c58cf5c3.

The gcc7 build is broken.
2023-09-01 11:50:14 -07:00
Aart Bik
14c58cf5c3 [mlir][sparse] simplification of sparse runtime support lib
Incorporated two header files directly into other since
other parts were used (and it makes it hard to find the
definitions). Removed TODOs that are less likely to be done.

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D159330
2023-09-01 09:28:48 -07:00