Commit Graph

982 Commits

Author SHA1 Message Date
Tres Popp d327fc5737 [kernel_gen] Lower max rank specialization from 6 to 5
We don't care much about rank 6 broadcasting operations and this lowers compile times significantly.

PiperOrigin-RevId: 346046601
2020-12-07 02:18:38 -08:00
A. Unique TensorFlower 4c0c9ab119 Integrate LLVM at llvm/llvm-project@db226cdf4c
Updates LLVM usage to match
[db226cdf4cf9](https://github.com/llvm/llvm-project/commit/db226cdf4cf9)

PiperOrigin-RevId: 346045832
2020-12-07 02:13:36 -08:00
Smit Hinsu bc7b6374c8 Fix handling of negative seeds in random number generator op kernels for XLA
Casting negative s32 number to u64 directly will have leading 1s in the representation which is not what we want to get a single u64 out of two s32 seeds. Fixed this by first getting unsigned number of the same bit-width.

PiperOrigin-RevId: 345902167
2020-12-05 18:55:41 -08:00
A. Unique TensorFlower 55268f9ee8 Integrate LLVM at llvm/llvm-project@7f6f9f4cf9
Updates LLVM usage to match
[7f6f9f4cf966](https://github.com/llvm/llvm-project/commit/7f6f9f4cf966)

PiperOrigin-RevId: 345745888
2020-12-04 13:33:48 -08:00
Phoenix Meadowlark c33bdcbd03 Remove fold of `mhlo.compare(%arg0, %arg0)` for floating types.
Two tensors having the same SSA-value isn't sufficient for equality for floating types, as `NaN != NaN`. As written this causes `tf.IsNan` to [miscompile](https://github.com/google/iree/issues/4061).

PiperOrigin-RevId: 345730640
2020-12-04 12:15:02 -08:00
Smit Hinsu 9bd1995f90 Legalize XlaReplicaId to HLO replica-id op
Also, define shape inference function for HLO replica-id op.

PiperOrigin-RevId: 345714342
2020-12-04 11:04:40 -08:00
Rahul Joshi e48881af81 [MLIR:LHLO_GPU] Add fused convolution operation without any side inputs.
- Add a variant of the fused convolution that does not need a side input and side input scale.
- Rename the existing one to `ConvForwardFusedSideInputOp`.
- Update tests to exercise all variants of the convolution ops in the GPU dialect.
- Eliminate unused `LHLO_ExtentBuffer` and changed LHLO_Buffer to allow any integer element
  type to match what XLA can generate sometimes for scratch buffers.

PiperOrigin-RevId: 345701569
2020-12-04 10:09:27 -08:00
A. Unique TensorFlower 3691e39f62 Integrate LLVM at llvm/llvm-project@f5d52916ce
Updates LLVM usage to match
[f5d52916ce34](https://github.com/llvm/llvm-project/commit/f5d52916ce34)

PiperOrigin-RevId: 345672828
2020-12-04 07:24:17 -08:00
A. Unique TensorFlower e87d53742b Fix handling of negative seeds in random number generator op kernels for XLA
Casting negative s32 number to u64 directly will have leading 1s in the representation which is not what we want to get a single u64 out of two s32 seeds. Fixed this by first getting unsigned number of the same bit-width.

PiperOrigin-RevId: 345618958
2020-12-04 00:04:10 -08:00
Smit Hinsu 9456af5880 Fix handling of negative seeds in random number generator op kernels for XLA
Casting negative s32 number to u64 directly will have leading 1s in the representation which is not what we want to get a single u64 out of two s32 seeds. Fixed this by first getting unsigned number of the same bit-width.

PiperOrigin-RevId: 345605910
2020-12-03 22:09:56 -08:00
A. Unique TensorFlower a7506fab4f Integrate LLVM at llvm/llvm-project@55db6ec1cc
Updates LLVM usage to match
[55db6ec1cc20](https://github.com/llvm/llvm-project/commit/55db6ec1cc20)

PiperOrigin-RevId: 345565090
2020-12-03 16:55:25 -08:00
Tim Shen 73cb134cca [MLIR] Add XLA HLO -> LMHLO conversion for all elementwise ops.
PiperOrigin-RevId: 345557248
2020-12-03 16:12:02 -08:00
A. Unique TensorFlower 4b6a38da54 Integrate LLVM at llvm/llvm-project@1860331932
Updates LLVM usage to match
[18603319321a](https://github.com/llvm/llvm-project/commit/18603319321a)

PiperOrigin-RevId: 345513348
2020-12-03 12:45:16 -08:00
Tres Popp 7c3f049c8e [kernel_gen] Lower max rank specialization from 6 to 5
We don't care much about rank 6 broadcasting operations and this lowers compile times significantly.

PiperOrigin-RevId: 345466476
2020-12-03 09:19:25 -08:00
A. Unique TensorFlower d2e3797d7d Integrate LLVM at llvm/llvm-project@6627a3c287
Updates LLVM usage to match
[6627a3c2873f](https://github.com/llvm/llvm-project/commit/6627a3c2873f)

PiperOrigin-RevId: 345428622
2020-12-03 05:10:04 -08:00
A. Unique TensorFlower 1c6c04f76b Integrate LLVM at llvm/llvm-project@baa005c96c
Updates LLVM usage to match
[baa005c96ce6](https://github.com/llvm/llvm-project/commit/baa005c96ce6)

PiperOrigin-RevId: 345327906
2020-12-02 15:41:44 -08:00
A. Unique TensorFlower 446e25ed7d Integrate LLVM at llvm/llvm-project@b40b3196b3
Updates LLVM usage to match
[b40b3196b321](https://github.com/llvm/llvm-project/commit/b40b3196b321)

PiperOrigin-RevId: 345287702
2020-12-02 12:24:43 -08:00
Rahul Joshi dbbdfea95b [MLIR:HLO] Generate enum decls for HLO and LHLO GPU dialects.
- Split out enum definitions in hlo dialect into a separate .td file (similar to structs)
  and generate enum decl/defs for these enums.
- Also split out the LHLO GPU enums into a separate .td file and generate enum
  decl/defs for these enums as well.
- Remove unused dialect from ConvolutionAttributes and generate lhlo_gpu enums.
- Add appropriate namespace for all the enums.

PiperOrigin-RevId: 345277240
2020-12-02 11:39:23 -08:00
Rahul Joshi d7bd5233ab [XLA:GPU] Migrate GEMM Thunk emission to MLIR.
- Map Custom call for GEMM in XLA HLO to Gemm/Gemm bias operations in LHLO GPU
  dialect.
- Make 'algorithm' an optional attribute to better match with XLA HLO backend config.
- Replace 'alpha' with 'alpha_real' and 'alpha_complex' to support complex GEMM correctly.
- Generate GemmThunk off of LHLO GPU Gemm operations.

PiperOrigin-RevId: 345250840
2020-12-02 09:43:12 -08:00
A. Unique TensorFlower 1b711670bc Fix handling of negative seeds in random number generator op kernels for XLA
Casting negative s32 number to u64 directly will have leading 1s in the representation which is not what we want to get a single u64 out of two s32 seeds. Fixed this by first getting unsigned number of the same bit-width.

PiperOrigin-RevId: 345239817
2020-12-02 08:42:07 -08:00
Smit Hinsu 733fc6d032 Fix handling of negative seeds in random number generator op kernels for XLA
Casting negative s32 number to u64 directly will have leading 1s in the representation which is not what we want to get a single u64 out of two s32 seeds. Fixed this by first getting unsigned number of the same bit-width.

PiperOrigin-RevId: 345227848
2020-12-02 07:24:10 -08:00
A. Unique TensorFlower 2f6ced90fc Integrate LLVM at llvm/llvm-project@c266c56d54
Updates LLVM usage to match
[c266c56d545d](https://github.com/llvm/llvm-project/commit/c266c56d545d)

PiperOrigin-RevId: 345222350
2020-12-02 06:41:39 -08:00
A. Unique TensorFlower 27b10932cb Integrate LLVM at llvm/llvm-project@aafb366210
Updates LLVM usage to match
[aafb3662103f](https://github.com/llvm/llvm-project/commit/aafb3662103f)

PiperOrigin-RevId: 345121003
2020-12-01 16:10:48 -08:00
River Riddle f89244381d [mlir][NFC] Replace usages of Function.h and Module.h with BuiltinOps.h
This is part of a larger refactoring cleaning up the BuiltinDialect of MLIR.

PiperOrigin-RevId: 345085278
2020-12-01 13:18:06 -08:00
A. Unique TensorFlower eb9015a2b0 Integrate LLVM at llvm/llvm-project@bb993b1d9d
Updates LLVM usage to match
[bb993b1d9de3](https://github.com/llvm/llvm-project/commit/bb993b1d9de3)

PiperOrigin-RevId: 345083620
2020-12-01 13:09:14 -08:00
A. Unique TensorFlower 7138157ed9 Integrate LLVM at llvm/llvm-project@523775f967
Updates LLVM usage to match
[523775f96742](https://github.com/llvm/llvm-project/commit/523775f96742)

PiperOrigin-RevId: 345009972
2020-12-01 06:47:02 -08:00
A. Unique TensorFlower fd286b11f1 Integrate LLVM at llvm/llvm-project@40659cd2c6
Updates LLVM usage to match
[40659cd2c6f4](https://github.com/llvm/llvm-project/commit/40659cd2c6f4)

PiperOrigin-RevId: 344995763
2020-12-01 04:41:59 -08:00
A. Unique TensorFlower 00ab6722ac Integrate LLVM at llvm/llvm-project@d928dfc6f9
Updates LLVM usage to match
[d928dfc6f924](https://github.com/llvm/llvm-project/commit/d928dfc6f924)

PiperOrigin-RevId: 344948827
2020-11-30 21:45:24 -08:00
A. Unique TensorFlower 37b1110ae0 Integrate LLVM at llvm/llvm-project@8cdf4920c4
Updates LLVM usage to match
[8cdf4920c47d](https://github.com/llvm/llvm-project/commit/8cdf4920c47d)

PiperOrigin-RevId: 344933001
2020-11-30 19:06:43 -08:00
A. Unique TensorFlower 3f815138b6 Integrate LLVM at llvm/llvm-project@750049d78b
Updates LLVM usage to match
[750049d78b74](https://github.com/llvm/llvm-project/commit/750049d78b74)

PiperOrigin-RevId: 344889997
2020-11-30 14:32:11 -08:00
Rahul Joshi 5350b8080d [NFC] Add default value for attributes in lmhlo::FusionOp custom builder.
PiperOrigin-RevId: 344856882
2020-11-30 11:47:39 -08:00
A. Unique TensorFlower a4a3e9b73c Integrate LLVM at llvm/llvm-project@234a5297aa
Updates LLVM usage to match
[234a5297aa00](https://github.com/llvm/llvm-project/commit/234a5297aa00)

PiperOrigin-RevId: 344824858
2020-11-30 09:17:33 -08:00
A. Unique TensorFlower dd15c6cd84 [MLIR][KernelGen] Generate assertion message in `transform_unranked_hlo` pass
Use constant to generate the correct assertion message. This avoids
confusion when lowering the max rank specialization for debugging.

PiperOrigin-RevId: 344769021
2020-11-30 01:41:09 -08:00
Benjamin Kramer 1fe04c0aff Integrate LLVM at llvm/llvm-project@564628014c
Updates LLVM usage to match
[564628014c40](https://github.com/llvm/llvm-project/commit/564628014c40)

PiperOrigin-RevId: 344542990
2020-11-27 10:05:28 -08:00
Adrian Kuegel d14c63da54 Add a canonicalization pattern to remove redundant dynamic_reshapes.
PiperOrigin-RevId: 344517381
2020-11-27 04:46:50 -08:00
Stephan Herhut f183e95e69 Register the new branch op rewrite patterns in hlo to lhlo conversion
for good measure.

PiperOrigin-RevId: 344512196
2020-11-27 03:44:28 -08:00
Benjamin Kramer d617f3edb6 Integrate LLVM at llvm/llvm-project@b33fbbaa34
Updates LLVM usage to match
[b33fbbaa34f0](https://github.com/llvm/llvm-project/commit/b33fbbaa34f0)

PiperOrigin-RevId: 344510775
2020-11-27 03:28:09 -08:00
Benjamin Kramer df244927d3 Integrate LLVM at llvm/llvm-project@20c926e079
Updates LLVM usage to match
[20c926e0797e](https://github.com/llvm/llvm-project/commit/20c926e0797e)

PiperOrigin-RevId: 344437441
2020-11-26 10:12:18 -08:00
Adrian Kuegel 6a71a84302 Support different input/output type for TransformUnrankedHlo.
Also generate the tf.Equal kernel, now that it works.

PiperOrigin-RevId: 344402014
2020-11-26 04:20:34 -08:00
Benjamin Kramer 1b98bf5fab Integrate LLVM at llvm/llvm-project@54ec9bb551
Updates LLVM usage to match
[54ec9bb5510d](https://github.com/llvm/llvm-project/commit/54ec9bb5510d)

PiperOrigin-RevId: 344400393
2020-11-26 04:06:38 -08:00
A. Unique TensorFlower 651afab874 Integrate LLVM at llvm/llvm-project@dc35368ccf
Updates LLVM usage to match
[dc35368ccf17](https://github.com/llvm/llvm-project/commit/dc35368ccf17)

PiperOrigin-RevId: 344332738
2020-11-25 16:16:33 -08:00
Alexander Belyaev 5583c63cab [KERNEL_GEN] Add unranked Conj kernel.
PiperOrigin-RevId: 344243271
2020-11-25 06:37:26 -08:00
Benjamin Kramer a6948f6b41 Integrate LLVM at llvm/llvm-project@a38d13ed36
Updates LLVM usage to match
[a38d13ed3635](https://github.com/llvm/llvm-project/commit/a38d13ed3635)

PiperOrigin-RevId: 344235713
2020-11-25 05:33:34 -08:00
A. Unique TensorFlower 42345f41f7 Integrate LLVM at llvm/llvm-project@e0f4dea0d0
Updates LLVM usage to match
[e0f4dea0d0f1](https://github.com/llvm/llvm-project/commit/e0f4dea0d0f1)

PiperOrigin-RevId: 344202478
2020-11-25 00:27:24 -08:00
A. Unique TensorFlower e970a97efb Integrate LLVM at llvm/llvm-project@42eaf4fe0a
Updates LLVM usage to match
[42eaf4fe0ade](https://github.com/llvm/llvm-project/commit/42eaf4fe0ade)

PiperOrigin-RevId: 344158599
2020-11-24 17:12:52 -08:00
Tim Shen 3e01448481 [MLIR] Move some walk()ing functions to the lmhlo::FusionOp API.
PiperOrigin-RevId: 344109366
2020-11-24 12:23:57 -08:00
Lucy Fox 85f92a1651 [KernelGen] Lower tf.Erf and tf.Erfc ops to CHLO.
This does not include the lowerings from CHLO to LMHLO.

PiperOrigin-RevId: 344091604
2020-11-24 10:55:43 -08:00
Benjamin Kramer 9f20ef0581 Integrate LLVM at llvm/llvm-project@5ce85e6635
Updates LLVM usage to match
[5ce85e66358a](https://github.com/llvm/llvm-project/commit/5ce85e66358a)

PiperOrigin-RevId: 344079124
2020-11-24 09:53:42 -08:00
Benjamin Kramer 80d7342ae3 Integrate LLVM at llvm/llvm-project@fd92c5dbee
Updates LLVM usage to match
[fd92c5dbeeeb](https://github.com/llvm/llvm-project/commit/fd92c5dbeeeb)

PiperOrigin-RevId: 344036276
2020-11-24 05:14:33 -08:00
Smit Hinsu b016b5a219 Fix constant folding of mhlo.convert op with i1 element types
Boolean element values should be fetched as an unsigned integer and not signed integer which would return -1 for true.

Added to a TODO to handle unsigned types correctly as well as we don't seem to be using unsigned types.

PiperOrigin-RevId: 343927564
2020-11-23 14:18:28 -08:00