8000 [VectorExt] `transfer_gather` parser fails to round-trip valid operation emitted by printer · Issue #20802 · iree-org/iree · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[VectorExt] transfer_gather parser fails to round-trip valid operation emitted by printer #20802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
IanWood1 opened this issue May 14, 2025 · 0 comments · Fixed by #20860
Closed
Assignees
Labels
bug 🐞 Something isn't working

Comments

@IanWood1
Copy link
Contributor

What happened?

The parser & printer for iree_vector_ext.transfer_gather seem to be inconsistent with each other. The parser fails to parse a verified operation emitted by the custom printer. I'm not sure if this is a problem with the verifier, parser, or printer.

Steps to reproduce your issue

To reproduce run iree-opt generic.mlir | iree-opt which shows that iree-opt cannot parse IR emitted by the printer for this op.

// generic.mlir
"builtin.module"() ({
  "func.func"() <{function_type = (tensor<1024x128xi32>, tensor<10xi32>) -> tensor<10x128xi32>, sym_name = "linalg_ext_gather"}> ({
  ^bb0(%arg0: tensor<1024x128xi32>, %arg1: tensor<10xi32>):
    %0 = "arith.constant"() <{value = 0 : i32}> : () -> i32
    %1 = "arith.constant"() <{value = 0 : index}> : () -> index
    %2 = "vector.transfer_read"(%arg1, %1, %0) <{in_bounds = [true], operandSegmentSizes = array<i32: 1, 1, 1, 0>, permutation_map = affine_map<(d0) -> (d0)>}> : (tensor<10xi32>, index, i32) -> vector<10xindex>
    %3 = "iree_vector_ext.transfer_gather"(%arg0, %1, %1, %2, %0) <{in_bounds = [true, true], indexed = [true, false], indexed_maps = [affine_map<(d0, d1) -> (d0)>], operandSegmentSizes = array<i32: 1, 2, 1, 1, 0>, permutation_map = affine_map<(d0, d1) -> (d0, d1)>}> : (tensor<1024x128xi32>, index, index, vector<10xindex>, i32) -> vector<10x128xi32>
    %4 = "tensor.empty"() : () -> tensor<10x128xi32>
    %5 = "vector.transfer_write"(%3, %4, %1, %1) <{in_bounds = [true, true], operandSegmentSizes = array<i32: 1, 1, 2, 0>, permutation_map = affine_map<(d0, d1) -> (d0, d1)>}> : (vector<10x128xi32>, tensor<10x128xi32>, index, index) -> tensor<10x128xi32>
    "func.return"(%5) : (tensor<10x128xi32>) -> ()
  }) : () -> ()
}) : () -> ()

The IR below is the output of running iree-opt generic.mlir --mlir-print-local-scope. It fails to parse.

// nongeneric.mlir
module {
  func.func @linalg_ext_gather(%arg0: tensor<1024x128xi32>, %arg1: tensor<10xi32>) -> tensor<10x128xi32> {
    %c0_i32 = arith.constant 0 : i32
    %c0 = arith.constant 0 : index
    %0 = vector.transfer_read %arg1[%c0], %c0_i32 {in_bounds = [true]} : tensor<10xi32>, vector<10xindex>
    %1 = iree_vector_ext.transfer_gather %arg0[%c0, %c0][%0: vector<10xindex>, None] {in_bounds = [true, true], indexed_maps = [affine_map<(d0, d1) -> (d0)>]} : tensor<1024x128xi32>, vector<10xindex>, vector<10x128xi32>
    %2 = tensor.empty() : tensor<10x128xi32>
    %3 = vector.transfer_write %1, %2[%c0, %c0] {in_bounds = [true, true]} : vector<10x128xi32>, tensor<10x128xi32>
    return %3 : tensor<10x128xi32>
  }
}

What component(s) does this issue relate to?

No response

Version information

d63e15e

Additional context

No response

@IanWood1 IanWood1 added the bug 🐞 Something isn't working label May 14, 2025
Groverkss pushed a commit that referenced this issue May 20, 2025
Print the `padding` operand & removes printing the index vec types at
the end of the op. Because this uses a custom printer and parser, I
added `iree-opt --split-input-file %s | iree-opt --split-input-file |
FileCheck %s` to the roundtrip tests.


Fixes #20802

Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
ziereis pushed a commit to ziereis/iree that referenced this issue May 22, 2025
Print the `padding` operand & removes printing the index vec types at
the end of the op. Because this uses a custom printer and parser, I
added `iree-opt --split-input-file %s | iree-opt --split-input-file |
FileCheck %s` to the roundtrip tests.

Fixes iree-org#20802

Signed-off-by: Ian Wood <ianwood2024@u.northwestern.edu>
Signed-off-by: Thomas Ziereis <ziereis@roofline.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0