Commit Graph

816 Commits

Author SHA1 Message Date
Oleg Shyshkov 41280908e4 Revert "[mlir][linalg] Replace "string" iterator_types attr with enums in LinalgInterface."
Breaks linalg python tests. Would need to also update python/mlir/dialects/linalg/opdsl.

This reverts commit b809d73973.
2022-11-09 15:59:54 +01:00
Oleg Shyshkov b809d73973 [mlir][linalg] Replace "string" iterator_types attr with enums in LinalgInterface.
[RFC: EnumAttr for iterator types in Linalg](https://discourse.llvm.org/t/rfc-enumattr-for-iterator-types-in-linalg/64535)

This affect touches and probably breaks most of the code that creates `linalg.generic`. A fix would be to replace calls to `getParallelIteratorTypeName/getReductionIteratorTypeName` with `mlir::utils::IteratorType::parallel/reduction` and types from `StringRef` to `mlir::utils::IteratorType`.

Due to limitations of tablegen, shared C++ definition of IteratorType enum lives in StructuredOpsUtils.td, but each dialect should have it's own EnumAttr wrapper. To avoid conflict, all enums in a dialect are put into a separate file with a separate tablegen rule.

Test dialect td files are refactored a bit.

Printed format of `linalg.generic` temporarily remains unchanged to avoid breaking code and tests in the same change.

Differential Revision: https://reviews.llvm.org/D137658
2022-11-09 15:47:29 +01:00
Mehdi Amini 6174568bdc Do not build with Werror by default (Bazel build)
This seems like an anti-pattern to have -Werror on by default:
it is hostile to user as we can't ensure that all of the supported
platforms are warning-free, and any newer compiler could break the build
for a user who does not have a clear actionable way around it.

Reviewed By: GMNGeoffrey, kuhar

Differential Revision: https://reviews.llvm.org/D123481
2022-11-09 00:48:05 +00:00
Johannes Reifferscheid 2525fddae8 Fix build file for PDLL tests. 2022-11-08 13:24:08 +01:00
Johannes Reifferscheid 000aecafce Add missing PDLL libs. 2022-11-08 12:14:32 +01:00
Johannes Reifferscheid e7bb54d4fd Add missing build deps. 2022-11-08 11:45:12 +01:00
Emilio Cota 463da45892 [bazel][mlir] NVGPUToNVVM fixes for 708185f03f 2022-11-07 14:21:53 -05:00
Tue Ly 6c6dff7e2c [libc] Add add_with_carry to builtin wrapper.
Add add_with_carry to builtin wrapper to be used by UInt class.

Reviewed By: orex

Differential Revision: https://reviews.llvm.org/D137453
2022-11-04 23:20:37 -04:00
David Blaikie 7ded25c0cb Fix Bazel build for ba65584d15 2022-11-04 23:35:05 +00:00
Benjamin Kramer 93c7a9bf6c [bazel] Port 589764a382 2022-11-04 19:06:44 +01:00
Adrian Kuegel 0041b92cef [mlir][Bazel] Add mlir-translate as data for dialect tests. 2022-11-03 08:12:19 +01:00
Augie Fackler 001d18664f [bolt] update bazel rules for f71d32a0ee
Differential Revision: https://reviews.llvm.org/D137281
2022-11-02 15:03:52 -04:00
yijiagu 145d2a50b8 Add Async Function to the Async Dialect
Add Async Function to the Async Dialect

Today `async.execute` operation semantics requires attached region to be executed in a thread managed by the runtime, and always returns an `!async.token` result. We need to model async functions that are not necessarily executed in a runtime-managed threads, but eventually lowered to llvm coroutines.

Example:

```
async.func @foo(%arg0: !async.value<f32>) -> !async.token {
  %0 = async.await %arg0: !async.value<f32>
  "do_something_with_f32"(%0)
  return
}
```

If `arg0` is available this function will be executed in the caller thread. If it's not available it will be suspended and resumed later later on a thread managed by the async runtime. Currently this is not representable with `async.execute` operations.

The longer term goal is to make async dialect more like https://github.com/lewissbaker/cppcoro to be able to represent structured host concurrency in MLIR.

(1) Add async.func, async.call, and async.return operations in Async Dialect

Reviewed By: ezhulenev, rriddle

Differential Revision: https://reviews.llvm.org/D137189
2022-11-02 11:34:08 -07:00
Anlun Xu 8c2540ed56 [Bazel] Add llvm:Support to Bazel deps of SPIRVCommonConversion
Differential Revision: https://reviews.llvm.org/D137119
2022-10-31 16:03:14 -07:00
Haojian Wu 8b1865b562 [mlir] Fix the bazel error after c853d69ab9 2022-10-29 08:00:29 +02:00
Haojian Wu fe5b7d9406 [mlir] One more the bazel build for 3ac17449cf 2022-10-28 15:09:48 +02:00
Haojian Wu 4e830bb208 [mlir] Fix the bazel build for 3ac17449cf 2022-10-28 14:49:33 +02:00
Diego Caballero b1bc1a1ed6 [mlir][Vector] Introduce the MaskingOpInterface
This MaskingOpInterface provides masking cababilitites to those
operations that implement it. For only is only implemented by the `vector.mask`
operation and it's used to break the dependency between the Vector
dialect (where the `vector.mask` op lives) and operations implementing
the MaskableOpInterface.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D136734
2022-10-27 22:54:19 +00:00
Aaron Siddhartha Mondal 41ed9d0297 [Bazel] Add missing C++ style Clang headers and modulemap
Reviewed By: chapuni

Differential Revision: https://reviews.llvm.org/D136452
2022-10-28 07:00:59 +09:00
Emilio Cota 17dbd80ff7 [mlir] Fix typo s/utilties/utilities/ (including in file name)
Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D136887
2022-10-27 17:14:33 -04:00
Matthias Springer c1f0a15c65 [mlir][tensor][bufferize] Lower tensor.generate to linalg.map
There is no memref equivalent of tensor.generate. The purpose of this change is to avoid creating scf.parallel loops during bufferization.

Differential Revision: https://reviews.llvm.org/D136767
2022-10-27 12:03:13 +02:00
Matthias Springer bf531f28f5 [mlir][vector][bufferize] Implement DestinationStyleOpInterface on TransferWriteOp
This simplifies the BufferizableOpInterface implementation of vector.transfer_write.

Differential Revision: https://reviews.llvm.org/D136348
2022-10-27 11:02:19 +02:00
Matthias Springer 2d5edc644d [mlir][bufferize] Provide default BufferizableOpInterface impl for destination style ops
tensor.insert and tensor.insert_slice (as destination style ops) do no longer need to implement the entire BufferizableOpInterface.

Differential Revision: https://reviews.llvm.org/D136347
2022-10-27 10:52:47 +02:00
Matthias Springer bcc31d694f [mlir][tensor] Implement DestinationStyleOpInterface for tensor.insert/insert_slice
Also allow unranked tensors/memrefs with destination style op outputs.

This allows for a simpler implementation of the BufferizableOpInterface (in a subsequent commit).

Differential Revision: https://reviews.llvm.org/D136346
2022-10-27 10:33:58 +02:00
Jordan Rupprecht 98d797cb71 [Bazel][llvm-debuginfo-analyzer] Add deps for DebugInfoLogicalView after 4f06d46f46 2022-10-26 22:24:49 -07:00
Emilio Cota 9fc345c5c7 [bazel][mlir][arith] build fixes for arith fastmath flags 2022-10-26 17:47:09 -04:00
Fangrui Song 3a3603ff99 [clang] Replace BACKEND_PACKAGE_STRING with LLVM_VERSION_STRING
420d7ccbac introduced BACKEND_PACKAGE_STRING to
replace `PACKAGE_VERSION` (llvm/Config/config.h) to support standalone builds.
This is used in the output of `clang -cc1 -v`.

Since llvm-config.h is available for both standalone and non-standalone builds,
we can just use `LLVM_VERSION_STRING` from llvm-config.h.

clang/cmake/modules/AddClang.cmake uses `VERSION_STRING "${CLANG_VERSION} (${BACKEND_PACKAGE_STRING})"`.
Just simplify it to `"${CLANG_VERSION}"` so that we can remove the CMake
variable BACKEND_PACKAGE_STRING.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D136660
2022-10-25 00:24:25 -07:00
Guillaume Chatelet 12c9cb6cc9 [llvm-exegesis] Fix missing dependency in BUILD.bazel
This was broken by https://reviews.llvm.org/D136351
2022-10-24 10:39:39 +00:00
Guillaume Chatelet 0e0c82bbfe [libc] Fix BUILD.bazel missing dependency 2022-10-24 10:34:05 +00:00
Guillaume Chatelet 69090143f5 [libc] mem* framework v3
This version is more composable and also simpler at the expense of being more explicit and more verbose.

This patch provides rationale for the framework, implementation and unit tests but the functions themselves are still using the previous version. The change in implementation will come in a follow up patch.

Differential Revision: https://reviews.llvm.org/D136292
2022-10-24 09:13:46 +00:00
Matthias Springer b169643f3a [mlir][interfaces] Remove getDestinationOperands from TilingInterface
`getDestinationOperands` was almost a duplicate of `DestinationStyleOpInterface::getOutputOperands`. Now that the interface has been moved to mlir/Interfaces, it is no longer needed.

Differential Revision: https://reviews.llvm.org/D136240
2022-10-24 09:26:19 +02:00
Adrian Kuegel 88f4cdd37c [mlir][Bazel] Port 3bef1e0f4c 2022-10-24 09:10:30 +02:00
Guillaume Chatelet d02525cab7 [libc] Add cpp::byte
This provides the equivalent of std::byte.
std::byte is a distinct type that implements the concept of byte as specified in the C++ language definition.
https://en.cppreference.com/w/cpp/types/byte

Differential Revision: https://reviews.llvm.org/D136294
2022-10-22 20:54:14 +00:00
Aart Bik 21ef1cac13 bazel fix for TranslateLib
Reviewed By: cota

Differential Revision: https://reviews.llvm.org/D136519
2022-10-21 20:07:58 -07:00
bixia1 b5afa79eca Add missing dependency to fix build.bazel.
Reviewed By: Peiming, aartbik

Differential Revision: https://reviews.llvm.org/D136516
2022-10-21 17:02:13 -07:00
bixia1 dacfdbcdd9 Fix build.bazel files for adding Index dialect and LLVMTypes.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136481
2022-10-21 15:55:51 -07:00
Siva Chandra Reddy 7a6846378c [bazel][obvious] Add few missing deps in the libc overlay. 2022-10-21 19:42:24 +00:00
Adrian Kuegel a26dda2bbc [clang][Bazel] Port a7183a158d 2022-10-21 08:46:14 +02:00
Guillaume Chatelet 3c438f6119 Revert D136292 "[libc] mem* framework v3"
This breaks llvm-libc build bots:
 - libc-x86_64-debian-dbg-asan
 - libc-x86_64-debian-fullbuild-dbg-asan
Address sanitizers fail with "AddressSanitizer: invalid alignment requested in aligned_alloc: 64, alignment must be a power of two and the requested size 0x41 must be a multiple of alignment (thread T0)"
 - libc-aarch64-ubuntu-dbg
 - libc-aarch64-ubuntu-fullbuild-dbg
https://lab.llvm.org/buildbot/#/builders/223/builds/8877/steps/7/logs/stdio
 - libc-arm32-debian-dbg
https://lab.llvm.org/buildbot/#/builders/229/builds/5201/steps/7/logs/stdio

This reverts commit 903cc71a82.
2022-10-20 13:59:05 +00:00
Guillaume Chatelet 903cc71a82 [libc] mem* framework v3
This version is more composable and also simpler at the expense of being more explicit and more verbose.

This patch provides rationale for the framework, implementation and unit tests but the functions themselves are still using the previous version. The change in implementation will come in a follow up patch.

Differential Revision: https://reviews.llvm.org/D136292
2022-10-20 13:44:07 +00:00
Peiming Liu 26eb2c6b42 [mlir][sparse] remove vector support in sparsification
Sparse compiler used to generate vectorized code for sparse tensors computation, but it should really be delegated to other vectorization passes for better progressive lowering.

 https://discourse.llvm.org/t/rfc-structured-codegen-beyond-rectangular-arrays/64707

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136183
2022-10-19 18:11:29 +00:00
wren romano e0401d2252 [mlir][sparse] Removing the DimLvlType and DimLevelFormat types
This removes another massive source of redundancy, and instead has the Merger.{h,cpp} reuse the SparseTensorEnums library.

Depends On D136005

Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D136123
2022-10-18 15:47:40 -07:00
wren romano 062f29c8d0 [mlir][sparse] Moving Enums.h into Dialect/SparseTensor/IR
Move the SparseTensorEnums library out of the ExecutionEngine directory and into Dialect/SparseTensor/IR.

Depends On D136002

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136005
2022-10-18 15:15:18 -07:00
wren romano 181b04d276 [mlir][sparse] Factoring out SparseTensorEnums library
This differential splits the SparseTensorEnums library out from the SparseTensorRuntime library. The actual moving of files will be handled in the next differential.

Depends On D135996

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D136002
2022-10-18 14:20:33 -07:00
wren romano 0e77b63bc0 [mlir][sparse] Use the runtime DimLevelType instead of a separate tablegen enum
This differential replaces all uses of SparseTensorEncodingAttr::DimLevelType with DimLevelType.  The next differential will break out a separate library for the DimLevelType enum, so that the Dialect code doesn't need to depend on the rest of the runtime

Depends On D135995

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D135996
2022-10-18 13:45:26 -07:00
Jordan Rupprecht a096131545 [Bazel] Add target for llvm-debuginfo-analyzer binary 2022-10-18 08:45:10 -07:00
Matthias Springer cfc9ddaafc [mlir][interfaces][NFC] Move DestinationStyleOpInterface to mlir/Interfaces
This is the second (and final) step of making "destination style" usable without depending on the Linalg dialect. (The first step was D135129.)

This change allows us to provide default bufferization implementations for all destination-style ops. It also allows us to simplify `TilingInterface`. (E.g., `getDestinationOperands` can be removed.)

Differential Revision: https://reviews.llvm.org/D136179
2022-10-18 17:39:06 +02:00
Guillaume Chatelet 5e9945f624
[libc] Fix missing bazel dependency
This fixes breakage introduced in a786096f9d
2022-10-18 16:37:08 +02:00
Jordan Rupprecht 4758cd5ae7 [bazel] Port dd38f89980 and fix 7732c97f52. 2022-10-17 16:54:37 -07:00
Jacques Pienaar 7732c97f52 [mlir][quant] Initial bytecode encoding for quantized types
Add bytecode encoding for quantized types. These mostly follow the
storage representation of these.

Differential Revision: https://reviews.llvm.org/D136004
2022-10-17 16:28:46 -07:00
Fangrui Song 3baadff896 [CMake] Remove CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
When Clang is used as a cross compiler, it should respect the target
platform default. Defaulting to a configure-time CLANG_DEFAULT_STD_C/CLANG_DEFAULT_STD_CXX
does not make much sense.

When Clang is used as a single-platform compiler, we should use Clang
configuration file (https://discourse.llvm.org/t/configuration-files/42529
https://clang.llvm.org/docs/UsersManual.html#configuration-files).

The Gentoo needs from D34365 has been satisfied by a configuration file.

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D133375
2022-10-16 13:15:44 -07:00
Sterling Augustine d8415b02a5 Revert "[libc] New version of the mem* framework"
This reverts commit https://reviews.llvm.org/D135134 (b3f1d58a13)

That revision appears to have broken Arm memcpy in some subtle
ways. Am communicating with the original author to get a
good reproduction.
2022-10-14 12:32:20 -07:00
Benjamin Kramer 08ec744d4d [bazel] Port 911d2dc (LLVMFrontendHLSL) 2022-10-14 21:08:44 +02:00
Guillaume Chatelet b3f1d58a13 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

    Codegen can be checked here https://godbolt.org/z/chf1Y6eGM

    Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 13:46:42 +00:00
Guillaume Chatelet 6d252a4888 Revert "[libc] New version of the mem* framework"
This reverts commit 9721687835.
2022-10-14 13:21:52 +00:00
Guillaume Chatelet 9721687835 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 12:42:54 +00:00
Guillaume Chatelet 4fed4b0943 Revert "[libc] New version of the mem* framework"
This reverts commit 98bf836f31.
2022-10-14 12:27:04 +00:00
Guillaume Chatelet 98bf836f31 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-14 12:25:03 +00:00
Alex Brachet 1fda6f6859 [llvm-driver] Add lld
The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds the capability for lld to be part of the
llvm-driver.

Differential Revision: https://reviews.llvm.org/D127472
2022-10-13 19:23:25 +00:00
Guillaume Chatelet 9d1f6466e5 Revert "[libc] New version of the mem* framework"
This reverts commit d55f2d8ab0.
2022-10-13 14:49:58 +00:00
Guillaume Chatelet d55f2d8ab0 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

Differential Revision: https://reviews.llvm.org/D135134
2022-10-13 14:44:03 +00:00
Guillaume Chatelet e431731e08 Revert "[libc] New version of the mem* framework"
This reverts commit 4c19439d24.
2022-10-12 15:35:18 +00:00
Guillaume Chatelet 4c19439d24 [libc] New version of the mem* framework
This version is more composable and also simpler at the expense of being more explicit and more verbose.
This patch is not meant to be submitted but gives an idea of the change.
Codegen can be checked in https://godbolt.org/z/6z1dEoWbs by removing the "static inline" before individual functions.

Unittests are coming.

Suggested review order:
 - utils
 - op_base
 - op_builtin
 - op_generic
 - op_x86 / op_aarch64
 - *_implementations.h

Differential Revision: https://reviews.llvm.org/D135134
2022-10-12 15:26:26 +00:00
Adrian Kuegel b781ef890f [mlir][Bazel] Port 8446f24ef0 2022-10-12 14:07:31 +02:00
wren romano 6206692931 [mlir][sparse] Renaming mlir_sparse_tensor_utils library to SparseTensorRuntime
The "mlir_xxx_utils" naming scheme is reserved/intended for shared libraries, whereas this library must be static due to issues of linking DLLs on Windows.  So we rename the library to avoid any potential confusion.   In addition we also rename the ExecutionEngine/SparseTensorUtils.{h,cpp} files to match the new library name.

Reviewed By: aartbik, stella.stamenova

Differential Revision: https://reviews.llvm.org/D135613
2022-10-11 15:00:11 -07:00
Adrian Kuegel 7407419233 [mlir][Bazel] Remove unused dependency. 2022-10-11 15:39:28 +02:00
Alex Zinenko 3e1f6d02f7 [mlir] add OperationType to the Transform dialect
Add a new OperationType handle type to the Transform dialect. This
transform type is parameterized by the name of the payload operation it
can point to. It is intended as a constraint on transformations that are
only applicable to a specific kind of payload operations. If a
transformation is applicable to a small set of operation classes, it can
be wrapped into a transform op by using a disjunctive constraint, such
as `Type<Or<[Transform_ConcreteOperation<"foo">.predicate,
Transform_ConcreteOperation<"bar">.predicate]>>` for its operand without
modifying this type. Broader sets of accepted operations should be
modeled as specific types.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D135586
2022-10-11 09:55:19 +00:00
Alex Zinenko 6fe0309602 [mlir] switch transform dialect ops to use TransformTypeInterface
Use the recently introduced TransformTypeInterface instead of hardcoding
the PDLOperationType. This will allow the operations to use more
specific transform types to express pre/post-conditions in the future.
It requires the syntax and Python op construction API to be updated.
Dialect extensions will be switched separately.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D135584
2022-10-11 09:55:13 +00:00
Alex Zinenko bba85ebdfe [mlir] add types to the transform dialect
Introduce a type system for the transform dialect. A transform IR type
captures the expectations of the transform IR on the payload IR
operations that are being transformed, such as being of a certain kind
or implementing an interface that enables the transformation. This
provides stricter checking and better readability of the transform IR
than using the catch-all "handle" type.

This change implements the basic support for a type system amendable to
dialect extensions and adds a drop-in replacement for the unrestricted
"handle" type. The actual switch of transform dialect ops to that type
will happen in a separate commit.

See https://discourse.llvm.org/t/rfc-type-system-for-the-transform-dialect/65702

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D135164
2022-10-11 09:55:07 +00:00
Diego Caballero 2d10f81d46 [mlir][Vector] Introduce 'vector.mask' operation and MaskableOpInterface
This patch introduces the `vector.mask` operation and the MaskableOpInterface
as described in https://discourse.llvm.org/t/rfc-vector-masking-representation-in-mlir/64964.
The `vector.mask` operation is used to predicate the execution of operations
implementing the MaskableOpInterface. This interface will be implemented by maskable
operations and provides information about its masking constraints and semantics.

For now, only vector transfer and reduction ops implement the MaskableOpInterface
for illustration and testing purposes.

Reviewed By: nicolasvasilache, rriddle

Differential Revision: https://reviews.llvm.org/D134939
2022-10-10 21:25:43 +00:00
wren romano 1aa06aeb1a [mlir][sparse] Removing DLL attributes from ExecutionEngine/SparseTensor/Enums.h
This differential attempts to resolve certain issues on Windows (e.g., https://reviews.llvm.org/D134933#3843372 and https://reviews.llvm.org/D133462#3844195).

Reviewed By: stella.stamenova, aganea

Differential Revision: https://reviews.llvm.org/D135502
2022-10-10 11:22:12 -07:00
Goran Flegar c7545de9b4 [mlir][Bazel] Fix for reviews.llvm.org/D135559 2022-10-10 16:28:38 +02:00
Simon Giesecke 2f46f50907 Add llvm-gsymutil to the Bazel build files.
Differential Revision: https://reviews.llvm.org/D135568
2022-10-10 13:11:40 +02:00
Adrian Kuegel b0ac5d7be0 [mlir][Bazel] Port d85f6e5d57 2022-10-07 13:49:28 +02:00
Aart Bik d71dc357b1 [mlir][sparse] remove llvm dependence from sparse bazel
Reviewed By: wrengr, Peiming

Differential Revision: https://reviews.llvm.org/D135401
2022-10-06 14:22:24 -07:00
Alex Brachet d5090cd94a [llvm-driver] Add various tools to the llvm-driver
The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds a few more llvm tools to the
llvm-driver.

Differential Revision: https://reviews.llvm.org/D135281
2022-10-06 05:16:13 +00:00
Aart Bik 80902b72ef [mlir][bazel] fix VectorToGPU bazel breakage
NOTE: this is probably not the long term organization
      that you want to keep after the refactoring to new
      directories, but this fixes the breakage for now;
      I leave proper refactoring of build to the NVGPU
      bazel team.

Differential Revision: https://reviews.llvm.org/D135344
2022-10-05 21:12:01 -07:00
Rob Suderman 684e8bfabb [mlir][mlprogram] Add CAPI project for MLProgram
Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D135291
2022-10-05 10:55:29 -07:00
Aart Bik 02fd0e5de4 [mlir][sparse] fixed typo in fix of bazel fix
Reviewed By: cota

Differential Revision: https://reviews.llvm.org/D135184
2022-10-04 11:15:13 -07:00
Aart Bik 4d997217f4 [mlir][sparse] fix bazel breakage
Reviewed By: cota

Differential Revision: https://reviews.llvm.org/D135183
2022-10-04 10:59:45 -07:00
Guray Ozen 89bb0cae46 [mlir][transform] Create GPU transform dialect
This revision adds GPU transform dialect. It also introduce a prefix such as "transform.gpu" for all ops related to this dialect.

MLIR already had two GPU transform op in linalg. This revision moves these ops into GPUTransformOps. The Ops are as follows:

`transform.structured.map_nested_foreach_thread_to_gpu_blocks`  -> `transform.gpu.map_foreach_to_blocks`
This op selects the outermost (toplevel) foreach_thread and parallelize across GPU blocks. It can also generate `gpu_launch`.

`transform.structured.map_nested_foreach_thread_to_gpu_threads` -> `transform.gpu.map_nested_foreach_to_threads`
This op parallelizes nested foreach_thread that are inside `gpu_launch` across GPU threads.

It doesn't add new functionality, but there are some minor refactoring of the code.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D134800
2022-10-04 13:09:08 +02:00
Matthias Springer 81ca5aa452 [mlir][tensor][NFC] Rename linalg.init_tensor to tensor.empty
tensor.empty/linalg.init_tensor produces an uninititalized tensor that can be used as a destination operand for destination-style ops (ops that implement `DestinationStyleOpInterface`).

This change makes it possible to implement `TilingInterface` for non-destination-style ops without depending on the Linalg dialect.

RFC: https://discourse.llvm.org/t/rfc-add-tensor-from-shape-operation/65101

Differential Revision: https://reviews.llvm.org/D135129
2022-10-04 17:25:35 +09:00
Jordan Rupprecht de471fee27 [bazel] port d033ece0c9 2022-10-03 18:49:14 -07:00
Aart Bik fdadb5c146 [mlir] fix bazel build breakage
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135105
2022-10-03 14:39:27 -07:00
Aart Bik 83f2b19f3e [mlir] fix bazel file
Reviewed By: Peiming

Differential Revision: https://reviews.llvm.org/D135104
2022-10-03 13:58:45 -07:00
Christian Sigg 2ddbe56b34 [Bazel] fixes for 9f77909. 2022-10-03 09:12:21 +02:00
Matthias Springer 598f5275c1 [mlir][interfaces] Add ShapedDimOpInterface
This interface is implemented by memref.dim and tensor.dim. This change makes it possible to remove a build dependency of the Affine dialect on the Tensor dialect (and maybe also the MemRef dialect in the future).

Differential Revision: https://reviews.llvm.org/D133595
2022-10-03 13:58:52 +09:00
wren romano 97bd83b51f [mlir][sparse] SparseTensorUtils post-refactoring cleanup
This differential corrects a few minor rebasing errors from the recent slew of differentials for factoring out the mlir_sparsetensor_utils library.

Reviewed By: aartbik, Peiming

Differential Revision: https://reviews.llvm.org/D134985
2022-09-30 13:29:46 -07:00
Adrian Kuegel e0d5012f6a [mlir][Bazel] Port 11069cbcb4 2022-09-30 08:34:14 +02:00
wren romano 0fca5c5f45 [mlir][sparse] refactoring SparseTensorUtils: (1 of 4) file-splitting
Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* (this): Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part aims to make no changes other than the 1:N file splitting, and things which are forced to accompany that change.

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133462
2022-09-29 14:35:27 -07:00
Jakub Kuderski abc362a107 [mlir][arith] Change dialect name from Arithmetic to Arith
Suggested by @lattner in https://discourse.llvm.org/t/rfc-define-precise-arith-semantics/65507/22.

Tested with:
`ninja check-mlir check-mlir-integration check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner check-mlir-examples`

and `bazel build --config=generic_clang @llvm-project//mlir:all`.

Reviewed By: lattner, Mogball, rriddle, jpienaar, mehdi_amini

Differential Revision: https://reviews.llvm.org/D134762
2022-09-29 11:23:28 -04:00
Benjamin Kramer 23132508d9 [bazel] Port 3f050f6ac4 2022-09-29 00:12:46 +02:00
Christian Sigg 0a14f73126 [Bazel] NFC: Move ParseUtilities.h from 'hdrs' to 'srcs'.
This is slightly cleaner.
2022-09-28 08:30:08 +02:00
Christian Sigg 39bf517e01 [Bazel] Fix after 4b27825ba3. 2022-09-28 08:18:30 +02:00
bixia1 4329ca61e8 [mlir][sparse] Add sparse_tensor.sort operator.
Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D134482
2022-09-27 12:00:08 -07:00
Lorenzo Chelini 4db3a649ea [MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC) [reland]
The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache, cota

Differential Revision: https://reviews.llvm.org/D134451
2022-09-27 11:18:25 -04:00
Christian Sigg 7876469c77 [Bazel] Remove template_rule and use @bazel_skylib's expand_template instead.
Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D134347
2022-09-26 15:29:59 +02:00
Guillaume Chatelet aec908f9b2 [libc][NFC] Move bzero_inline to separate file
This allows for easier discovery.
2022-09-26 12:57:51 +00:00
Oleg Shyshkov 4f1c124251 [mlir] Add IteratorType enum to StructuredOpsUtils.
Summary:
Use the new enum in TilingIterface and verify that `iterator_type` attribute in
LinalgOp interface is compatible with the enum values. Later IteratorType enum
will be used in LinalgInterface to replace the current `iterator_type` attribute
array of string.

Existing enums in Linalg are moved into a separate td file and tablegen build
target. This is necessary, have one I32EnumAttr in a shared space that generated
enum class definition and EnumAttrs is dialect-specific location. Otherwise
there might be a conflict that I32EnumAttr generates enum definitions in
multiple places.

Differential Revision: https://reviews.llvm.org/D134634
2022-09-26 11:09:46 +00:00
Adrian Kuegel 585010b4b0 Revert "[mlir][Bazel] Port 730ae80d3e1c47f93f725acb2d37f06fcba06953"
This reverts commit ec8f08ce08.

The change that needed this BUILD fix was reverted.
2022-09-26 10:09:02 +02:00