Commit Graph

750 Commits

Author SHA1 Message Date
Adrian Kuegel a34aa699f8 Fix tanh lowering for NaN input.
If the input is NaN, the result should be NaN, too.

PiperOrigin-RevId: 364788902
2021-03-24 06:34:36 -07:00
A. Unique TensorFlower 7dd0fe4592 Integrate LLVM at llvm/llvm-project@d709dcc090
Updates LLVM usage to match
[d709dcc09097](https://github.com/llvm/llvm-project/commit/d709dcc09097)

PiperOrigin-RevId: 364688656
2021-03-23 17:58:45 -07:00
Stella Laurenzo 7f2bf48b8b Integrate LLVM at llvm/llvm-project@b24436ac96
Updates LLVM usage to match
[b24436ac96bd](https://github.com/llvm/llvm-project/commit/b24436ac96bd)

PiperOrigin-RevId: 364615807
2021-03-23 12:20:17 -07:00
A. Unique TensorFlower 8987dfd1d6 [MLIR][HLO] Move broadcasts over n-ary shape-preserving ops
This will open up more fusion opportunities.

PiperOrigin-RevId: 364577231
2021-03-23 09:38:39 -07:00
A. Unique TensorFlower 5bc4bf0834 Integrate LLVM at llvm/llvm-project@0776eca7a4
Updates LLVM usage to match
[0776eca7a4e7](https://github.com/llvm/llvm-project/commit/0776eca7a4e7)

PiperOrigin-RevId: 364552759
2021-03-23 07:26:28 -07:00
A. Unique TensorFlower 618223778d Integrate LLVM at llvm/llvm-project@5657f93e78
Updates LLVM usage to match
[5657f93e788f](https://github.com/llvm/llvm-project/commit/5657f93e788f)

PiperOrigin-RevId: 364541987
2021-03-23 06:15:46 -07:00
A. Unique TensorFlower 1a6483e229 Integrate LLVM at llvm/llvm-project@e990fa2170
Updates LLVM usage to match
[e990fa217031](https://github.com/llvm/llvm-project/commit/e990fa217031)

PiperOrigin-RevId: 364529739
2021-03-23 04:39:42 -07:00
A. Unique TensorFlower 54f37abc28 [MHLO] Move broadcasts over elementwise ops
Move up dynamic broadcasts and shape computations to allow for more fusion
opportunities.

PiperOrigin-RevId: 364514158
2021-03-23 02:34:41 -07:00
Mehdi Amini 98debb127d Update Tensorflow to prepare for changing the default value of `preloadDialectsInContext`
This makes tf-opt more strict on the dialect dependencies, and immediately reduces
the number of dialects loaded.
The canonicalization of TensorFlow graphs showed on the profile that Linalg pattern
were dominated the time, which is unexpected since Linalg is not even intended to be
used there.

PiperOrigin-RevId: 364087027
2021-03-20 11:01:55 -07:00
A. Unique TensorFlower 431be0e9b2 Integrate LLVM at llvm/llvm-project@cd442157cf
Updates LLVM usage to match
[cd442157cff4](https://github.com/llvm/llvm-project/commit/cd442157cff4)

PiperOrigin-RevId: 363873565
2021-03-19 05:55:54 -07:00
Benjamin Kramer 59fa7c0ef7 [MHLO:linalg] Lower all dynamic broadcasts of static shapes to linalg.generic
We only need the memref_reinterpret_cast if we don't know whether a dimension
gets expanded or not. With static shapes we know that a dimension can only be
expanded if it's a static 1, so lower it in the same way we lower fully
static broadcasts.

PiperOrigin-RevId: 363859181
2021-03-19 03:52:02 -07:00
A. Unique TensorFlower 22b27dbaa2 Integrate LLVM at llvm/llvm-project@628f5c9da2
Updates LLVM usage to match
[628f5c9da29b](https://github.com/llvm/llvm-project/commit/628f5c9da29b)

PiperOrigin-RevId: 363858631
2021-03-19 03:46:45 -07:00
A. Unique TensorFlower dc3dbb9d17 Integrate LLVM at llvm/llvm-project@80df56f7f9
Updates LLVM usage to match
[80df56f7f9ef](https://github.com/llvm/llvm-project/commit/80df56f7f9ef)

PiperOrigin-RevId: 363843825
2021-03-19 01:35:15 -07:00
A. Unique TensorFlower a26e227b46 Integrate LLVM at llvm/llvm-project@16c30c3c23
Updates LLVM usage to match
[16c30c3c23ef](https://github.com/llvm/llvm-project/commit/16c30c3c23ef)

PiperOrigin-RevId: 363806028
2021-03-18 20:16:47 -07:00
A. Unique TensorFlower 76d61d4d51 Integrate LLVM at llvm/llvm-project@078b338ba6
Updates LLVM usage to match
[078b338ba67a](https://github.com/llvm/llvm-project/commit/078b338ba67a)

PiperOrigin-RevId: 363661770
2021-03-18 08:26:26 -07:00
A. Unique TensorFlower 8ac890d531 Integrate LLVM at llvm/llvm-project@388fbefb4f
Updates LLVM usage to match
[388fbefb4f2a](https://github.com/llvm/llvm-project/commit/388fbefb4f2a)

PiperOrigin-RevId: 363641472
2021-03-18 06:11:13 -07:00
A. Unique TensorFlower 0c4a89e52c [MLIR][MHLO] Implement shape reification for `dynamic_broadcast_in_dim`
PiperOrigin-RevId: 363622714
2021-03-18 03:39:15 -07:00
A. Unique TensorFlower aad6d39952 Integrate LLVM at llvm/llvm-project@0604e0bc68
Updates LLVM usage to match
[0604e0bc683e](https://github.com/llvm/llvm-project/commit/0604e0bc683e)

PiperOrigin-RevId: 363601445
2021-03-18 00:52:33 -07:00
A. Unique TensorFlower f7464dfa62 Integrate LLVM at llvm/llvm-project@2416f24363
Updates LLVM usage to match
[2416f2436334](https://github.com/llvm/llvm-project/commit/2416f2436334)

PiperOrigin-RevId: 363568447
2021-03-17 20:22:14 -07:00
A. Unique TensorFlower f5c9955056 Integrate LLVM at llvm/llvm-project@ecfa874531
Updates LLVM usage to match
[ecfa87453113](https://github.com/llvm/llvm-project/commit/ecfa87453113)

PiperOrigin-RevId: 363495160
2021-03-17 13:33:18 -07:00
A. Unique TensorFlower f1408e791e [MLIR][HLO] Add `Elementwise` trait to unary element-wise ops
PiperOrigin-RevId: 363428909
2021-03-17 08:51:17 -07:00
A. Unique TensorFlower cd52adb20e Integrate LLVM at llvm/llvm-project@967b64beb4
Updates LLVM usage to match
[967b64beb4bf](https://github.com/llvm/llvm-project/commit/967b64beb4bf)

PiperOrigin-RevId: 363410962
2021-03-17 07:05:09 -07:00
Hanhan Wang 2e0ee7759b Add support for lowering mhlo.torch_index_select to Linalg on tensors.
The change upstreams the pattern from IREE repo to MHLO repo.

PiperOrigin-RevId: 363406294
2021-03-17 06:33:41 -07:00
A. Unique TensorFlower 1336c95920 Integrate LLVM at llvm/llvm-project@506df1bbfd
Updates LLVM usage to match
[506df1bbfd16](https://github.com/llvm/llvm-project/commit/506df1bbfd16)

PiperOrigin-RevId: 363377317
2021-03-17 02:51:58 -07:00
Jacques Pienaar a58e62590e Restrict canonicalization to avoid changing type
Issue #47516

PiperOrigin-RevId: 363300979
2021-03-16 16:54:05 -07:00
A. Unique TensorFlower caae2525ef Integrate LLVM at llvm/llvm-project@85ab413b53
Updates LLVM usage to match
[85ab413b53ae](https://github.com/llvm/llvm-project/commit/85ab413b53ae)

PiperOrigin-RevId: 363298500
2021-03-16 16:42:27 -07:00
A. Unique TensorFlower c54527fe88 Integrate LLVM at llvm/llvm-project@678241795c
Updates LLVM usage to match
[678241795c95](https://github.com/llvm/llvm-project/commit/678241795c95)

PiperOrigin-RevId: 363257913
2021-03-16 13:33:00 -07:00
A. Unique TensorFlower 2be112a603 [MLIR][MHLO] Approximate `tf.Tanh` as constant +/-1 for small/large values
Fix issue raised in https://github.com/tensorflow/tensorflow/issues/47724

PiperOrigin-RevId: 363210296
2021-03-16 10:14:30 -07:00
Jacques Pienaar 3de2024a9b Avoid creating tuple type only for verification
Make the error message a bit more verbose & it is cheaper to verify the elements rather than creating a (potentially) new type.

PiperOrigin-RevId: 363073909
2021-03-15 17:58:19 -07:00
A. Unique TensorFlower 01d729d35d Integrate LLVM at llvm/llvm-project@6878be5dc3
Updates LLVM usage to match
[6878be5dc3ec](https://github.com/llvm/llvm-project/commit/6878be5dc3ec)

PiperOrigin-RevId: 362984365
2021-03-15 11:14:24 -07:00
A. Unique TensorFlower 570d29d643 Integrate LLVM at llvm/llvm-project@e9e788d145
Updates LLVM usage to match
[e9e788d145f5](https://github.com/llvm/llvm-project/commit/e9e788d145f5)

PiperOrigin-RevId: 362834717
2021-03-14 16:16:45 -07:00
Tim Shen d16860d26d [MLIR] Change LMHLO Conditional and While to capture needed buffers, instead of passing them by operands.
This is consistent with the design of LMHLO FusionOp, and it simplifies the
usage. Before the change, those redundant operands ended up unused as all sub-regions can already capture needed buffers.

PiperOrigin-RevId: 362381155
2021-03-11 14:42:41 -08:00
A. Unique TensorFlower 8066794eea Integrate LLVM at llvm/llvm-project@720a828045
Updates LLVM usage to match
[720a828045e1](https://github.com/llvm/llvm-project/commit/720a828045e1)

PiperOrigin-RevId: 362375825
2021-03-11 14:18:36 -08:00
Hanhan Wang 4f5e1c51dd Add support for lowering NHWC pooling mhlo.reduce_window to Linalg on tensors.
The change upstreams the pattern from IREE repo to MHLO repo.

PiperOrigin-RevId: 362312573
2021-03-11 09:41:34 -08:00
Hanhan Wang 630cabefb0 Add support for lowering 2D depthwise mhlo.conv to Linalg on tensors.
The change upstreams the pattern from IREE repo to MHLO repo.

PiperOrigin-RevId: 362300550
2021-03-11 08:41:38 -08:00
Benjamin Kramer 94f9740c67 [MLIR][HLO:Linalg] Lower mhlo.dynamic_iota to indexed_generic
This is the same as iota, but instead of taking the dimensions from the result
tensor we use the supplied shape extents tensor.

PiperOrigin-RevId: 362298548
2021-03-11 08:31:29 -08:00
Benjamin Kramer 09f8046816 [MLIR:HLO:LINALG] Fix codegen for mhlo.reshape when one side is rank 0
This is an annoying edge case because the collapse->expand lowering expects at
least R1 or it will produce invalid linalg reshapes. Using the direct lowering
works fine.

PiperOrigin-RevId: 362269199
2021-03-11 05:29:56 -08:00
Benjamin Kramer d77b556822 [MLIR][MHLO] Allow recursion in the shape_of mover
This allows it to push shape_of over a chain of ops all the way to the top.

PiperOrigin-RevId: 362249009
2021-03-11 02:52:21 -08:00
Benjamin Kramer 67a770e4e0 [HLO:MLIR] Make binary op type reification emit shape_of instead of tensor ops
This gives cleaner code and allows shape optimizations to happen on the result.

PiperOrigin-RevId: 362242975
2021-03-11 02:01:35 -08:00
Rahul Joshi 9902e6ee32 [HLO] Add LMHLO CollectivePermute verification.
- Extract verification of source target pairs attached to collective permute into a common
  helper function and use that to verify both MHLO and LMHLO variants.
- Change MlirGpuTestBase::ParseMlirModule to allow returning back a failure, and use
  that to update the mlir_gpu_compile_test to check the new behavior.

PiperOrigin-RevId: 362156962
2021-03-10 15:37:12 -08:00
A. Unique TensorFlower 4f16b10ce2 Integrate LLVM at llvm/llvm-project@4c973ae51b
Updates LLVM usage to match
[4c973ae51b85](https://github.com/llvm/llvm-project/commit/4c973ae51b85)

PiperOrigin-RevId: 362116801
2021-03-10 12:36:24 -08:00
Mahesh Ravishankar b212bd66ae Build fix for missing precision_config.
THe conversion from dot_general to dot fails when trying to retrieve
and use the precision config, since precision_config is optional.

PiperOrigin-RevId: 362095296
2021-03-10 11:10:51 -08:00
A. Unique TensorFlower e199df1dbf [MLIR][MHLO] Declare `shape_of` dynamically legal in move-up-dynamic-broadcasts
This allows shape reification to produce `shape_of` ops while they can still be
moved up.

PiperOrigin-RevId: 362075609
2021-03-10 09:59:17 -08:00
A. Unique TensorFlower c217a6ef61 [MHLO] Add pass to move up dynamic broadcasts for fusion
For now, the pass only reifies the required shape computations. Moving
broadcasts will follow to allow for fusion across them.

PiperOrigin-RevId: 362033715
2021-03-10 06:21:57 -08:00
Stephan Herhut cabd4d9a06 Canonicalize dynamic_broadcast_in_dim to own shape with rank narrowing on the shape to a corresponding tensor.cast.
PiperOrigin-RevId: 362028291
2021-03-10 05:43:54 -08:00
A. Unique TensorFlower 507d9fb61d [MLIR][KernelGen] Add `tf.Polygamma` kernel
PiperOrigin-RevId: 362002943
2021-03-10 02:22:01 -08:00
A. Unique TensorFlower 218476128e [MLIR][KernelGen] Fix zeta lowering at poles
Return nan at zeta poles or inf where the limit is defined. Also test the kernel
based on the series representation of zeta.

PiperOrigin-RevId: 361993482
2021-03-10 01:09:10 -08:00
A. Unique TensorFlower 7629dfdd81 Integrate LLVM at llvm/llvm-project@df6d0579e1
Updates LLVM usage to match
[df6d0579e18e](https://github.com/llvm/llvm-project/commit/df6d0579e18e)

PiperOrigin-RevId: 361855926
2021-03-09 11:27:27 -08:00
Benjamin Kramer 5be8be31b5 Integrate LLVM at llvm/llvm-project@3f3f88fb95
Updates LLVM usage to match
[3f3f88fb9503](https://github.com/llvm/llvm-project/commit/3f3f88fb9503)

PiperOrigin-RevId: 361762801
2021-03-09 02:19:24 -08:00
A. Unique TensorFlower daf6bde6f5 Integrate LLVM at llvm/llvm-project@c9ff39a3f9
Updates LLVM usage to match
[c9ff39a3f984](https://github.com/llvm/llvm-project/commit/c9ff39a3f984)

PiperOrigin-RevId: 361655071
2021-03-08 14:18:24 -08:00