Commit Graph

498 Commits

Author SHA1 Message Date
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
A. Unique TensorFlower 88a3bcbc72 Integrate LLVM at llvm/llvm-project@bb43a0cd4a
Updates LLVM usage to match
[bb43a0cd4adc](https://github.com/llvm/llvm-project/commit/bb43a0cd4adc)

PiperOrigin-RevId: 340963390
2020-11-05 18:04:21 -08:00
A. Unique TensorFlower 2d9022497f Integrate LLVM at llvm/llvm-project@2eadbc8614
Updates LLVM usage to match
[2eadbc86142b](https://github.com/llvm/llvm-project/commit/2eadbc86142b)

PiperOrigin-RevId: 340930608
2020-11-05 14:37:20 -08:00
A. Unique TensorFlower 7858fe51af Integrate LLVM at llvm/llvm-project@2f84b59a4c
Updates LLVM usage to match
[2f84b59a4cf9](https://github.com/llvm/llvm-project/commit/2f84b59a4cf9)

PiperOrigin-RevId: 340842817
2020-11-05 06:53:35 -08:00
A. Unique TensorFlower 4c58c6a7cd Integrate LLVM at llvm/llvm-project@b715fa330d
Updates LLVM usage to match
[b715fa330dfa](https://github.com/llvm/llvm-project/commit/b715fa330dfa)

PiperOrigin-RevId: 340833409
2020-11-05 05:35:30 -08:00
Dmitry Volodin 1821c69910 PR #44405: Fix typos in compiler directory
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/44405

Splitting #43857 by top-level directories.
Copybara import of the project:

--
fa5da7d5478649d11321dcac9f867b0a57e4798a by Dmitry Volodin <mr.molkree@gmail.com>:

fix typos in compiler dir

--
4d3c9f047f7ecb8ab299f1bf28a86fd39096eee7 by Dmitry Volodin <mr.molkree@gmail.com>:

fix one test as "atleast" in it comes from Bazel

--
9440ebaaa9fc4a735f7f72f0c8f0de4ec58afbd6 by Dmitry Volodin <mr.molkree@gmail.com>:

a bit more

PiperOrigin-RevId: 340819994
2020-11-05 03:31:54 -08:00
A. Unique TensorFlower 5f9c75c273 Integrate LLVM at llvm/llvm-project@5b29d26b21
Updates LLVM usage to match
[5b29d26b21bb](https://github.com/llvm/llvm-project/commit/5b29d26b21bb)

PiperOrigin-RevId: 340714785
2020-11-04 13:19:10 -08:00
Alexander Belyaev 3d930d08c2 [HLO] Delete LHLO memref cast ops and migrate to STD ones.
PiperOrigin-RevId: 340663578
2020-11-04 09:26:34 -08:00
Richard Uhler 82031b356c Improve error message for improperly shaped slice indices.
The slice indices must be rank-1 and have the same number of elements of the
rank of the operand. Give reasonable error messages for violations of these
requirements instead of a misleading error message that the types of the
indices don't all match.

PiperOrigin-RevId: 340660822
2020-11-04 09:10:51 -08:00
A. Unique TensorFlower f9c87731d9 Integrate LLVM at llvm/llvm-project@76313288cd
Updates LLVM usage to match
[76313288cd7d](https://github.com/llvm/llvm-project/commit/76313288cd7d)

PiperOrigin-RevId: 340648011
2020-11-04 07:56:48 -08:00
A. Unique TensorFlower 52b8c9e4c4 Integrate LLVM at llvm/llvm-project@8475fa6ed6
Updates LLVM usage to match
[8475fa6ed6bb](https://github.com/llvm/llvm-project/commit/8475fa6ed6bb)

PiperOrigin-RevId: 340635950
2020-11-04 06:22:16 -08:00
A. Unique TensorFlower 2cc16c5f71 Integrate LLVM at llvm/llvm-project@33945cdd62
Updates LLVM usage to match
[33945cdd62c4](https://github.com/llvm/llvm-project/commit/33945cdd62c4)

PiperOrigin-RevId: 340556042
2020-11-03 17:26:06 -08:00
Marius Brehler ff9b8c6f65 PR #44499: Add missing dep on MLIRMhloPassIncGen target
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/44499

The file `sink_constants_to_control_flow.cc` includes the header
`PassDetail.h`, which itself includes `mhlo_passes.h.inc`. The latter is
not guaranteed to be already generated since there was no dependency set
to MLIRMhloPassIncGen.
Copybara import of the project:

--
0ff51ccc88c1ba049eb2e9555afb54079bea39c9 by Marius Brehler <marius.brehler@iml.fraunhofer.de>:

Add missing dep on MLIRMhloPassIncGen target

The file `sink_constants_to_control_flow.cc` includes the header
`PassDetail.h`, which itself includes `mhlo_passes.h.inc`. The latter is
not guaranteed to be already generated since there was no dependency set
to MLIRMhloPassIncGen.

PiperOrigin-RevId: 340485068
2020-11-03 11:18:48 -08:00
A. Unique TensorFlower 880ebcffbb Integrate LLVM at llvm/llvm-project@701456b523
Updates LLVM usage to match
[701456b52355](https://github.com/llvm/llvm-project/commit/701456b52355)

PiperOrigin-RevId: 340477025
2020-11-03 10:43:14 -08:00
Sean Silva d3ea3abdec Remove `results_escape_functions` from HloLegalizeToLhlo
PiperOrigin-RevId: 340464958
2020-11-03 09:49:56 -08:00
A. Unique TensorFlower 46dac6955b Integrate LLVM at llvm/llvm-project@756f597841
Updates LLVM usage to match
[756f59784108](https://github.com/llvm/llvm-project/commit/756f59784108)

PiperOrigin-RevId: 340340747
2020-11-02 16:32:38 -08:00
A. Unique TensorFlower e866aac3ac Integrate LLVM at llvm/llvm-project@72ddd559b8
Updates LLVM usage to match
[72ddd559b8aa](https://github.com/llvm/llvm-project/commit/72ddd559b8aa)

PiperOrigin-RevId: 340292055
2020-11-02 12:29:52 -08:00
Tres Popp 81e8d778c4 Fix bug using std.rank instead of shape.rank
PiperOrigin-RevId: 339890070
2020-10-30 09:59:24 -07:00
Tres Popp 76b30fd426 Move unranked chlo lowering to transform_unranked_hlo.
Additionally:
- Forward listeners through new if/else op builders.
This corrects an error that led to incomplete legalization of broadcasted op
lowering.
- Use OpConversionPattern to ensure up to date operand values are used.
PiperOrigin-RevId: 339838833
2020-10-30 02:56:44 -07:00
A. Unique TensorFlower e188ef10f2 Integrate LLVM at llvm/llvm-project@9bb9b737c5
Updates LLVM usage to match
[9bb9b737c557](https://github.com/llvm/llvm-project/commit/9bb9b737c557)

PiperOrigin-RevId: 339799862
2020-10-29 20:28:56 -07:00
Thomas Joerg e888b04a5c Integrate LLVM at llvm/llvm-project@6648414b2b
Updates LLVM usage to match
[6648414b2b7d](https://github.com/llvm/llvm-project/commit/6648414b2b7d)

PiperOrigin-RevId: 339727680
2020-10-29 12:53:05 -07:00
Nicolas Vasilache 880f603239 Drop OperationFolder usage with Linalg fusion.
PiperOrigin-RevId: 339653466
2020-10-29 06:10:14 -07:00
Thomas Joerg 3a6580bf75 Integrate LLVM at llvm/llvm-project@4d11daa659
Updates LLVM usage to match
[4d11daa659a1](https://github.com/llvm/llvm-project/commit/4d11daa659a1)

PiperOrigin-RevId: 339631220
2020-10-29 03:02:38 -07:00
A. Unique TensorFlower fcb6b5d395 Integrate LLVM at llvm/llvm-project@23ed570af1
Updates LLVM usage to match
[23ed570af1cc](https://github.com/llvm/llvm-project/commit/23ed570af1cc)

PiperOrigin-RevId: 339608894
2020-10-28 23:25:33 -07:00
Benjamin Kramer 3bf4277ea4 [MLIR] Add a lmhlo.reduce -> linalg.generic converter
Doesn't support tensors right now, as it's somewhat hairy to support both at
the same time. Since we use a generic lowering the result is messy
and needs a mem2reg pass to eliminate extra load/store/allocas.

PiperOrigin-RevId: 339562971
2020-10-28 16:38:19 -07:00
A. Unique TensorFlower e58bfd48e6 Integrate LLVM at llvm/llvm-project@87f03e13ce
Updates LLVM usage to match
[87f03e13ce0e](https://github.com/llvm/llvm-project/commit/87f03e13ce0e)

PiperOrigin-RevId: 339528247
2020-10-28 13:38:56 -07:00
Alex Zinenko e77b5ae534 Update MLIR ODS syntax to use OpBuidlerDAG instead of OpBuilder
The latter has been deprecated in favor of the former and will be removed.

PiperOrigin-RevId: 339523966
2020-10-28 13:16:46 -07:00
Adrian Kuegel 0052913775 Integrate LLVM at llvm/llvm-project@c56bbb3961
Updates LLVM usage to match
[c56bbb3961e4](https://github.com/llvm/llvm-project/commit/c56bbb3961e4)

PiperOrigin-RevId: 339442735
2020-10-28 05:47:50 -07:00
A. Unique TensorFlower 91b8e58cc1 Integrate LLVM at llvm/llvm-project@2e1a737f46
Updates LLVM usage to match
[2e1a737f4646](https://github.com/llvm/llvm-project/commit/2e1a737f4646)

PiperOrigin-RevId: 339375372
2020-10-27 18:54:52 -07:00
Kazuaki Ishizaki 5f2b7a74be PR #44277: NFC - minor spelling tweaks of documents under compiler directory
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/44277

This PR addresses minor spelling tweaks of md/td files under compiler directory
Copybara import of the project:

--
4fedebde8f7d48ce2917642ebaab966c9ce49f3e by Kazuaki Ishizaki <ishizaki@jp.ibm.com>:

minor spelling tweaks

PiperOrigin-RevId: 339260830
2020-10-27 09:08:22 -07:00
Thomas Joerg 7363748bae Integrate LLVM at llvm/llvm-project@0fc1aa22ee
Updates LLVM usage to match
[0fc1aa22ee6a](https://github.com/llvm/llvm-project/commit/0fc1aa22ee6a)

PiperOrigin-RevId: 339239851
2020-10-27 06:56:16 -07:00
Benjamin Kramer b7aa01dbe0 Integrate LLVM at llvm/llvm-project@26750a1264
Updates LLVM usage to match
[26750a1264b3](https://github.com/llvm/llvm-project/commit/26750a1264b3)

PiperOrigin-RevId: 339127601
2020-10-26 15:11:52 -07:00
Smit Hinsu 6eda9ed273 Add compare_type optional attribute to CompareOp in HLO dialects
If unspecified, `compare_type` is FLOAT for float element types, SIGNED for signed element types and UNSIGNED for unsigned element types. compare_type can be TOTALORDER for float element types.

- Added import and export support the attribute.
- Restricted legalization from HLO to TF to the default compare types.
- Updated existing usage of the CompareOp

PiperOrigin-RevId: 339099219
2020-10-26 12:58:29 -07:00
Richard Uhler f9843fabe1 Use InferTypeOpInterface for HLO_SliceOp.
Instead of having a custom builder to construct a slice op without an explicit
return type.

PiperOrigin-RevId: 339058864
2020-10-26 09:54:13 -07:00
Hanhan Wang 444fae9bac [NFC] Make naming style consistent.
Use lowercase with underscores between words instead of camelStyle.

PiperOrigin-RevId: 338722328
2020-10-23 12:23:25 -07:00
Benjamin Kramer 31c1c3aa1f Integrate LLVM at llvm/llvm-project@c89447b659
Updates LLVM usage to match
[c89447b65984](https://github.com/llvm/llvm-project/commit/c89447b65984)

PiperOrigin-RevId: 338560059
2020-10-22 15:23:24 -07:00
A. Unique TensorFlower 639324cf99 Internal change
PiperOrigin-RevId: 338486689
2020-10-22 09:22:38 -07:00