-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Revert "[mlir][spirv] Add integration test for vector.interleave
and vector.shuffle
"
#93732
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d `vecto…" This reverts commit c9c2444.
@llvm/pr-subscribers-mlir-spirv @llvm/pr-subscribers-mlir-gpu Author: Mehdi Amini (joker-eph) ChangesReverts llvm/llvm-project#93595 This broke the gcc-7 bot. Full diff: https://github.com/llvm/llvm-project/pull/93732.diff 3 Files Affected:
diff --git a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
index 53e73ec0d81bf..1d1db913e3df2 100644
--- a/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
+++ b/mlir/lib/Conversion/GPUToSPIRV/GPUToSPIRVPass.cpp
@@ -18,7 +18,6 @@
#include "mlir/Conversion/GPUToSPIRV/GPUToSPIRV.h"
#include "mlir/Conversion/MemRefToSPIRV/MemRefToSPIRV.h"
#include "mlir/Conversion/SCFToSPIRV/SCFToSPIRV.h"
-#include "mlir/Conversion/VectorToSPIRV/VectorToSPIRV.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
@@ -133,7 +132,6 @@ void GPUToSPIRVPass::runOnOperation() {
mlir::arith::populateArithToSPIRVPatterns(typeConverter, patterns);
populateMemRefToSPIRVPatterns(typeConverter, patterns);
populateFuncToSPIRVPatterns(typeConverter, patterns);
- populateVectorToSPIRVPatterns(typeConverter, patterns);
if (failed(applyFullConversion(gpuModule, *target, std::move(patterns))))
return signalPassFailure();
diff --git a/mlir/test/mlir-vulkan-runner/vector-interleave.mlir b/mlir/test/mlir-vulkan-runner/vector-interleave.mlir
deleted file mode 100644
index 2f5c319e2f5c5..0000000000000
--- a/mlir/test/mlir-vulkan-runner/vector-interleave.mlir
+++ /dev/null
@@ -1,53 +0,0 @@
-// RUN: mlir-vulkan-runner %s \
-// RUN: --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils \
-// RUN: --entry-point-result=void | FileCheck %s
-
-// CHECK: [0, 2, 1, 3]
-module attributes {
- gpu.container_module,
- spirv.target_env = #spirv.target_env<
- #spirv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>, #spirv.resource_limits<>>
-} {
- gpu.module @kernels {
- gpu.func @kernel_vector_interleave(%arg0 : memref<2xi32>, %arg1 : memref<2xi32>, %arg2 : memref<4xi32>)
- kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [1, 1, 1]>} {
- %c0 = arith.constant 0 : index
- %vec0 = vector.load %arg0[%c0] : memref<2xi32>, vector<2xi32>
- %vec1 = vector.load %arg1[%c0] : memref<2xi32>, vector<2xi32>
- %result = vector.interleave %vec0, %vec1 : vector<2xi32> -> vector<4xi32>
- vector.store %result, %arg2[%c0] : memref<4xi32>, vector<4xi32>
- gpu.return
- }
- }
-
- func.func @main() {
- // Allocate 3 buffers.
- %buf0 = memref.alloc() : memref<2xi32>
- %buf1 = memref.alloc() : memref<2xi32>
- %buf2 = memref.alloc() : memref<4xi32>
-
- %idx0 = arith.constant 0 : index
- %idx1 = arith.constant 1 : index
- %idx4 = arith.constant 4 : index
-
- // Initialize input buffer.
- %buf0_vals = arith.constant dense<[0, 1]> : vector<2xi32>
- %buf1_vals = arith.constant dense<[2, 3]> : vector<2xi32>
- vector.store %buf0_vals, %buf0[%idx0] : memref<2xi32>, vector<2xi32>
- vector.store %buf1_vals, %buf1[%idx0] : memref<2xi32>, vector<2xi32>
-
- // Initialize output buffer.
- %value0 = arith.constant 0 : i32
- %buf3 = memref.cast %buf2 : memref<4xi32> to memref<?xi32>
- call @fillResource1DInt(%buf3, %value0) : (memref<?xi32>, i32) -> ()
-
- gpu.launch_func @kernels::@kernel_vector_interleave
- blocks in (%idx4, %idx1, %idx1) threads in (%idx1, %idx1, %idx1)
- args(%buf0 : memref<2xi32>, %buf1 : memref<2xi32>, %buf2 : memref<4xi32>)
- %buf4 = memref.cast %buf3 : memref<?xi32> to memref<*xi32>
- call @printMemrefI32(%buf4) : (memref<*xi32>) -> ()
- return
- }
- func.func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
- func.func private @printMemrefI32(%ptr : memref<*xi32>)
-}
diff --git a/mlir/test/mlir-vulkan-runner/vector-shuffle.mlir b/mlir/test/mlir-vulkan-runner/vector-shuffle.mlir
deleted file mode 100644
index e29e054ccd46b..0000000000000
--- a/mlir/test/mlir-vulkan-runner/vector-shuffle.mlir
+++ /dev/null
@@ -1,53 +0,0 @@
-// RUN: mlir-vulkan-runner %s \
-// RUN: --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils \
-// RUN: --entry-point-result=void | FileCheck %s
-
-// CHECK: [2, 1, 3]
-module attributes {
- gpu.container_module,
- spirv.target_env = #spirv.target_env<
- #spirv.vce<v1.0, [Shader], [SPV_KHR_storage_buffer_storage_class]>, #spirv.resource_limits<>>
-} {
- gpu.module @kernels {
- gpu.func @kernel_vector_shuffle(%arg0 : memref<2xi32>, %arg1 : memref<2xi32>, %arg2 : memref<3xi32>)
- kernel attributes { spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [1, 1, 1]>} {
- %c0 = arith.constant 0 : index
- %vec0 = vector.load %arg0[%c0] : memref<2xi32>, vector<2xi32>
- %vec1 = vector.load %arg1[%c0] : memref<2xi32>, vector<2xi32>
- %result = vector.shuffle %vec0, %vec1[2, 1, 3] : vector<2xi32>, vector<2xi32>
- vector.store %result, %arg2[%c0] : memref<3xi32>, vector<3xi32>
- gpu.return
- }
- }
-
- func.func @main() {
- // Allocate 3 buffers.
- %buf0 = memref.alloc() : memref<2xi32>
- %buf1 = memref.alloc() : memref<2xi32>
- %buf2 = memref.alloc() : memref<3xi32>
-
- %idx0 = arith.constant 0 : index
- %idx1 = arith.constant 1 : index
- %idx4 = arith.constant 4 : index
-
- // Initialize input buffer
- %buf0_vals = arith.constant dense<[0, 1]> : vector<2xi32>
- %buf1_vals = arith.constant dense<[2, 3]> : vector<2xi32>
- vector.store %buf0_vals, %buf0[%idx0] : memref<2xi32>, vector<2xi32>
- vector.store %buf1_vals, %buf1[%idx0] : memref<2xi32>, vector<2xi32>
-
- // Initialize output buffer.
- %value0 = arith.constant 0 : i32
- %buf3 = memref.cast %buf2 : memref<3xi32> to memref<?xi32>
- call @fillResource1DInt(%buf3, %value0) : (memref<?xi32>, i32) -> ()
-
- gpu.launch_func @kernels::@kernel_vector_shuffle
- blocks in (%idx4, %idx1, %idx1) threads in (%idx1, %idx1, %idx1)
- args(%buf0 : memref<2xi32>, %buf1 : memref<2xi32>, %buf2 : memref<3xi32>)
- %buf4 = memref.cast %buf3 : memref<?xi32> to memref<*xi32>
- call @printMemrefI32(%buf4) : (memref<*xi32>) -> ()
- return
- }
- func.func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
- func.func private @printMemrefI32(%ptr : memref<*xi32>)
-}
|
kuhar
pushed a commit
that referenced
this pull request
Jun 3, 2024
…or.shuffle` (#93858) This PR tries to reland #93595 which was reverted in #93732 due to some issues. The original PR: - Add integration test for `vector.shuffle` and `vector.interleave` - Add `VectorToSPIRV` patterns to `GPUToSPIRVPass` Description of the issue: - #93595 (comment) - Using either `vector.load` or `vector.store` in the kernel function will cause the validation layer to report an error - Trying to bypass the issue by using `memref.load` and `memref.store` to load/store individual elements from/to the vectors, and populate the vectors using `vector.insertelement` and `vector.extractelement` instead.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reverts #93595
This broke the gcc-7 bot.