Commit Graph

292 Commits

Author SHA1 Message Date
Stephan Herhut 2aa07b0091 Insert explicit casts to model extra shape knowledge for unranked chlo transform
When transforming unranked binary operations from CHLO to HLO, we insert `shape.broadcast` operations. Due to context, we know that the result of the `shape.broadcast` operation has a static shape. Instead of modelling this in the type of the broadcast operation itself, which is illegal,  we now use an explicit cast.

PiperOrigin-RevId: 331989879
2020-09-16 06:14:49 -07:00
A. Unique TensorFlower 1880f87737 Integrate LLVM at llvm/llvm-project@e1669843f2
Updates LLVM usage to match
[e1669843f2aa](https://github.com/llvm/llvm-project/commit/e1669843f2aa)

PiperOrigin-RevId: 331987679
2020-09-16 05:58:08 -07:00
Hanhan Wang 1800f44a29 Add sqrt folder.
PiperOrigin-RevId: 331974344
2020-09-16 04:04:09 -07:00
A. Unique TensorFlower a6fdebdc6c [MLIR] Lower `chlo.constant_like` to MHLO
Lower `chlo.constant_like` to a constant and, if needed, a broadcast.

PiperOrigin-RevId: 331964137
2020-09-16 02:41:44 -07:00
A. Unique TensorFlower da43c8596b [MLIR] Simplify and generalize `transform-unranked-hlo`
This refactoring allows to support a wider range of n-ary operations in future
changes.

PiperOrigin-RevId: 331953362
2020-09-16 01:13:23 -07:00
A. Unique TensorFlower d1f85f32b1 Integrate LLVM at llvm/llvm-project@7841e21c98
Updates LLVM usage to match
[7841e21c9849](https://github.com/llvm/llvm-project/commit/7841e21c9849)

PiperOrigin-RevId: 331647935
2020-09-14 16:09:08 -07:00
Robert Suderman dff98f8cd5 Folder for mhlo.negate
PiperOrigin-RevId: 331592342
2020-09-14 11:38:44 -07:00
A. Unique TensorFlower 8bcca69845 Integrate LLVM at llvm/llvm-project@c799f873cb
Updates LLVM usage to match
[c799f873cb9f](https://github.com/llvm/llvm-project/commit/c799f873cb9f)

PiperOrigin-RevId: 331546187
2020-09-14 07:56:16 -07:00
A. Unique TensorFlower 5ab993c01d Integrate LLVM at llvm/llvm-project@0008fb3437
Updates LLVM usage to match
[0008fb343704](https://github.com/llvm/llvm-project/commit/0008fb343704)

PiperOrigin-RevId: 331528548
2020-09-14 05:39:19 -07:00
Hanhan Wang cf1b2b2d84 Add a test for lowering mhlo.floor to Linalg on tensors.
PiperOrigin-RevId: 331514657
2020-09-14 03:30:43 -07:00
A. Unique TensorFlower 48022987ce [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: 331506094
2020-09-14 02:34:52 -07:00
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