Commit Graph

231 Commits

Author SHA1 Message Date
Ehsan Toosi ce1c8a1ebc [MLIR][LHLO] Replace lhlo-copy-removal pass with mlir-copy-removal pass
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/43137

This PR removes lhlo-copy-removal pass entirely and replace its usages with ```mlir::createCopyRemovalPass()```.

--
7ce1a06f507c8db46c6d7b43c7870cf56002e18e by Ehsan Toosi <ehsan.nadjaran_toosi@dfki.de>:

[mlir][lhlo] Replace lhlo-copy-removal pass with mlir-copy-removal pass

COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/tensorflow/pull/43137 from dfki-ehna:using_mlir_copy_removal 7ce1a06f507c8db46c6d7b43c7870cf56002e18e
PiperOrigin-RevId: 331498501
2020-09-14 01:22:19 -07:00
A. Unique TensorFlower 7cfcc2c79d Integrate LLVM at llvm/llvm-project@cb3e1dd6c3
Updates LLVM usage to match
[cb3e1dd6c31e](https://github.com/llvm/llvm-project/commit/cb3e1dd6c31e)

PiperOrigin-RevId: 331490764
2020-09-14 00:14:33 -07:00
Jacques Pienaar 8cc6cddf9f Use location instead of unknown loc
Follow up on TODO as placeholder has been added to rewriter.

PiperOrigin-RevId: 331488583
2020-09-13 23:52:40 -07:00
A. Unique TensorFlower fb321bee7d Integrate LLVM at llvm/llvm-project@c0bcd11068
Updates LLVM usage to match
[c0bcd11068fc](https://github.com/llvm/llvm-project/commit/c0bcd11068fc)

PiperOrigin-RevId: 331438229
2020-09-13 13:27:19 -07:00
A. Unique TensorFlower c4f3ff50be Integrate LLVM at llvm/llvm-project@f086e85eea
Updates LLVM usage to match
[f086e85eea94](https://github.com/llvm/llvm-project/commit/f086e85eea94)

PiperOrigin-RevId: 331422936
2020-09-13 09:35:39 -07:00
A. Unique TensorFlower bcf995f4ee Integrate LLVM at llvm/llvm-project@70daa353e2
Updates LLVM usage to match
[70daa353e2ae](https://github.com/llvm/llvm-project/commit/70daa353e2ae)

PiperOrigin-RevId: 331366764
2020-09-12 19:13:32 -07:00
A. Unique TensorFlower 2626e33178 Integrate LLVM at llvm/llvm-project@c2f8bc986f
Updates LLVM usage to match
[c2f8bc986fb3](https://github.com/llvm/llvm-project/commit/c2f8bc986fb3)

PiperOrigin-RevId: 331359884
2020-09-12 17:28:13 -07:00
A. Unique TensorFlower fc4a821df1 Integrate LLVM at llvm/llvm-project@0680a3d56d
Updates LLVM usage to match
[0680a3d56d8b](https://github.com/llvm/llvm-project/commit/0680a3d56d8b)

PiperOrigin-RevId: 331340746
2020-09-12 12:49:18 -07:00
A. Unique TensorFlower 0c95d4fc32 Integrate LLVM at llvm/llvm-project@0e0d93e2f0
Updates LLVM usage to match
[0e0d93e2f09a](https://github.com/llvm/llvm-project/commit/0e0d93e2f09a)

PiperOrigin-RevId: 331277620
2020-09-11 21:25:38 -07:00
A. Unique TensorFlower 0a21d66ee0 Integrate LLVM at llvm/llvm-project@f2bb4b8855
Updates LLVM usage to match
[f2bb4b88550a](https://github.com/llvm/llvm-project/commit/f2bb4b88550a)

PiperOrigin-RevId: 331244750
2020-09-11 16:23:37 -07:00
A. Unique TensorFlower 0b430269b8 Integrate LLVM at llvm/llvm-project@009cd4e491
Updates LLVM usage to match
[009cd4e49103](https://github.com/llvm/llvm-project/commit/009cd4e49103)

PiperOrigin-RevId: 331153647
2020-09-11 08:36:26 -07:00
A. Unique TensorFlower a7a7184eb6 [XLA][MLIR] Lower `tf.Tan` and `tf.Sin` to MLHLO
Add `tan` op and lowering to CHLO dialect, move CHLO lowerings to
`chlo_legalize_to_hlo_patterns` and extend missing patterns.

PiperOrigin-RevId: 331128170
2020-09-11 05:05:58 -07:00
A. Unique TensorFlower 90927f6b53 [XLA][MLIR] Lower `tf.Tan` and `tf.Sin` to MLHLO
Add `tan` op and lowering to CHLO dialect, move CHLO lowerings to
`chlo_legalize_to_hlo_patterns` and extend missing patterns.

PiperOrigin-RevId: 331125286
2020-09-11 04:39:28 -07:00
A. Unique TensorFlower 49aaaed762 Integrate LLVM at llvm/llvm-project@be7cef789e
Updates LLVM usage to match
[be7cef789e75](https://github.com/llvm/llvm-project/commit/be7cef789e75)

PiperOrigin-RevId: 331065004
2020-09-10 19:11:17 -07:00
Robert Suderman d0c8d17373 Update mhlo.concatenate inferred return type for dynamics
MHLO concatenate should support dynamic inputs. Its possible that the output
shape can be inferred from a dimension in one input that is not dynamic in
another.

PiperOrigin-RevId: 331054181
2020-09-10 17:46:11 -07:00
Robert Suderman 6eefb07767 Fix zero attr mistake
PiperOrigin-RevId: 331050555
2020-09-10 17:21:39 -07:00
A. Unique TensorFlower b22f2f0eea Integrate LLVM at llvm/llvm-project@52f0837778
Updates LLVM usage to match
[52f0837778b6](https://github.com/llvm/llvm-project/commit/52f0837778b6)

PiperOrigin-RevId: 330939173
2020-09-10 08:14:23 -07:00
Ehsan Toosi d599485e06 PR #43069: [hlo] Unbreak hlo-legalize-to-lhlo test
Imported from GitHub PR https://github.com/tensorflow/tensorflow/pull/43069

The legalization of mlhlo.ReturnOp to lhlo.TerminatorOp by using BufferAssignmentReturnOpConverter fails since the Memref typed results (or the Memref typed operands of Return operation) are set to stay as results after legalization but lhlo.TerminatorOp doesn't accept any operands. Therefore, BufferAssignmentReturnOpConverter must be replaced with a manual conversion that removes all operands of mlhlo.ReturnOp and inserts copy operations in their places.
Copybara import of the project:

--
8be0435b0147263c3872bedec58fd215f784b450 by Ehsan Toosi <ehsan.nadjaran_toosi@dfki.de>:

[hlo] Unbreak hlo-legalize-to-lhlo test

COPYBARA_INTEGRATE_REVIEW=https://github.com/tensorflow/tensorflow/pull/43069 from dfki-ehna:fix_hlo_legalize_to_lhlo_test 8be0435b0147263c3872bedec58fd215f784b450
PiperOrigin-RevId: 330907602
2020-09-10 04:09:03 -07:00
A. Unique TensorFlower f46ba09653 Integrate LLVM at llvm/llvm-project@4964d75d70
Updates LLVM usage to match
[4964d75d7078](https://github.com/llvm/llvm-project/commit/4964d75d7078)

PiperOrigin-RevId: 330713009
2020-09-09 06:50:26 -07:00
Robert Suderman 81d51d810b Bitwise and/or/xor folders
Includes both and/or/xor on same inputs, constant all ones/zeros single arg
folder, and constant input folders.

PiperOrigin-RevId: 330610858
2020-09-08 16:27:13 -07:00
Mehdi Amini 9d4273b5a7 Delete mhlo static dialect registration
This is obsolete now.

PiperOrigin-RevId: 330605210
2020-09-08 15:57:36 -07:00
A. Unique TensorFlower 062a3ac4a0 Integrate LLVM at llvm/llvm-project@8d9c13f37d
Updates LLVM usage to match
[8d9c13f37d20](https://github.com/llvm/llvm-project/commit/8d9c13f37d20)

PiperOrigin-RevId: 330496008
2020-09-08 06:20:11 -07:00
Alexander Belyaev ebc7992d31 [MLIR][KERNEL_GEN] Add a library to lower kernels with the host side.
* Unified TF->Cubin and TF->Kernel_with_host side lowering in `kernel_creator.h|cc`
* Added a pass that attaches GPU binary blob to GPUModuleOp
* Refactored most of the code.
* Added tf_to_kernel binary that emits obj file

PiperOrigin-RevId: 330494488
2020-09-08 06:06:29 -07:00
A. Unique TensorFlower 64d9a465ee Integrate LLVM at llvm/llvm-project@a70f2eb3e3
Updates LLVM usage to match
[a70f2eb3e39a](https://github.com/llvm/llvm-project/commit/a70f2eb3e39a)

PiperOrigin-RevId: 330468316
2020-09-08 02:03:22 -07:00
A. Unique TensorFlower e391762513 Integrate LLVM at llvm/llvm-project@7cfc8f0c7c
Updates LLVM usage to match
[7cfc8f0c7c24](https://github.com/llvm/llvm-project/commit/7cfc8f0c7c24)

PiperOrigin-RevId: 330443088
2020-09-07 21:14:16 -07:00
A. Unique TensorFlower 8e2b874fe8 Integrate LLVM at llvm/llvm-project@7d53fecb67
Updates LLVM usage to match
[7d53fecb6792](https://github.com/llvm/llvm-project/commit/7d53fecb6792)

PiperOrigin-RevId: 330418199
2020-09-07 15:14:42 -07:00
A. Unique TensorFlower 73b4861f2c Canonicalize mhlo.gather to mhlo.slice if it has a single set of constant indices
PiperOrigin-RevId: 330380755
2020-09-07 07:28:46 -07:00
Eugene Burmako dde1ed56cc Add support for legalizing mhlo.slice to lmhlo.slice
PiperOrigin-RevId: 330153599
2020-09-04 21:43:01 -07:00
Eugene Burmako 2a9d7ac084 Add support for legalizing lmhlo.transpose to linalg.generic
PiperOrigin-RevId: 330130704
2020-09-04 15:37:42 -07:00
Eugene Burmako f5d12604ed Add support for legalizing mhlo.transpose to lmhlo.transpose
PiperOrigin-RevId: 330127758
2020-09-04 14:59:08 -07:00
Mehdi Amini b6b30698ad Integrate LLVM at llvm/llvm-project@2dd9a4d855
Updates LLVM usage to match
[2dd9a4d855f6](https://github.com/llvm/llvm-project/commit/2dd9a4d855f6)

PiperOrigin-RevId: 330048272
2020-09-03 21:28:38 -07:00
Prakalp Srivastava b7248424ae Fix return type of replica-id to unsigned int 32 tensor.
PiperOrigin-RevId: 330012181
2020-09-03 16:08:38 -07:00
A. Unique TensorFlower 12b221f459 Integrate LLVM at llvm/llvm-project@dc8d7d23d8
Updates LLVM usage to match
[dc8d7d23d8d2](https://github.com/llvm/llvm-project/commit/dc8d7d23d8d2)

PiperOrigin-RevId: 329992306
2020-09-03 14:21:30 -07:00
Mehdi Amini 56689ce908 Temporarily mark hlo-legalize-to-lhlo.mlir as failing, pending fixes
Upstream changed the buffer assignment API and this needs adjustment on our side.

PiperOrigin-RevId: 329959756
2020-09-03 11:36:20 -07:00
A. Unique TensorFlower 801262688c Integrate LLVM at llvm/llvm-project@1426ac0482
Updates LLVM usage to match
[1426ac048295](https://github.com/llvm/llvm-project/commit/1426ac048295)

PiperOrigin-RevId: 329839640
2020-09-02 20:03:41 -07:00
A. Unique TensorFlower aedcea6acf Integrate LLVM at llvm/llvm-project@3445ec9ba7
Updates LLVM usage to match
[3445ec9ba718](https://github.com/llvm/llvm-project/commit/3445ec9ba718)

PiperOrigin-RevId: 329691486
2020-09-02 05:08:34 -07:00
A. Unique TensorFlower 65b0613491 Integrate LLVM at llvm/llvm-project@202766947e
Updates LLVM usage to match
[202766947edb](https://github.com/llvm/llvm-project/commit/202766947edb)

PiperOrigin-RevId: 329673065
2020-09-02 02:27:52 -07:00
Robert Suderman 7c93352a40 Scalar / Trivial folding for mhlo.select
This covers the case where the predicate is a splat or the on_true/on_false
values are the same.

PiperOrigin-RevId: 329622785
2020-09-01 18:34:12 -07:00
A. Unique TensorFlower 158dbba4e5 Integrate LLVM at llvm/llvm-project@5ffd940ac0
Updates LLVM usage to match
[5ffd940ac02a](https://github.com/llvm/llvm-project/commit/5ffd940ac02a)

PiperOrigin-RevId: 329606435
2020-09-01 16:40:41 -07:00
A. Unique TensorFlower a622bf479b Fix mhlo::SliceOp::fold to not crash on unknown shapes
PiperOrigin-RevId: 329504383
2020-09-01 07:37:36 -07:00
A. Unique TensorFlower dcab119cec Integrate LLVM at llvm/llvm-project@ffd0b31c7c
Updates LLVM usage to match
[ffd0b31c7cba](https://github.com/llvm/llvm-project/commit/ffd0b31c7cba)

PiperOrigin-RevId: 329466048
2020-09-01 02:06:53 -07:00
Mehdi Amini 0e6e2f06e7 Integrate LLVM at llvm/llvm-project@1d3d9b9cd8
Updates LLVM usage to match
[1d3d9b9cd808](https://github.com/llvm/llvm-project/commit/1d3d9b9cd808)

PiperOrigin-RevId: 329432069
2020-08-31 20:34:04 -07:00
A. Unique TensorFlower 3e870929b5 Integrate LLVM at llvm/llvm-project@646f19bb9d
Updates LLVM usage to match
[646f19bb9dc8](https://github.com/llvm/llvm-project/commit/646f19bb9dc8)

PiperOrigin-RevId: 329406157
2020-08-31 16:55:04 -07:00
A. Unique TensorFlower a4857fad84 Integrate LLVM at llvm/llvm-project@bc3d4d9ed7
Updates LLVM usage to match
[bc3d4d9ed783](https://github.com/llvm/llvm-project/commit/bc3d4d9ed783)

PiperOrigin-RevId: 329359501
2020-08-31 12:54:51 -07:00
Benjamin Kramer 049f034116 Lower mhlo.floor to lmhlo to linalg
PiperOrigin-RevId: 329304882
2020-08-31 08:16:36 -07:00
A. Unique TensorFlower acf7413d40 Integrate LLVM at llvm/llvm-project@1d01fc100b
Updates LLVM usage to match
[1d01fc100bb5](https://github.com/llvm/llvm-project/commit/1d01fc100bb5)

PiperOrigin-RevId: 329266181
2020-08-31 02:47:45 -07:00
A. Unique TensorFlower f619da8a5c Integrate LLVM at llvm/llvm-project@11cf6346fd
Updates LLVM usage to match
[11cf6346fd49](https://github.com/llvm/llvm-project/commit/11cf6346fd49)

PiperOrigin-RevId: 329251819
2020-08-31 00:26:30 -07:00
A. Unique TensorFlower 29d7f01fbb Integrate LLVM at llvm/llvm-project@90166c2563
Updates LLVM usage to match
[90166c256310](https://github.com/llvm/llvm-project/commit/90166c256310)

PiperOrigin-RevId: 329065383
2020-08-28 23:07:36 -07:00
Jacques Pienaar 344c500fca [mhlo] Add legalize to SCF pass
Start of pass to legalize MHLO control flow to SCF for further optimization in common form. The current version just matches a very simple instance (which also happens to occur a few times). Exposes some further canonicalization opportunities that aren't yet addressed.

PiperOrigin-RevId: 329017723
2020-08-28 15:11:58 -07:00
Benjamin Kramer 7176fb1839 Integrate LLVM at llvm/llvm-project@85dacca29f
Updates LLVM usage to match
[85dacca29f82](https://github.com/llvm/llvm-project/commit/85dacca29f82)

PiperOrigin-RevId: 328919376
2020-08-28 04:58:12 -07:00