Commit Graph

195 Commits

Author SHA1 Message Date
Richard Uhler 9a232c7012 Fix failing segment_reduction_ops_mlir_bridge_test
By adding support for complex types to GetScalarOfType and using appropriate
choice of limits for initial values in the unsorted segment reduction ops.

PiperOrigin-RevId: 327061577
2020-08-17 11:28:20 -07:00
A. Unique TensorFlower a434b7e4ee Integrate LLVM at llvm/llvm-project@fed9ff5117
Updates LLVM usage to match
[fed9ff511711](https://github.com/llvm/llvm-project/commit/fed9ff511711)

PiperOrigin-RevId: 327019578
2020-08-17 07:54:00 -07:00
A. Unique TensorFlower c77cc093e8 Integrate LLVM at llvm/llvm-project@4225e7fa34
Updates LLVM usage to match
[4225e7fa34fe](https://github.com/llvm/llvm-project/commit/4225e7fa34fe)

PiperOrigin-RevId: 327004488
2020-08-17 05:45:22 -07:00
A. Unique TensorFlower ec35775c67 Integrate LLVM at llvm/llvm-project@0581c0b0ee
Updates LLVM usage to match
[0581c0b0eeba](https://github.com/llvm/llvm-project/commit/0581c0b0eeba)

PiperOrigin-RevId: 326830705
2020-08-15 11:43:53 -07:00
Jacques Pienaar 8712cbae75 Add missing command line option registrations
PiperOrigin-RevId: 326773738
2020-08-14 20:08:06 -07:00
A. Unique TensorFlower c2afc5e45f Integrate LLVM at llvm/llvm-project@88bbd30736
Updates LLVM usage to match
[88bbd3073656](https://github.com/llvm/llvm-project/commit/88bbd3073656)

PiperOrigin-RevId: 326577009
2020-08-13 19:55:49 -07:00
River Riddle 7acc765ed7 Remove kindof definitions on derived mlir Attribute and Type classes
This method no longer needs to be explicitly defined by the user, so all of the existing definitions are dead and can be removed.

PiperOrigin-RevId: 326350650
2020-08-12 17:42:07 -07:00
Robert Suderman 5252aeae8f Lowering for mhlo.ceil to std.ceil
PiperOrigin-RevId: 326335301
2020-08-12 16:15:35 -07:00
A. Unique TensorFlower ec328ae43b Integrate LLVM at llvm/llvm-project@30c1633386
Updates LLVM usage to match
[30c1633386e7](https://github.com/llvm/llvm-project/commit/30c1633386e7)

PiperOrigin-RevId: 326184631
2020-08-12 00:48:35 -07:00
Mehdi Amini 961b9b1795 Add build instructions for the standalone mlir-hlo compiler in the Readme.md + a title
PiperOrigin-RevId: 326077782
2020-08-11 14:56:51 -07:00
A. Unique TensorFlower 875c6e4f26 Integrate LLVM at llvm/llvm-project@950f1bf976
Updates LLVM usage to match
[950f1bf976b3](https://github.com/llvm/llvm-project/commit/950f1bf976b3)

PiperOrigin-RevId: 326028888
2020-08-11 14:56:23 -07:00
A. Unique TensorFlower 7259d814e7 Integrate LLVM at llvm/llvm-project@b2b7dbb47a
Updates LLVM usage to match
[b2b7dbb47aa9](https://github.com/llvm/llvm-project/commit/b2b7dbb47aa9)

PiperOrigin-RevId: 326003266
2020-08-11 14:55:57 -07:00
A. Unique TensorFlower 31044ec201 Integrate LLVM at llvm/llvm-project@0de60b550b
Updates LLVM usage to match
[0de60b550b72](https://github.com/llvm/llvm-project/commit/0de60b550b72)

PiperOrigin-RevId: 325977375
2020-08-11 14:55:26 -07:00
Jacques Pienaar 5dac76f4af Add chlo.constant_like op which splats a constant to shape of operand
This allows specifying a constant whose shape is only known when operand shape is. Also use it to update tf.Acos legalization.

PiperOrigin-RevId: 325860604
2020-08-11 14:54:48 -07:00
A. Unique TensorFlower e340e41059 Integrate LLVM at llvm/llvm-project@54cb552b96
Updates LLVM usage to match
[54cb552b9620](https://github.com/llvm/llvm-project/commit/54cb552b9620)

PiperOrigin-RevId: 325829818
2020-08-10 18:06:00 -07:00
Jacques Pienaar 17ccca7f4b Add HLO RngBitGenerator
This adds the XlaBuilder RngBitGenerator to the MHLO dialect. The op is currently represented very directly using int attribute for random algorithm and direct import/export.

PiperOrigin-RevId: 325814134
2020-08-10 09:01:11 -07:00
Alexander Belyaev 843af36e05 [MLIR] Add e2e test for unranked unary TF op, lowered and run with CPU runner.
PiperOrigin-RevId: 325665428
2020-08-09 02:38:00 -07:00
Benjamin Kramer 417e9e9c34 Integrate LLVM at llvm/llvm-project@38537307e5
Updates LLVM usage to match
[38537307e502](https://github.com/llvm/llvm-project/commit/38537307e502)

PiperOrigin-RevId: 325590988
2020-08-09 02:37:34 -07:00
A. Unique TensorFlower e6fa003bf2 Integrate LLVM at llvm/llvm-project@b6d9add71b
Updates LLVM usage to match
[b6d9add71b1a](https://github.com/llvm/llvm-project/commit/b6d9add71b1a)

PiperOrigin-RevId: 325589103
2020-08-08 04:35:25 -07:00
Andy Ly 53fdda7f3e Update mhlo.constant to use a custom assembly format instead of a custom printer and parser (NFC).
PiperOrigin-RevId: 325560779
2020-08-07 22:23:06 -07:00
Geoffrey Martin-Noble 2b0a244a6b Add license header to lit.site.cfg.py.in
PiperOrigin-RevId: 325515949
2020-08-07 22:22:24 -07:00
Lucy Fox d742477c02 Verify that MHLO DynamicUpdateSlice start indices have matching element types.
HLO requires that the element types match for all start index parameters. Right now we don't catch this invalid case until export, so adding a check in the verifier so that we catch this sooner.

This also requires a small tweak to the TF InplaceUpdate op lowering.

PiperOrigin-RevId: 325463796
2020-08-07 22:21:40 -07:00
Mehdi Amini 5f8da992f2 Fix mlir-hlo CMakefiles after internal change
PiperOrigin-RevId: 325366142
2020-08-07 22:20:50 -07:00
A. Unique TensorFlower e00565b544 Integrate LLVM at llvm/llvm-project@9dbdaea9a0
Updates LLVM usage to match
[9dbdaea9a0e6](https://github.com/llvm/llvm-project/commit/9dbdaea9a0e6)

PiperOrigin-RevId: 325354353
2020-08-07 22:20:06 -07:00
Rahul Joshi a6978cf4ab [MLIR][NFC] Adopt FuncOp/Region argument API's.
- Use FuncOp::getArguments() and Region::getArguments() and friends where possible
  instead of going through the front() block.

PiperOrigin-RevId: 325352975
2020-08-07 22:19:21 -07:00
Lucy Fox cd22ecd136 Relax DynamicBroadcastInDim verifier when dimensions are dynamic.
For input and output dimensions which must match, we shouldn't fail in the case where one dim is dynamic and the other is static. This is insufficient information to conclude a dimension mismatch.

PiperOrigin-RevId: 325344738
2020-08-07 22:18:38 -07:00
A. Unique TensorFlower c78e144f82 Integrate LLVM at llvm/llvm-project@633e3dacf2
Updates LLVM usage to match
[633e3dacf27e](https://github.com/llvm/llvm-project/commit/633e3dacf27e)

PiperOrigin-RevId: 325237772
2020-08-07 22:17:02 -07:00
A. Unique TensorFlower a68a16cdc7 [MLIR][XLA] Allow for choice of safe/unsafe variant in broadcast utils
Create safe or unsafe variants of `shape.broadcast` depending on the context.
The representation by means of an extent tensor is only legal if the operands
are known to be broadcastable. Currently, there is no use in a safe context in
the codebase but it will be used for shape inference eventually.

PiperOrigin-RevId: 325228073
2020-08-07 22:16:11 -07:00
Alexander Belyaev bc3293a05f [MLIR] Remove Affine->STD and SCF->STD patterns from lhlo->llvm pass.
PiperOrigin-RevId: 325219360
2020-08-07 22:15:24 -07:00
Mehdi Amini 701312720c Add CMake files and lit configurations, enough for `ninja check-mlir-hlo` to pass on all the tests
PiperOrigin-RevId: 325172984
2020-08-07 22:14:34 -07:00
Andy Ly c340367702 Add canonicalization for unpacking and repacking the same tuple (e.g. tuple -> get_tuple_element -> tuple).
These unpacking and repacking of tuples may be generated when modifying tuple arguments or results.

PiperOrigin-RevId: 325162694
2020-08-05 21:38:02 -07:00
A. Unique TensorFlower ad12e06ceb Integrate LLVM at llvm/llvm-project@acb66b9111
Updates LLVM usage to match
[acb66b9111ba](https://github.com/llvm/llvm-project/commit/acb66b9111ba)

PiperOrigin-RevId: 325125249
2020-08-05 21:37:34 -07:00
A. Unique TensorFlower 4372124362 [MLIR][XLA] Allow for choice of safe/unsafe variant in broadcast utils
Create safe or unsafe variants of `shape.broadcast` depending on the context.
The representation by means of an extent tensor is only legal if the operands
are known to be broadcastable. Currently, there is no use in a safe context in
the codebase but it will be used for shape inference eventually.

PiperOrigin-RevId: 325079842
2020-08-05 12:43:29 -07:00
A. Unique TensorFlower 5d3cc2105e [MLIR][HLO] Remove redundant casts from unranked to ranked transformation
The transformation of unranked to ranked operations no longer generates cast
operations for shapes and sizes. Instead, we use the newly introduced support
for extent tensor and index types directly.

PiperOrigin-RevId: 325057440
2020-08-05 11:11:43 -07:00
A. Unique TensorFlower 37c36a4389 [MLIR][XLA] Allow for choice of safe/unsafe variant in broadcast utils
Create safe or unsafe variants of `shape.broadcast` depending on the context.
The representation by means of an extent tensor is only legal if the operands
are known to be broadcastable. Currently, there is no use in a safe context in
the codebase but it will be used for shape inference eventually.

PiperOrigin-RevId: 325056915
2020-08-05 11:09:23 -07:00
Benjamin Kramer d26e863865 Integrate LLVM at llvm/llvm-project@c558c22cab
Updates LLVM usage to match
[c558c22cab9a](https://github.com/llvm/llvm-project/commit/c558c22cab9a)

PiperOrigin-RevId: 324993578
2020-08-05 05:17:23 -07:00
Stephan Herhut 6584c2ab1f Remove optional static registration for hlo dialects again.
Instead, we invoke multiple test tools in a row in end to end tests now. For hlo dialects and passes, we use mlir-hlo-opt explicitly.

PiperOrigin-RevId: 324989884
2020-08-05 03:53:17 -07:00
A. Unique TensorFlower 9a97cffbb5 Integrate LLVM at llvm/llvm-project@28e322ea93
Updates LLVM usage to match
[28e322ea9393](https://github.com/llvm/llvm-project/commit/28e322ea9393)

PiperOrigin-RevId: 324957510
2020-08-04 22:31:45 -07:00
Stephan Herhut 7bff244b8b Allow index typed memrefs in reshape_memref_cast.
With the recent change to allow memref of index in MLIR core, we should also
allow this in the mhlo dialect.

PiperOrigin-RevId: 324879354
2020-08-04 13:34:11 -07:00
Mehdi Amini 66f023a057 Add build helper to mlir-hlo
PiperOrigin-RevId: 324843181
2020-08-04 10:46:48 -07:00
A. Unique TensorFlower bf8836effb Integrate LLVM at llvm/llvm-project@b5059b7140
Updates LLVM usage to match
[b5059b714023](https://github.com/llvm/llvm-project/commit/b5059b714023)

PiperOrigin-RevId: 324754243
2020-08-03 23:05:03 -07:00
Mehdi Amini 6c7d1a7c7e Internal change
PiperOrigin-RevId: 324753700
2020-08-03 22:59:44 -07:00
Mehdi Amini f044cf780c Introduce early documentation on mlir-hlo
PiperOrigin-RevId: 324732753
2020-08-03 19:31:38 -07:00
Andy Ly 4c8fead3e0 Add support for token operands to mhlo.tuple.
mhlo.get_tuple_element supports extracting a mhlo.token type from a tuple. This updates the creation of tuples to allow for mhlo.token typed operands.

PiperOrigin-RevId: 324628663
2020-08-03 19:31:15 -07:00
Smit Hinsu 3fe9a7d2db Legalize TensorFlow NonMaxSuppressionV4 and SelfAdjointEigV2Op ops to HLO
Added support for HLO ops bitcast-convert, sort and while in MlirHloBuilder and enabled tests for NonMaxSuppressionV4 and SelfAdjointEigV2Op using these ops.

PiperOrigin-RevId: 324360651
2020-08-03 19:30:54 -07:00
A. Unique TensorFlower 7809320a5e Integrate LLVM at llvm/llvm-project@b7cfa6ca92
Updates LLVM usage to match
[b7cfa6ca9283](https://github.com/llvm/llvm-project/commit/b7cfa6ca9283)

PiperOrigin-RevId: 324331764
2020-08-03 19:30:43 -07:00
Smit Hinsu 577a81a66d Sink standard dialect constants in sink_constants_to_control_flow pass
This is required before exporting HLO dialect ops with standard dialect constant to XLA.

Also, sink constants for sort op as well. Added a TODO to generalize this pass to handle more ops and non-const values defined outside.

PiperOrigin-RevId: 324301911
2020-08-03 19:30:29 -07:00
Smit Hinsu 1c535f1718 Restrict GetDimensionSize HLO op result type to 32 bit integer
XLA implementation has this limitation and always uses 32 bit result for this instruction. This will cause mismatch between the result type in MLIR and XLA at the time of export.

This should be resolved once we have a special dialect mapping directly to HLOInstructionProto. Another option until then could be to introduce a pass to legalize mhlo itself to match XLA semantics.

PiperOrigin-RevId: 324286936
2020-08-03 19:30:15 -07:00
Tim Shen fcb91fb0b9 [MLIR] Add conversion between XLA Fusion and MHLO FusionOp.
PiperOrigin-RevId: 324279065
2020-08-03 19:30:03 -07:00
Stephan Herhut 9cbe5f2285 Constrain mhlo.const to static shaped tensors.
Constants of unknown shape cannot be materialized. In most cases, one likely wants to use a scalar constant and rely on broadcasting instead.

PiperOrigin-RevId: 324252475
2020-08-03 19:29:51 -07:00