Commit Graph

969 Commits

Author SHA1 Message Date
Rahul Joshi c5f5d13930 [MLIR] Add dependency from "lhlo_ops_structs_inc_gen" to "lhlo" target.
PiperOrigin-RevId: 359488020
2021-02-25 03:51:36 -08:00
Hanhan Wang 45a1249fe2 Add support for lowering mhlo.pad to linalg.pad_tensor
The change upstreams the pattern from IREE repo to MHLO repo.

PiperOrigin-RevId: 359481543
2021-02-25 03:00:39 -08:00
A. Unique TensorFlower 459362b206 Integrate LLVM at llvm/llvm-project@d8a8e5d624
Updates LLVM usage to match
[d8a8e5d6240a](https://github.com/llvm/llvm-project/commit/d8a8e5d6240a)

PiperOrigin-RevId: 359475769
2021-02-25 02:20:12 -08:00
A. Unique TensorFlower 7dc1543bb2 Integrate LLVM at llvm/llvm-project@96a3dfeb93
Updates LLVM usage to match
[96a3dfeb9303](https://github.com/llvm/llvm-project/commit/96a3dfeb9303)

PiperOrigin-RevId: 359394503
2021-02-24 16:17:23 -08:00
A. Unique TensorFlower d9d6ab105e Integrate LLVM at llvm/llvm-project@5c74c6be3c
Updates LLVM usage to match
[5c74c6be3c29](https://github.com/llvm/llvm-project/commit/5c74c6be3c29)

PiperOrigin-RevId: 359354498
2021-02-24 13:19:53 -08:00
Geoffrey Martin-Noble 89f7f2bd65 Lower integer matmuls to linalg
PiperOrigin-RevId: 359306495
2021-02-24 09:45:07 -08:00
Hanhan Wang 475b4a06a5 Add support for lowering mhlo.slice to subtensor.
PiperOrigin-RevId: 359297978
2021-02-24 09:06:09 -08:00
A. Unique TensorFlower b478bdf00e Integrate LLVM at llvm/llvm-project@de40423c85
Updates LLVM usage to match
[de40423c8512](https://github.com/llvm/llvm-project/commit/de40423c8512)

PiperOrigin-RevId: 359280337
2021-02-24 07:32:25 -08:00
A. Unique TensorFlower 3e2ff6e253 Integrate LLVM at llvm/llvm-project@861dbe1a02
Updates LLVM usage to match
[861dbe1a021e](https://github.com/llvm/llvm-project/commit/861dbe1a021e)

PiperOrigin-RevId: 359091800
2021-02-23 11:28:36 -08:00
A. Unique TensorFlower ac0552f127 [MLIR][HLO] Remove duplicate `PopulateTransformUnrankedHloPatterns`
PiperOrigin-RevId: 359046173
2021-02-23 07:50:47 -08:00
A. Unique TensorFlower 2df1bb3d6b Integrate LLVM at llvm/llvm-project@6c9541d4dd
Updates LLVM usage to match
[6c9541d4ddfd](https://github.com/llvm/llvm-project/commit/6c9541d4ddfd)

PiperOrigin-RevId: 359020255
2021-02-23 04:38:26 -08:00
A. Unique TensorFlower 855cd484fc Integrate LLVM at llvm/llvm-project@557d2ade01
Updates LLVM usage to match
[557d2ade016f](https://github.com/llvm/llvm-project/commit/557d2ade016f)

PiperOrigin-RevId: 358925409
2021-02-22 16:05:25 -08:00
A. Unique TensorFlower b45eaf8d33 Integrate LLVM at llvm/llvm-project@12edddafac
Updates LLVM usage to match
[12edddafac45](https://github.com/llvm/llvm-project/commit/12edddafac45)

PiperOrigin-RevId: 358889182
2021-02-22 13:21:11 -08:00
Rahul Joshi 0da7ea2545 [MLIR][HLO] Cleanup CMakeLists and comments.
- Cleanup CMakeLists file to remove unused argument and use a new function for
  setting up lmhlo and lmhlo_gpu dialect targets.
- Fix inconsistently formatted copyright comment and fix header include guards.

PiperOrigin-RevId: 358865838
2021-02-22 11:36:29 -08:00
Rahul Joshi 5adb7c6e12 [MLIR:LHLO] Add optional call target arg mapping to LMHLO CustomCall operations.
- XLA:HLO -> LMHLO conversion drops all token arguments and return values, however
  custom calls that users write still expect to get buffer pointers for these token types.
- To be able to support this, add an optional call target argument mapping attribute to
  LMHLO custom calls. When this attribute is present, it indicates the number of
  arguments and returns that the custom call expects and also indicates which LMHLO
  arg() or output() maps to which arg or result number of the custom call.

PiperOrigin-RevId: 358826664
2021-02-22 08:43:00 -08:00
Benjamin Kramer a9cc1dcfa0 [mlir][hlo] Add basic rank-specialization for select
This just blows up everything to ranked (up to 6) and is probably quite slow.
This is sufficient to make kernelgen compile SelectV2.

PiperOrigin-RevId: 358777728
2021-02-22 02:41:12 -08:00
Prakalp Srivastava 909574e393 Pass result element type to XlaBuilder for `mhlo.dot_general` and `mhlo.convolution` ops.
`mhlo.dot_general` and `mhlo.convolution` result element type might be different from operand element type. See `preferred_element_type` attribute that allows i8xi8 to i32 dot computation. `mhlo` to HLO exporter should pass the result element type to Xla builder to override the shape inference of XLA.

PiperOrigin-RevId: 358580718
2021-02-20 07:07:17 -08:00
A. Unique TensorFlower f63c93399a Integrate LLVM at llvm/llvm-project@7e54d7304b
Updates LLVM usage to match
[7e54d7304be2](https://github.com/llvm/llvm-project/commit/7e54d7304be2)

PiperOrigin-RevId: 358516349
2021-02-19 17:49:00 -08:00
A. Unique TensorFlower 5cc9fa9d9d Integrate LLVM at llvm/llvm-project@cd8cc00b9e
Updates LLVM usage to match
[cd8cc00b9e2b](https://github.com/llvm/llvm-project/commit/cd8cc00b9e2b)

PiperOrigin-RevId: 358329421
2021-02-18 21:09:36 -08:00
A. Unique TensorFlower 5400287d69 Integrate LLVM at llvm/llvm-project@b7e05c874b
Updates LLVM usage to match
[b7e05c874b5b](https://github.com/llvm/llvm-project/commit/b7e05c874b5b)

PiperOrigin-RevId: 358289004
2021-02-18 16:19:04 -08:00
A. Unique TensorFlower 27a8b18526 Integrate LLVM at llvm/llvm-project@f70cdc5b5c
Updates LLVM usage to match
[f70cdc5b5c7c](https://github.com/llvm/llvm-project/commit/f70cdc5b5c7c)

PiperOrigin-RevId: 358240325
2021-02-18 12:40:08 -08:00
A. Unique TensorFlower 72d3eee118 Integrate LLVM at llvm/llvm-project@5b094bfeb3
Updates LLVM usage to match
[5b094bfeb3cc](https://github.com/llvm/llvm-project/commit/5b094bfeb3cc)

PiperOrigin-RevId: 358214975
2021-02-18 10:52:25 -08:00
Benjamin Kramer b42def4612 [mlir][hlo] Refactor rank specialization to allow an arbitrary number of inputs
This actually simplifies the code a bit.

PiperOrigin-RevId: 358201038
2021-02-18 09:53:03 -08:00
Benjamin Kramer ca4034b56e [mlir][hlo] Make select ready for dynamic shapes (ranked only for now)
Move tf.SelectV2 broadcast lowering to a chlo.broadcast_select op, and lower it
to broadcasts on mhlo from there.

PiperOrigin-RevId: 358179975
2021-02-18 08:08:40 -08:00
A. Unique TensorFlower a6f03aecfb Integrate LLVM at llvm/llvm-project@624fccba87
Updates LLVM usage to match
[624fccba87cc](https://github.com/llvm/llvm-project/commit/624fccba87cc)

PiperOrigin-RevId: 358167564
2021-02-18 06:50:29 -08:00
Adrian Kuegel 37e31f8b26 Lower Expm1 kernel to math.ExpM1.
PiperOrigin-RevId: 358152908
2021-02-18 04:54:23 -08:00
A. Unique TensorFlower 90b222cf6e Integrate LLVM at llvm/llvm-project@55756f32f7
Updates LLVM usage to match
[55756f32f735](https://github.com/llvm/llvm-project/commit/55756f32f735)

PiperOrigin-RevId: 358093073
2021-02-17 20:33:14 -08:00
Richard Uhler b579bd5d9e Support dynamic-shaped operand in verification of BroadcastInDim.
Verification of HLO_BroadcastInDimOp was previously failing or crashing if the
operand had a dynamic shape or was unranked. Update the verification code to
allow the operand to be unranked or have dynamic shape.

PiperOrigin-RevId: 358056793
2021-02-17 16:18:09 -08:00
A. Unique TensorFlower dd237d4267 Integrate LLVM at llvm/llvm-project@892d2822b6
Updates LLVM usage to match
[892d2822b62e](https://github.com/llvm/llvm-project/commit/892d2822b62e)

PiperOrigin-RevId: 358038509
2021-02-17 14:52:43 -08:00
A. Unique TensorFlower 220deb3709 [MLIR][CHLO] Add legalization for `chlo.polygamma` to MHLO
PiperOrigin-RevId: 357954624
2021-02-17 08:33:01 -08:00
A. Unique TensorFlower c06de24f6c [MLIR][CHLO] Generalize lowering with upcast to n-ary operation
Allows reuse for zeta lowering now and for the polygamma lowering soon.

PiperOrigin-RevId: 357739910
2021-02-16 09:47:24 -08:00
A. Unique TensorFlower 81abaf364d [MLIR][MHLO] Add polygamma op to the CHLO dialect
PiperOrigin-RevId: 357724465
2021-02-16 08:32:33 -08:00
A. Unique TensorFlower 02dab94054 Integrate LLVM at llvm/llvm-project@9f581815ae
Updates LLVM usage to match
[9f581815ae4d](https://github.com/llvm/llvm-project/commit/9f581815ae4d)

PiperOrigin-RevId: 357683119
2021-02-16 03:33:12 -08:00
Benjamin Kramer 9447374676 Integrate LLVM at llvm/llvm-project@715dc556b7
Updates LLVM usage to match
[715dc556b782](https://github.com/llvm/llvm-project/commit/715dc556b782)

PiperOrigin-RevId: 357607282
2021-02-15 13:35:33 -08:00
A. Unique TensorFlower af5343ff86 Integrate LLVM at llvm/llvm-project@2dbe88db58
Updates LLVM usage to match
[2dbe88db5804](https://github.com/llvm/llvm-project/commit/2dbe88db5804)

PiperOrigin-RevId: 357587981
2021-02-15 09:58:25 -08:00
Adrian Kuegel b594254c79 [mhlo] Lower int->bool to a comparison with zero
This matches what TF (and C++) do in this case.

PiperOrigin-RevId: 357566262
2021-02-15 06:38:09 -08:00
Benjamin Kramer 240a44de82 [mhlo] Lower int->int cast to sign extension instead of zero extension
Signless does not mean unsigned here. Currently mhlo only has signed types.

PiperOrigin-RevId: 357561712
2021-02-15 05:58:47 -08:00
Adrian Kuegel 8672735e9a [mhlo] Lower float->bool to a comparison with zero
This matches what TF (and C++) do in this case.

PiperOrigin-RevId: 357553098
2021-02-15 04:36:36 -08:00
A. Unique TensorFlower 2fe0c33083 Integrate LLVM at llvm/llvm-project@16428a8d91
Updates LLVM usage to match
[16428a8d91a9](https://github.com/llvm/llvm-project/commit/16428a8d91a9)

PiperOrigin-RevId: 357550807
2021-02-15 04:17:58 -08:00
A. Unique TensorFlower 89d81adf6d [mhlo] Lower float->bool to a comparison with zero
This matches what TF (and C++) do in this case.

PiperOrigin-RevId: 357541594
2021-02-15 03:11:56 -08:00
Benjamin Kramer 3e80d91e73 [mhlo] Lower float->bool to a comparison with zero
This matches what TF (and C++) do in this case.

PiperOrigin-RevId: 357534118
2021-02-15 02:17:19 -08:00
Adrian Kuegel 824bc9c425 Improve broadcast transformation to treat dynamic shapes with 1 element as scalar.
A shape that contains exactly one element is effectively a scalar. This leads
to a speedup in cases where we have a binary op with one operand that is
effectively a scalar, because we can use the fast path.

PiperOrigin-RevId: 357515552
2021-02-14 23:25:41 -08:00
A. Unique TensorFlower 4060a86fe2 Integrate LLVM at llvm/llvm-project@2bfe27da17
Updates LLVM usage to match
[2bfe27da171e](https://github.com/llvm/llvm-project/commit/2bfe27da171e)

PiperOrigin-RevId: 357196336
2021-02-12 08:32:03 -08:00
A. Unique TensorFlower e993082b97 Integrate LLVM at llvm/llvm-project@6f04addc8b
Updates LLVM usage to match
[6f04addc8b2e](https://github.com/llvm/llvm-project/commit/6f04addc8b2e)

PiperOrigin-RevId: 357170209
2021-02-12 05:21:12 -08:00
A. Unique TensorFlower f7ac575dd9 Integrate LLVM at llvm/llvm-project@0c118831a3
Updates LLVM usage to match
[0c118831a37a](https://github.com/llvm/llvm-project/commit/0c118831a37a)

PiperOrigin-RevId: 357158589
2021-02-12 03:32:55 -08:00
A. Unique TensorFlower a7365aadbe Integrate LLVM at llvm/llvm-project@8151c1b442
Updates LLVM usage to match
[8151c1b44211](https://github.com/llvm/llvm-project/commit/8151c1b44211)

PiperOrigin-RevId: 357080940
2021-02-11 16:17:46 -08:00
A. Unique TensorFlower 077df4f8cc Integrate LLVM at llvm/llvm-project@418c218efa
Updates LLVM usage to match
[418c218efa95](https://github.com/llvm/llvm-project/commit/418c218efa95)

PiperOrigin-RevId: 357010454
2021-02-11 10:49:27 -08:00
Tim Shen 6fa6974e8d [XLA/GPU] Plumb through Bitcast op for LMHLO.
Also remove BitcastOp. XLA bitcast requires the input buffer to alias the output buffer, which makes bitcast always a no-op.

PiperOrigin-RevId: 356884383
2021-02-10 19:45:40 -08:00
A. Unique TensorFlower 4e202135d1 Integrate LLVM at llvm/llvm-project@9db6e97a86
Updates LLVM usage to match
[9db6e97a8605](https://github.com/llvm/llvm-project/commit/9db6e97a8605)

PiperOrigin-RevId: 356753027
2021-02-10 09:32:14 -08:00
Alexander Belyaev 36e04d92c0 [KERNEL_GEN] Add a pattern to bufferize `mhlo.reshape(<unranked_tensor>)`.
PiperOrigin-RevId: 356720899
2021-02-10 06:32:21 -08:00