Skip to content

[MLIR] Fix hlo to lhlo conversion amid std.constant ops - #40120

Closed
bondhugula wants to merge 1 commit into
tensorflow:masterfrom
polymage-labs:const_op
Closed

bondhugula wants to merge 1 commit into
tensorflow:masterfrom
polymage-labs:const_op

Conversation

@bondhugula

Copy link
Copy Markdown
Contributor

Add a conversion pattern to convert std.constant to xla_lhlo.const - to
run during HLO to LHLO conversion. Without such a pattern, xla_hlo to
xla_lhlo conversion would fail when std.constant ops provide constant tensor
operands to other xla_hlo ops. The tf-mlir-translate -hlo-to-mlir-hlo
for example generates such std.constant ops from HLO constant nodes.

std.constant tensor generating ops are to be replaced by constant memref
generating ops.

Fixes #39895.

Signed-off-by: Uday Bondhugula [email protected]

@google-ml-butler google-ml-butler Bot added the size:M CL Change Size: Medium label Jun 3, 2020
@google-ml-butler
google-ml-butler Bot requested a review from joker-eph June 3, 2020 12:02
@bondhugula

Copy link
Copy Markdown
Contributor Author

@MaheshRavishankar @sherhut @pifon2a for visibility.

@gbaned gbaned self-assigned this Jun 3, 2020

// Test whether std.constant's generating tensors are converted to lhlo.const.
func @std.const.tensor() {
%cst = constant dense<0.000000e+00> : tensor<f32>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it not an xla_hlo.constant?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it not an xla_hlo.constant?

Please see here: #39895

Add a conversion pattern to convert std.constant to xla_lhlo.const - to
run during HLO to LHLO conversion. Without such a pattern, xla_hlo to
xla_lhlo conversion would fail when std.constant ops provide constant tensor
operands to other xla_hlo ops. The tf-mlir-translate -hlo-to-mlir-hlo
for example generates such std.constant ops from HLO constant nodes.

std.constant tensor generating ops are to be replaced by constant memref
generating ops.

Fixes tensorflow#39895.

Signed-off-by: Uday Bondhugula <[email protected]>
@gbaned
gbaned requested a review from joker-eph June 8, 2020 17:30
@joker-eph
joker-eph marked this pull request as draft June 9, 2020 03:56
@joker-eph

Copy link
Copy Markdown
Contributor

(discussion is going on in the tracking bug #39895)

@gbaned

gbaned commented Jul 14, 2020

Copy link
Copy Markdown
Contributor

@bondhugula, @joker-eph This PR is in draft, any update on this? Please. Thanks!

1 similar comment
@gbaned

gbaned commented Aug 13, 2020

Copy link
Copy Markdown
Contributor

@bondhugula, @joker-eph This PR is in draft, any update on this? Please. Thanks!

@bondhugula

bondhugula commented Aug 13, 2020 •

Copy link
Copy Markdown
Contributor Author

@bondhugula, @joker-eph This PR is in draft, any update on this? Please. Thanks!

I just posted on the other issue thread #39895 to resurrect discussion.

@gbaned

gbaned commented Oct 28, 2020

Copy link
Copy Markdown
Contributor

@bondhugula, @joker-eph This PR is in draft, any update on this? Please. Thanks!

I just posted on the other issue thread #39895 to resurrect discussion.

@bondhugula Any update on this PR? Please. Thanks!

@bondhugula

Copy link
Copy Markdown
Contributor Author

There isn't a clear solution to this issue and this has become moot / low priority - given that there are ways to avoid it trivially. I'm closing this. The bug it was trying to fix should remain open however - the behavior / error isn't proper.

@bondhugula bondhugula closed this Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes size:M CL Change Size: Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MLIR] xla hlo -> lhlo conversion issue when operand is a constant tensor

5 participants