Commit Graph

934 Commits

Author SHA1 Message Date
Benjamin Kramer 80d7342ae3 Integrate LLVM at llvm/llvm-project@fd92c5dbee
Updates LLVM usage to match
[fd92c5dbeeeb](https://github.com/llvm/llvm-project/commit/fd92c5dbeeeb)

PiperOrigin-RevId: 344036276
2020-11-24 05:14:33 -08:00
Smit Hinsu b016b5a219 Fix constant folding of mhlo.convert op with i1 element types
Boolean element values should be fetched as an unsigned integer and not signed integer which would return -1 for true.

Added to a TODO to handle unsigned types correctly as well as we don't seem to be using unsigned types.

PiperOrigin-RevId: 343927564
2020-11-23 14:18:28 -08:00
Benjamin Kramer 2ac41d8cd2 Integrate LLVM at llvm/llvm-project@76bd4444e3
Updates LLVM usage to match
[76bd4444e361](https://github.com/llvm/llvm-project/commit/76bd4444e361)

PiperOrigin-RevId: 343875803
2020-11-23 10:18:01 -08:00
Rahul Joshi ac54c5ccfa [XLA:GPU] Convert Cholesky custom call in XLA HLO to LHLO GPU Dialect.
- Restructured LHLO GPU Cholesky to better match XLA HLO by eliminating the
  untyped buffer and changing is_upper attribute to is_lower.
- Change LhloDialectEmitter to emit LHLO GPU Cholesky operation.

PiperOrigin-RevId: 343873516
2020-11-23 10:06:21 -08:00
Benjamin Kramer aa4d33149a Integrate LLVM at llvm/llvm-project@3c696a212b
Updates LLVM usage to match
[3c696a212ba4](https://github.com/llvm/llvm-project/commit/3c696a212ba4)

PiperOrigin-RevId: 343828493
2020-11-23 04:56:02 -08:00
A. Unique TensorFlower e21731d54a Integrate LLVM at llvm/llvm-project@1b749c0cb5
Updates LLVM usage to match
[1b749c0cb5c0](https://github.com/llvm/llvm-project/commit/1b749c0cb5c0)

PiperOrigin-RevId: 343583560
2020-11-20 16:10:59 -08:00
Tim Shen 5a6edaa588 Roll-forward with fix:
[XLA/GPU] Migrate nested reduce emitter to take LMHLO.

PiperOrigin-RevId: 343582798
2020-11-20 16:06:58 -08:00
A. Unique TensorFlower f849c45b74 Integrate LLVM at llvm/llvm-project@95ce9fbc23
Updates LLVM usage to match
[95ce9fbc235a](https://github.com/llvm/llvm-project/commit/95ce9fbc235a)

PiperOrigin-RevId: 343496733
2020-11-20 08:27:13 -08:00
A. Unique TensorFlower fd758e3efb Integrate LLVM at llvm/llvm-project@0caa82e2ac
Updates LLVM usage to match
[0caa82e2ac53](https://github.com/llvm/llvm-project/commit/0caa82e2ac53)

PiperOrigin-RevId: 343483451
2020-11-20 06:46:41 -08:00
A. Unique TensorFlower 1efc5f9675 Integrate LLVM at llvm/llvm-project@1a7d7f423e
Updates LLVM usage to match
[1a7d7f423e75](https://github.com/llvm/llvm-project/commit/1a7d7f423e75)

PiperOrigin-RevId: 343435160
2020-11-19 22:25:55 -08:00
A. Unique TensorFlower bae7c7bd2b [XLA/GPU] Migrate nested reduce emitter to take LMHLO.
PiperOrigin-RevId: 343388053
2020-11-19 16:00:58 -08:00
Tim Shen 303181924c [XLA/GPU] Migrate nested reduce emitter to take LMHLO.
PiperOrigin-RevId: 343373088
2020-11-19 14:41:55 -08:00
A. Unique TensorFlower 88642f58d3 Integrate LLVM at llvm/llvm-project@620adacf87
Updates LLVM usage to match
[620adacf87a3](https://github.com/llvm/llvm-project/commit/620adacf87a3)

PiperOrigin-RevId: 343307878
2020-11-19 09:37:20 -08:00
A. Unique TensorFlower e742da06dc Integrate LLVM at llvm/llvm-project@1983acce7c
Updates LLVM usage to match
[1983acce7c4d](https://github.com/llvm/llvm-project/commit/1983acce7c4d)

PiperOrigin-RevId: 343260267
2020-11-19 03:45:15 -08:00
A. Unique TensorFlower 7f239c7ba2 Add canonicalizer for Reshape(Broadcast(X)) pattern when it is an identity sequence
PiperOrigin-RevId: 343251257
2020-11-19 02:32:45 -08:00
A. Unique TensorFlower 61537008f4 Integrate LLVM at llvm/llvm-project@6b1341eb5b
Updates LLVM usage to match
[6b1341eb5bb7](https://github.com/llvm/llvm-project/commit/6b1341eb5bb7)

PiperOrigin-RevId: 343243049
2020-11-19 01:18:46 -08:00
A. Unique TensorFlower a4ae116b4d Integrate LLVM at llvm/llvm-project@5824a572ad
Updates LLVM usage to match
[5824a572adb5](https://github.com/llvm/llvm-project/commit/5824a572adb5)

PiperOrigin-RevId: 343223895
2020-11-18 22:17:37 -08:00
A. Unique TensorFlower 1a62ea1b95 Integrate LLVM at llvm/llvm-project@8c1e3cbebf
Updates LLVM usage to match
[8c1e3cbebfe9](https://github.com/llvm/llvm-project/commit/8c1e3cbebfe9)

PiperOrigin-RevId: 343125876
2020-11-18 11:57:00 -08:00
A. Unique TensorFlower 000dfa0e59 Integrate LLVM at llvm/llvm-project@2be5698704
Updates LLVM usage to match
[2be569870486](https://github.com/llvm/llvm-project/commit/2be569870486)

PiperOrigin-RevId: 343060898
2020-11-18 05:34:45 -08:00
A. Unique TensorFlower b789b9d76e Integrate LLVM at llvm/llvm-project@b2613fb2f0
Updates LLVM usage to match
[b2613fb2f0f5](https://github.com/llvm/llvm-project/commit/b2613fb2f0f5)

PiperOrigin-RevId: 343012713
2020-11-17 22:06:00 -08:00
A. Unique TensorFlower bba9968ff0 Integrate LLVM at llvm/llvm-project@499bce3aba
Updates LLVM usage to match
[499bce3abab8](https://github.com/llvm/llvm-project/commit/499bce3abab8)

PiperOrigin-RevId: 342921326
2020-11-17 12:30:18 -08:00
A. Unique TensorFlower 7a6a6ffa40 Integrate LLVM at llvm/llvm-project@65f3e121fe
Updates LLVM usage to match
[65f3e121fe4f](https://github.com/llvm/llvm-project/commit/65f3e121fe4f)

PiperOrigin-RevId: 342859791
2020-11-17 07:38:03 -08:00
Stephan Herhut 0c7152e65c Extend fusion root heuristic to also work in partially bufferized programs.
We now follow data flow though tensor_cast, tensor_load and tensor_to_memref
operations.

PiperOrigin-RevId: 342851104
2020-11-17 06:34:48 -08:00
A. Unique TensorFlower d9113e0b4d Integrate LLVM at llvm/llvm-project@a8db144169
Updates LLVM usage to match
[a8db14416927](https://github.com/llvm/llvm-project/commit/a8db14416927)

PiperOrigin-RevId: 342613747
2020-11-16 05:13:36 -08:00
Tres Popp be9ae88eaa Consider aliases through control flow for lhlo-fuse-linalg.
This should handle scf.if and shape.assuming regions,
which we care about in kernel_gen.

PiperOrigin-RevId: 342584762
2020-11-16 01:12:45 -08:00
Ben Vanik 1afada97ed Don't override MSVC CRT defaults.
You can't mix CRT modes in binaries, so overriding these here breaks any build that links these files in that isn't also doing these same non-default overrides.

PiperOrigin-RevId: 342447232
2020-11-14 13:51:28 -08:00
Ben Vanik 88a5bde51f Fixing M_PI compile error on MSVC.
M_PI and other math constants (used in chlo_legalize_hlo_patterns.td)
are not part of the C++ standard and must be enabled on MSVC
(similar to _GNU_SOURCE adding glibc symbols to posix headers).

PiperOrigin-RevId: 342432987
2020-11-14 10:02:04 -08:00
Smit Hinsu d0901a83e5 Enable fallback legalization for MaxPoolGradGrad and MaxPool3DGradGrad ops
Requires,
* Override for ReducePrecision in HloMlirBuilder
* Sinking of constants for ReduceWindow op

PiperOrigin-RevId: 342330848
2020-11-13 13:49:05 -08:00
Tres Popp 8c32f52323 Integrate LLVM at llvm/llvm-project@c30ab6c2a3
Updates LLVM usage to match
[c30ab6c2a307](https://github.com/llvm/llvm-project/commit/c30ab6c2a307)

PiperOrigin-RevId: 342309362
2020-11-13 11:59:03 -08:00
A. Unique TensorFlower 582a6fa7cc Integrate LLVM at llvm/llvm-project@76b6cb515b
Updates LLVM usage to match
[76b6cb515b2f](https://github.com/llvm/llvm-project/commit/76b6cb515b2f)

PiperOrigin-RevId: 342266979
2020-11-13 08:26:36 -08:00
Benjamin Kramer c340d561b7 Integrate LLVM at llvm/llvm-project@a7b6574144
Updates LLVM usage to match
[a7b657414415](https://github.com/llvm/llvm-project/commit/a7b657414415)

PiperOrigin-RevId: 342233973
2020-11-13 03:49:45 -08:00
Stephan Herhut c344695bca Properly configure patterns in hlo to lhlo conversion with typeconverter.
Otherwise, materializations for partial conversions do not work.

PiperOrigin-RevId: 342215962
2020-11-13 00:58:51 -08:00
Rahul Joshi bbaad416a1 [MLIR] Update tests to eliminate public function declarations.
- Also fixed kernel_gen embed_memref_prints to mark the declarations inserted private.
- This is in prep for proposed MLIR change to disallow public declarations.

PiperOrigin-RevId: 342081252
2020-11-12 10:42:59 -08:00
Benjamin Kramer c10be5282b Integrate LLVM at llvm/llvm-project@c8d73d939f
Updates LLVM usage to match
[c8d73d939fa4](https://github.com/llvm/llvm-project/commit/c8d73d939fa4)

PiperOrigin-RevId: 342068766
2020-11-12 09:51:12 -08:00
Rahul Joshi 1958f228ec [MLIR:HLO] Extend CustomCall to support multiple outputs.
- Extend MHLO CustomCall to have multiple tensors as results.
- Extend LHLO CustomCall to have multiple memrefs for output operands.
- Fix HLO->LHLO and XLA HLO->LHLO mapping for CustomCall to setup the
  operand_segment_sizes attribute correctly.

PiperOrigin-RevId: 342067762
2020-11-12 09:46:25 -08:00
A. Unique TensorFlower af1914a174 Integrate LLVM at llvm/llvm-project@02af11094f
Updates LLVM usage to match
[02af11094fe4](https://github.com/llvm/llvm-project/commit/02af11094fe4)

PiperOrigin-RevId: 342035247
2020-11-12 06:27:59 -08:00
Tres Popp 1dffa62fe9 Fold away shape.shape_of(mhlo.dynamic_reshape(inp, shape))
This specific pattern can be replaced with the shape
passed to dynamic_reshape. This is implemented as a
canonicalization on mhlo.dynamic_reshape to fit in
the infrastructure of canonicalization.

PiperOrigin-RevId: 342009365
2020-11-12 02:48:26 -08:00
A. Unique TensorFlower 7fc4985eae Integrate LLVM at llvm/llvm-project@1cbf8e89b5
Updates LLVM usage to match
[1cbf8e89b54d](https://github.com/llvm/llvm-project/commit/1cbf8e89b54d)

PiperOrigin-RevId: 341867974
2020-11-11 11:10:12 -08:00
Rahul Joshi 745c8aa0b1 Extract some duplicated code into a helper function.
- Extract code to create result memref's into a ConvertResults function.
- Also fix a bug when using reifyReturnTypes: use correct index for result_shape instead
  of always using the first element.

PiperOrigin-RevId: 341852227
2020-11-11 10:01:00 -08:00
Alexander Belyaev d4f2c767d3 [HLO] Fix HLO DynamicBroadcastInDimOp -> LHLO lowering.
The conversion had a bug in computation of strides and sizes args for std.memref_reinterpret_cast. The previous version also relied on linalg::ReshapeOp to do broadcasting when the rank of the output was higher than the rank of the input. Now the broadcasting is entirely done via descriptor modification and linalg::ReshapeOp was replaced with CopyOp.

PiperOrigin-RevId: 341379871
2020-11-09 04:24:40 -08:00
Smit Hinsu 4ef12aa000 Update GetDimensionSize and SetDimensionSize ops to use I64 attribute for dimension
This is to match with HLO semantics and general dimension semantics in MLIR.

Also,

* Define minimal verifier for these ops.
* Add folder for SetDimensionSize op on static shaped dimension.
* Fix assumption of ranked shape in GetDimensionSize op.

PiperOrigin-RevId: 341150923
2020-11-06 18:03:04 -08:00
A. Unique TensorFlower 3238f8226f Integrate LLVM at llvm/llvm-project@f147f59cd3
Updates LLVM usage to match
[f147f59cd377](https://github.com/llvm/llvm-project/commit/f147f59cd377)

PiperOrigin-RevId: 341140324
2020-11-06 16:33:56 -08:00
Robert Suderman a926e0f040 Removed Op(Complex, Real) lowering to address complex type inference issue
Lowerings that depended on operations between real and complex types may
not infer the correct intermediate type. Removing these operations as
they are not technically legally generated operations. Updated tests
to validate this.

PiperOrigin-RevId: 341128903
2020-11-06 15:24:23 -08:00
A. Unique TensorFlower 3dcd8b4ba2 Integrate LLVM at llvm/llvm-project@d0b8810fe4
Updates LLVM usage to match
[d0b8810fe4ec](https://github.com/llvm/llvm-project/commit/d0b8810fe4ec)

PiperOrigin-RevId: 341081862
2020-11-06 11:09:07 -08:00
A. Unique TensorFlower d72a022063 Integrate LLVM at llvm/llvm-project@0e76a9bc58
Updates LLVM usage to match
[0e76a9bc5834](https://github.com/llvm/llvm-project/commit/0e76a9bc5834)

PiperOrigin-RevId: 341056157
2020-11-06 08:49:12 -08:00
Marius Brehler f09db1fea0 PR #44589: Introduce MHLO_BUILD_EMBEDDED build option
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/44589

This option allows to skip calling `find_package(MLIR)`, enabling to
embed MHLO into other project, e.g. IREE.
Copybara import of the project:

--
715299e594c95ce9d4f45dc154ba8a4acb196289 by Marius Brehler <marius.brehler@iml.fraunhofer.de>:

Introduce MHLO_BUILD_EMBEDDED build option

This option allows to skip calling `find_package(MLIR)`, enabling to
embed MHLO into other project, e.g. IREE.

--
6a9cd1adb69dfd27e4306566085c2edcb9e266bf by Marius Brehler <marius.brehler@iml.fraunhofer.de>:

Update tensorflow/compiler/mlir/hlo/CMakeLists.txt

Co-authored-by: Geoffrey Martin-Noble <gcmn@google.com>
PiperOrigin-RevId: 341046504
2020-11-06 07:40:28 -08:00
Tres Popp af4c9774dc Handle rank 1 broadcasts in unranked kernel lowering.
Previously this started at rank 2 after checking for scalars and equal shapes. This resulted in cases such as <1xf32> + <2xf32> being treated as impossible.

PiperOrigin-RevId: 341043965
2020-11-06 07:22:43 -08:00
A. Unique TensorFlower c30ea47682 Integrate LLVM at llvm/llvm-project@4d79ef814a
Updates LLVM usage to match
[4d79ef814aed](https://github.com/llvm/llvm-project/commit/4d79ef814aed)

PiperOrigin-RevId: 341037948
2020-11-06 06:26:56 -08:00
A. Unique TensorFlower 209dc24a44 Integrate LLVM at llvm/llvm-project@624d3fe0e4
Updates LLVM usage to match
[624d3fe0e41e](https://github.com/llvm/llvm-project/commit/624d3fe0e41e)

PiperOrigin-RevId: 341030651
2020-11-06 05:18:35 -08:00
A. Unique TensorFlower d134a92e2d Integrate LLVM at llvm/llvm-project@930cf1cb9f
Updates LLVM usage to match
[930cf1cb9fdb](https://github.com/llvm/llvm-project/commit/930cf1cb9fdb)

PiperOrigin-RevId: 340985671
2020-11-05 21:45:35 -08:00