Skip to content

Some lit tests should be fixed when migrating to Linalg on tensors #5155

Closed

Description

@hanhanW

There are some lit tests failed when turning Linalg on tensors by default:

There are different kind of errors, e.g., in iree/compiler/Dialect/Vulkan/Utils/test:target_env_conversion.mlir.test

failed to legalize operation 'hal.interface.load.tensor'

And in convert_to_gpu.mlir.test, some of entry_point function are changed:

Before:

    hal.executable.target @vulkan, filter="vulkan*" {
      hal.executable.entry_point @parallel_4D_static attributes {interface = @legacy_io, ordinal = 0 : i32, signature = (!flow.dispatch.tensor<readonly:?x?xf32>, !flow.dispatch.tensor<readonly:?x?xf32>, !flow.dispatch.tensor<writeonly:?x?xf32>) -> ()} {
      ^bb0(%arg0: index, %arg1: index, %arg2: index):  // no predecessors
        %c1 = constant 1 : index
        %c12 = constant 12 : index
        hal.return %c12, %c1, %c1 : index, index, index
      }

After:

      hal.executable.entry_point @parallel_4D_static attributes {interface = @legacy_io, ordinal = 0 : i32, signature = (!flow.dispatch.tensor<readonly:?x?xf32>, !flow.dispatch.tensor<readonly:?x?xf32>, !flow.dispatch.tensor<writeonly:?x?xf32>) -> ()} {
      ^bb0(%arg0: index, %arg1: index, %arg2: index):  // no predecessors
        %c1 = constant 1 : index
        %0 = affine.apply #map()[%arg0, %arg1, %arg2]
        hal.return %0, %c1, %c1 : index, index, index
      }

Here is the list:

iree/compiler/Conversion/LinalgToSPIRV/test:convert_to_gpu.mlir
iree/compiler/Conversion/LinalgToSPIRV/test:linalg_tile_and_fuse.mlir
iree/compiler/Conversion/LinalgToSPIRV/test:pipeline_test.mlir
iree/compiler/Conversion/LinalgToSPIRV/test:pipeline_test_cooperative_mat.mlir
iree/compiler/Conversion/LinalgToSPIRV/test:workgroup_memory_promotion.mlir
iree/compiler/Dialect/HAL/Target/LLVM/test:binary_op.mlir
iree/compiler/Dialect/HAL/Target/LLVM/test:matmul_op.mlir
iree/compiler/Dialect/HAL/Target/VulkanSPIRV/test:smoketest.mlir
iree/compiler/Dialect/Vulkan/Utils/test:target_env_conversion.mlir

note: some lit tests will be out-dated, like all the tests under iree/test/e2e/structural/.

To Reproduce

Run the test with -iree-flow-dispatch-linalg-on-tensors -iree-codegen-spirv-experimental-linalg-on-tensors -iree-codegen-llvm-experimental-linalg-on-tensors

Activity

  1. self-assigned this
    on Mar 18, 2021
  2. added
    codegen
    compiler/dialects
    on Mar 18, 2021
  3. hanhanW commented on Apr 1, 2021

    @hanhanW
    ContributorAuthor

    The below lit tests failed if I turned Linalg on tensors on by default. I haven't looked into reasons yet. IMO, we would want to add some tests for Linalg on tensors based on below. We don't have to rewrite all the tests, this is more like clean-up and adding proper tests to me. Some tests were derived from end-to-end, and the pipeline changed. In this case, they could be outdated.

    LinalgToSPIRV

    • iree/compiler/Conversion/LinalgToSPIRV/test:convert_to_gpu.mlir.test
    • iree/compiler/Conversion/LinalgToSPIRV/test:linalg_tile_and_fuse.mlir.test
    • iree/compiler/Conversion/LinalgToSPIRV/test:pipeline_test.mlir.test
    • iree/compiler/Conversion/LinalgToSPIRV/test:pipeline_test_cooperative_mat.mlir.test
    • iree/compiler/Conversion/LinalgToSPIRV/test:workgroup_memory_promotion.mlir.test

    HAL

    • iree/compiler/Dialect/HAL/Target/LLVM/test:binary_op.mlir.test
    • iree/compiler/Dialect/HAL/Target/LLVM/test:matmul_op.mlir.test
    • iree/compiler/Dialect/HAL/Target/VulkanSPIRV/test:smoketest.mlir.test

    Vulkan Utils

    • iree/compiler/Dialect/Vulkan/Utils/test:target_env_conversion.mlir.test
  4. hanhanW commented on Apr 5, 2021

    @hanhanW
    ContributorAuthor

    @asaadaldien @MaheshRavishankar @ThomasRaoux @antiagainst could you help on some of these? I'm not familiar with all the passes/components, and could miss some cases. I think I can work on HAL and Vulkan Util tests, there won't be too many mysteries to me.

  5. antiagainst commented on Apr 6, 2021

    @antiagainst
    Member

    Thanks Hanhan! I'll take a look of the SPIR-V ones later this week.

  6. hanhanW commented on Apr 6, 2021

    @hanhanW
    ContributorAuthor

    Thanks @antiagainst , I added smoketests to HAL Targets for Linalg on tensors path in #5324 .

  7. linked a pull request that will close this issue[spirv] Delete linalg_tile_and_fuse.mlir #5590on Apr 23, 2021
  8. 2 remaining items

  9. hanhanW commented on Apr 26, 2021

    @hanhanW
    ContributorAuthor

    The rest of tests are:

    • pipeline_test_cooperative_mat.mlir
    • convert_to_gpu.mlir

    After that we can fully delete -iree-codegen-spirv-experimental-linalg-on-tensors and the CodeGen option.

  10. hanhanW commented on Apr 26, 2021

    @hanhanW
    ContributorAuthor

    I had a version for pipeline_test_cooperative_mat.mlir (which tests CooperativeMatrix + f16) but hit issues like:

    iree/compiler/Conversion/LinalgToSPIRV/test/pipeline_test_cooperative_mat.mlir:1 offset :69:19: error: 'vector.transfer_read' op requires the bitwidth of the minor 1-D vector to be an integral multiple of the bitwidth of the minor 1-D vector of the source
                %17 = linalg.matmul {__internal_linalg_transform__ = "workgroup"} ins(%8, %10 : tensor<?x4096xf16>, tensor<4096x?xf16>) outs(%16 : tensor<?x?xf16>) -> tensor<?x?xf16>
    

    https://gist.githubusercontent.com/hanhanW/0c56446ba41b3184add1bc671bf60bfa/raw

    @ThomasRaoux did I do something wrong? Is it a bug? If so, could you help on fixing it?

  11. antiagainst commented on Apr 26, 2021

    @antiagainst
    Member

    Cooperative matrix functionalities needs more care to be ported. I've a patch ready. Sending out soon.

  12. antiagainst commented on Apr 26, 2021

    @antiagainst
    Member

    #5607 for cooperative matrix stuff.

  13. antiagainst commented on Apr 26, 2021

    @antiagainst
    Member

    #5609 and #5610 should migrate the rest SPIR-V tests in preparation for removing the old path.

  14. linked a pull request that will close this issue[spirv] Delete linalg_tile_and_fuse.mlir #5590on Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

codegencompiler/dialects

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions