llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[mlir][vector][spirv] Support lowering multi-dimensional vector.from_elements to SPIR-V

Open yangtetris opened this issue 1 year ago • 4 comments

Background

https://github.com/llvm/llvm-project/pull/151175 supports lowering multi-dimensional vector.from_elements operations by first unrolling them to 1-D from_elements operations and then applying the 1-D vector.from_elements lowering pattern. https://github.com/llvm/llvm-project/pull/142944 introduces a new canonicalization pattern that compresses a series of vector.insert operations into a single vector.from_elements operation.

Issues

The above two PRs work well for the LLVM backend, but, as this discussion said, we are uncertain whether UnrollFromElements work correctly for the SPIR-V backend. I attempted to verify this myself, but the lack of SPIR-V knowledge prevents me from making meaningful progress.

I would greatly appreciate if SPIR-V experts could help check whether the current implementation works correctly. If it doesn't work, please help implement the necessary SPIR-V lowering support. Thanks a lot.

yangtetris avatar Aug 26 '25 07:08 yangtetris

@llvm/issue-subscribers-mlir

Author: Yang Bai (yangtetris)

### Background

https://github.com/llvm/llvm-project/pull/151175 supports lowering multi-dimensional vector.from_elements operations by first unrolling them to 1-D from_elements operations and then applying the 1-D vector.from_elements lowering pattern. https://github.com/llvm/llvm-project/pull/142944 introduces a new canonicalization pattern that compresses a series of vector.insert operations into a single vector.from_elements operation.

Issues

The above two PRs work well for the LLVM backend, but, as this discussion said, we are uncertain whether UnrollFromElements work correctly for the SPIR-V backend. I attempted to verify this myself, but the lack of SPIR-V knowledge prevents me from making meaningful progress.

I would greatly appreciate if SPIR-V experts could help check whether the current implementation works correctly. If it doesn't work, please help implement the necessary SPIR-V lowering support. Thanks a lot.

llvmbot avatar Aug 26 '25 07:08 llvmbot

CC @kuhar

yangtetris avatar Aug 26 '25 08:08 yangtetris

@amd-eochoalo can you take a look?

kuhar avatar Aug 26 '25 14:08 kuhar

@llvm/issue-subscribers-mlir-spirv

Author: Yang Bai (yangtetris)

### Background

https://github.com/llvm/llvm-project/pull/151175 supports lowering multi-dimensional vector.from_elements operations by first unrolling them to 1-D from_elements operations and then applying the 1-D vector.from_elements lowering pattern. https://github.com/llvm/llvm-project/pull/142944 introduces a new canonicalization pattern that compresses a series of vector.insert operations into a single vector.from_elements operation.

Issues

The above two PRs work well for the LLVM backend, but, as this discussion said, we are uncertain whether UnrollFromElements work correctly for the SPIR-V backend. I attempted to verify this myself, but the lack of SPIR-V knowledge prevents me from making meaningful progress.

I would greatly appreciate if SPIR-V experts could help check whether the current implementation works correctly. If it doesn't work, please help implement the necessary SPIR-V lowering support. Thanks a lot.

llvmbot avatar Aug 26 '25 14:08 llvmbot