Skip to content

unidirectional_lstm.mlir doesn't work with -iree-flow-dispatch-linalg-on-tensors #5151

Description

@hanhanW

Describe the bug
This test failed in DispatchLinalgOnTensorsPass. The error log can be found at https://gist.github.com/hanhanW/89a177694616a43a35da7abd11152d51

Short log:

error: operand #0 does not dominate this use

This failed in dispatch function creation stage, so it does not work on both CPU and GPU.

To Reproduce

Run: iree-run-mlir iree/test/e2e/models/unidirectional_lstm.mlir -iree-hal-target-backends=vulkan-spirv -function-input="1x5xf32=[0,1,0,3,4]" -iree-flow-dispatch-linalg-on-tensors -iree-codegen-spirv-experimental-linalg-on-tensors -function-input="1x5x2x2xf32=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]"

Activity

  1. added
    bug 🐞
    compiler/dialects
    codegen
    on Mar 18, 2021
  2. hanhanW commented on Mar 18, 2021

    @hanhanW
    ContributorAuthor

    @MaheshRavishankar I'm not sure who is the best person for this bug, feel free to reassign to others.

  3. hanhanW commented on Mar 18, 2021

    @hanhanW
    ContributorAuthor

    One thing might help here, I hit an issue in this file when developing benchmarking tools. The main difference is that this file contains multiple blocks because it has a control-flow op (ie, mhlo.while op).

  4. MaheshRavishankar commented on Mar 18, 2021

    @MaheshRavishankar
    Collaborator
  5. hanhanW commented on Mar 23, 2021

    @hanhanW
    ContributorAuthor

    I've seen the same issue happens in other integration model tests, fyi.

  6. MaheshRavishankar commented on Mar 23, 2021

    @MaheshRavishankar
    Collaborator

    This patch to upstream fixes this particular issue https://reviews.llvm.org/D99226.

    But it actually raises a slightly involved issue. The core issue is caused due to this method https://github.com/google/iree/blob/881de81238971869d6d62cabf8dc0b54a17be704/iree/compiler/Dialect/Flow/Transforms/DispatchLinalgOnTensors.cpp#L328.
    It is trying to bring in operations that can be fused with the ops in the dispatch region. This is hard to get correct when you have a DAG of operations to pull in. Instead

    1. Try to canonicalize subtensor, tensor_reshape, etc.
    2. Use the Flow::DispatchWorkgroupsOp canonicalization to pull in operations like init_tensor, constant etc.

    This will require some more work cause oeprations that dont fall into this category need to be pulled in this way are lowered to flow.tensor. operations. Some of that needs to be plumbed through as well #5105 . Going to keep the ticket on this one and see if I can drop the method linked above.

  7. added 3 commits that reference this issue on Mar 26, 2021
    bea6786
    ca0347e
    e4a82a8
  8. added a commit that references this issue on Mar 30, 2021
    b69eea4
  9. hanhanW commented on Mar 31, 2021

    @hanhanW
    ContributorAuthor

    Can we close the issue in a change/PR that enables the test: https://github.com/google/iree/blob/main/iree/test/e2e/models/unidirectional_lstm.mlir

    Or you think it is too fragile at this moment, people would be struggle on it?

  10. hanhanW commented on Mar 31, 2021

    @hanhanW
    ContributorAuthor

    Oh, I saw it in #5259

  11. MaheshRavishankar commented on Mar 31, 2021

    @MaheshRavishankar
    Collaborator

    I'll close with it. It might not actually work though. I was getting an error on buffer allocation with that change. It went away on rebase, but I see there is a swift shader failure on CI. Need to investigate.

  12. added 2 commits that reference this issue on Apr 2, 2021
    2fb4316
    4c6ca93
  13. added a commit that references this issue on Apr 5, 2021
    f96726a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug 🐞codegencompiler/dialects

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions