Skip to content
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

[mlir][spirv] Add an argmax integration test with mlir-vulkan-runner #106426

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

angelz913
Copy link
Contributor

@angelz913 angelz913 commented Aug 28, 2024

This PR adds an integration test for an argmax kernel with mlir-vulkan-runner. This test exercises the convert-to-spirv pass (landed in #95942) and demonstrates that we can use SPIR-V ops as "intrinsics" among higher-level dialects.

The support for index dialect in mlir-vulkan-runner is also added.

@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir:spirv mlir labels Aug 28, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-core

Author: Angel Zhang (angelz913)

Changes

This PR adds an integration test for an argmax kernel with mlir-vulkan-runner. Support for index dialect in mlir-vulkan-runner is also added.


Full diff: https://github.com/llvm/llvm-project/pull/106426.diff

3 Files Affected:

  • (added) mlir/test/mlir-vulkan-runner/argmax.mlir (+102)
  • (modified) mlir/tools/mlir-vulkan-runner/CMakeLists.txt (+1)
  • (modified) mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp (+3-1)
diff --git a/mlir/test/mlir-vulkan-runner/argmax.mlir b/mlir/test/mlir-vulkan-runner/argmax.mlir
new file mode 100644
index 00000000000000..8141721fcd5e03
--- /dev/null
+++ b/mlir/test/mlir-vulkan-runner/argmax.mlir
@@ -0,0 +1,102 @@
+// RUN: mlir-vulkan-runner %s \
+// RUN:  --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils \
+// RUN:  --entry-point-result=void | FileCheck %s
+
+// CHECK: [15]
+module attributes {
+  gpu.container_module,
+  spirv.target_env = #spirv.target_env<
+    #spirv.vce<v1.3, [Shader, Groups, GroupNonUniformArithmetic, GroupNonUniformBallot], [SPV_KHR_storage_buffer_storage_class]>, #spirv.resource_limits<>>
+} {
+  gpu.module @kernels {
+    gpu.func @kernel_argmax(%input : memref<128xi32>, %output : memref<1xi32>, %total_count_buf : memref<1xi32>) kernel
+      attributes {spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [32, 1, 1]>} {
+      %idx0 = arith.constant 0 : index
+      %idx1 = arith.constant 1 : index
+
+      %total_count = memref.load %total_count_buf[%idx0] : memref<1xi32>
+      %lane_count_idx = gpu.subgroup_size : index
+      %lane_count_i32 = index.castu %lane_count_idx : index to i32
+      %lane_id_idx = gpu.thread_id x
+      %lane_id_i32 = index.castu %lane_id_idx : index to i32
+      %lane_res_init = arith.constant 0 : i32
+      %lane_max_init = memref.load %input[%lane_id_idx] : memref<128xi32>
+      %num_batches_i32 = arith.divui %total_count, %lane_count_i32 : i32
+      %num_batches_idx = index.castu %num_batches_i32 : i32 to index
+
+      %lane_res, %lane_max = scf.for %iter = %idx1 to %num_batches_idx step %idx1
+      iter_args(%lane_res_iter = %lane_res_init, %lane_max_iter = %lane_max_init) -> (i32, i32) {
+        %iter_i32 = index.castu %iter : index to i32
+        %mul = arith.muli %lane_count_i32, %iter_i32 : i32
+        %idx_i32 = arith.addi %mul, %lane_id_i32 : i32
+        %idx = index.castu %idx_i32 : i32 to index
+        %elem = memref.load %input[%idx] : memref<128xi32>
+        %gt = arith.cmpi sgt, %elem, %lane_max_iter : i32
+        %lane_res_next = arith.select %gt, %idx_i32, %lane_res_iter : i32
+        %lane_max_next = arith.select %gt, %elem, %lane_max_iter : i32
+        scf.yield %lane_res_next, %lane_max_next : i32, i32
+      }
+
+      %subgroup_max = gpu.subgroup_reduce maxsi %lane_max : (i32) -> (i32)
+      %eq = arith.cmpi eq, %lane_max, %subgroup_max : i32
+      %ballot = spirv.GroupNonUniformBallot <Subgroup> %eq : vector<4xi32>
+      %lsb = spirv.GroupNonUniformBallotFindLSB <Subgroup> %ballot : vector<4xi32>, i32
+      %cond = arith.cmpi eq, %lsb, %lane_id_i32 : i32
+
+      scf.if %cond {
+        memref.store %lane_res, %output[%idx0] : memref<1xi32>
+      }
+
+      gpu.return
+    }
+  }
+
+  func.func @main() {
+    // Allocate 3 buffers.
+    %in_buf = memref.alloc() : memref<128xi32>
+    %out_buf = memref.alloc() : memref<1xi32>
+    %total_count_buf = memref.alloc() : memref<1xi32>
+
+    // Constants.
+    %cst0 = arith.constant 0 : i32
+    %idx0 = arith.constant 0 : index
+    %idx1 = arith.constant 1 : index
+    %idx16 = arith.constant 16 : index
+    %idx32 = arith.constant 32 : index
+    %idx48 = arith.constant 48 : index
+    %idx64 = arith.constant 64 : index
+    %idx80 = arith.constant 80 : index
+    %idx96 = arith.constant 96 : index
+    %idx112 = arith.constant 112 : index
+
+    // Initialize input buffer.
+    %in_vec = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx0] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx16] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx32] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx48] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx64] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx80] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx96] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx112] : memref<128xi32>, vector<16xi32>
+
+    // Initialize output buffer.
+    %out_buf2 = memref.cast %out_buf : memref<1xi32> to memref<?xi32>
+    call @fillResource1DInt(%out_buf2, %cst0) : (memref<?xi32>, i32) -> ()
+
+    // Total number of scalars.
+    %total_count = arith.constant 128 : i32
+    %total_count_buf2 = memref.cast %total_count_buf : memref<1xi32> to memref<?xi32>
+    call @fillResource1DInt(%total_count_buf2, %total_count) : (memref<?xi32>, i32) -> ()
+
+    // Launch kernel function and print output.
+    gpu.launch_func @kernels::@kernel_argmax
+        blocks in (%idx1, %idx1, %idx1) threads in (%idx32, %idx1, %idx1)
+        args(%in_buf : memref<128xi32>, %out_buf : memref<1xi32>, %total_count_buf : memref<1xi32>)
+    %out_buf3 = memref.cast %out_buf2 : memref<?xi32> to memref<*xi32>
+    call @printMemrefI32(%out_buf3) : (memref<*xi32>) -> ()
+    return
+  }
+  func.func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
+  func.func private @printMemrefI32(%ptr : memref<*xi32>)
+}
diff --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index 26d6caacb0a7b1..36ec946b168715 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -57,6 +57,7 @@ if (MLIR_ENABLE_VULKAN_RUNNER)
     MLIRExecutionEngine
     MLIRFuncDialect
     MLIRGPUDialect
+    MLIRIndexDialect
     MLIRIR
     MLIRJitRunner
     MLIRLLVMDialect
diff --git a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
index 2dd539ef83481f..bd34165574c8d2 100644
--- a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
+++ b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
@@ -24,6 +24,7 @@
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/GPU/Transforms/Passes.h"
+#include "mlir/Dialect/Index/IR/IndexDialect.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -110,7 +111,8 @@ int main(int argc, char **argv) {
   registry.insert<mlir::arith::ArithDialect, mlir::LLVM::LLVMDialect,
                   mlir::gpu::GPUDialect, mlir::spirv::SPIRVDialect,
                   mlir::scf::SCFDialect, mlir::func::FuncDialect,
-                  mlir::memref::MemRefDialect, mlir::vector::VectorDialect>();
+                  mlir::memref::MemRefDialect, mlir::vector::VectorDialect,
+                  mlir::index::IndexDialect>();
   mlir::registerBuiltinDialectTranslation(registry);
   mlir::registerLLVMDialectTranslation(registry);
 

@llvmbot
Copy link
Member

llvmbot commented Aug 28, 2024

@llvm/pr-subscribers-mlir-spirv

Author: Angel Zhang (angelz913)

Changes

This PR adds an integration test for an argmax kernel with mlir-vulkan-runner. Support for index dialect in mlir-vulkan-runner is also added.


Full diff: https://github.com/llvm/llvm-project/pull/106426.diff

3 Files Affected:

  • (added) mlir/test/mlir-vulkan-runner/argmax.mlir (+102)
  • (modified) mlir/tools/mlir-vulkan-runner/CMakeLists.txt (+1)
  • (modified) mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp (+3-1)
diff --git a/mlir/test/mlir-vulkan-runner/argmax.mlir b/mlir/test/mlir-vulkan-runner/argmax.mlir
new file mode 100644
index 00000000000000..8141721fcd5e03
--- /dev/null
+++ b/mlir/test/mlir-vulkan-runner/argmax.mlir
@@ -0,0 +1,102 @@
+// RUN: mlir-vulkan-runner %s \
+// RUN:  --shared-libs=%vulkan-runtime-wrappers,%mlir_runner_utils \
+// RUN:  --entry-point-result=void | FileCheck %s
+
+// CHECK: [15]
+module attributes {
+  gpu.container_module,
+  spirv.target_env = #spirv.target_env<
+    #spirv.vce<v1.3, [Shader, Groups, GroupNonUniformArithmetic, GroupNonUniformBallot], [SPV_KHR_storage_buffer_storage_class]>, #spirv.resource_limits<>>
+} {
+  gpu.module @kernels {
+    gpu.func @kernel_argmax(%input : memref<128xi32>, %output : memref<1xi32>, %total_count_buf : memref<1xi32>) kernel
+      attributes {spirv.entry_point_abi = #spirv.entry_point_abi<workgroup_size = [32, 1, 1]>} {
+      %idx0 = arith.constant 0 : index
+      %idx1 = arith.constant 1 : index
+
+      %total_count = memref.load %total_count_buf[%idx0] : memref<1xi32>
+      %lane_count_idx = gpu.subgroup_size : index
+      %lane_count_i32 = index.castu %lane_count_idx : index to i32
+      %lane_id_idx = gpu.thread_id x
+      %lane_id_i32 = index.castu %lane_id_idx : index to i32
+      %lane_res_init = arith.constant 0 : i32
+      %lane_max_init = memref.load %input[%lane_id_idx] : memref<128xi32>
+      %num_batches_i32 = arith.divui %total_count, %lane_count_i32 : i32
+      %num_batches_idx = index.castu %num_batches_i32 : i32 to index
+
+      %lane_res, %lane_max = scf.for %iter = %idx1 to %num_batches_idx step %idx1
+      iter_args(%lane_res_iter = %lane_res_init, %lane_max_iter = %lane_max_init) -> (i32, i32) {
+        %iter_i32 = index.castu %iter : index to i32
+        %mul = arith.muli %lane_count_i32, %iter_i32 : i32
+        %idx_i32 = arith.addi %mul, %lane_id_i32 : i32
+        %idx = index.castu %idx_i32 : i32 to index
+        %elem = memref.load %input[%idx] : memref<128xi32>
+        %gt = arith.cmpi sgt, %elem, %lane_max_iter : i32
+        %lane_res_next = arith.select %gt, %idx_i32, %lane_res_iter : i32
+        %lane_max_next = arith.select %gt, %elem, %lane_max_iter : i32
+        scf.yield %lane_res_next, %lane_max_next : i32, i32
+      }
+
+      %subgroup_max = gpu.subgroup_reduce maxsi %lane_max : (i32) -> (i32)
+      %eq = arith.cmpi eq, %lane_max, %subgroup_max : i32
+      %ballot = spirv.GroupNonUniformBallot <Subgroup> %eq : vector<4xi32>
+      %lsb = spirv.GroupNonUniformBallotFindLSB <Subgroup> %ballot : vector<4xi32>, i32
+      %cond = arith.cmpi eq, %lsb, %lane_id_i32 : i32
+
+      scf.if %cond {
+        memref.store %lane_res, %output[%idx0] : memref<1xi32>
+      }
+
+      gpu.return
+    }
+  }
+
+  func.func @main() {
+    // Allocate 3 buffers.
+    %in_buf = memref.alloc() : memref<128xi32>
+    %out_buf = memref.alloc() : memref<1xi32>
+    %total_count_buf = memref.alloc() : memref<1xi32>
+
+    // Constants.
+    %cst0 = arith.constant 0 : i32
+    %idx0 = arith.constant 0 : index
+    %idx1 = arith.constant 1 : index
+    %idx16 = arith.constant 16 : index
+    %idx32 = arith.constant 32 : index
+    %idx48 = arith.constant 48 : index
+    %idx64 = arith.constant 64 : index
+    %idx80 = arith.constant 80 : index
+    %idx96 = arith.constant 96 : index
+    %idx112 = arith.constant 112 : index
+
+    // Initialize input buffer.
+    %in_vec = arith.constant dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]> : vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx0] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx16] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx32] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx48] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx64] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx80] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx96] : memref<128xi32>, vector<16xi32>
+    vector.store %in_vec, %in_buf[%idx112] : memref<128xi32>, vector<16xi32>
+
+    // Initialize output buffer.
+    %out_buf2 = memref.cast %out_buf : memref<1xi32> to memref<?xi32>
+    call @fillResource1DInt(%out_buf2, %cst0) : (memref<?xi32>, i32) -> ()
+
+    // Total number of scalars.
+    %total_count = arith.constant 128 : i32
+    %total_count_buf2 = memref.cast %total_count_buf : memref<1xi32> to memref<?xi32>
+    call @fillResource1DInt(%total_count_buf2, %total_count) : (memref<?xi32>, i32) -> ()
+
+    // Launch kernel function and print output.
+    gpu.launch_func @kernels::@kernel_argmax
+        blocks in (%idx1, %idx1, %idx1) threads in (%idx32, %idx1, %idx1)
+        args(%in_buf : memref<128xi32>, %out_buf : memref<1xi32>, %total_count_buf : memref<1xi32>)
+    %out_buf3 = memref.cast %out_buf2 : memref<?xi32> to memref<*xi32>
+    call @printMemrefI32(%out_buf3) : (memref<*xi32>) -> ()
+    return
+  }
+  func.func private @fillResource1DInt(%0 : memref<?xi32>, %1 : i32)
+  func.func private @printMemrefI32(%ptr : memref<*xi32>)
+}
diff --git a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
index 26d6caacb0a7b1..36ec946b168715 100644
--- a/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
+++ b/mlir/tools/mlir-vulkan-runner/CMakeLists.txt
@@ -57,6 +57,7 @@ if (MLIR_ENABLE_VULKAN_RUNNER)
     MLIRExecutionEngine
     MLIRFuncDialect
     MLIRGPUDialect
+    MLIRIndexDialect
     MLIRIR
     MLIRJitRunner
     MLIRLLVMDialect
diff --git a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
index 2dd539ef83481f..bd34165574c8d2 100644
--- a/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
+++ b/mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
@@ -24,6 +24,7 @@
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/Dialect/GPU/IR/GPUDialect.h"
 #include "mlir/Dialect/GPU/Transforms/Passes.h"
+#include "mlir/Dialect/Index/IR/IndexDialect.h"
 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
 #include "mlir/Dialect/LLVMIR/Transforms/RequestCWrappers.h"
 #include "mlir/Dialect/MemRef/IR/MemRef.h"
@@ -110,7 +111,8 @@ int main(int argc, char **argv) {
   registry.insert<mlir::arith::ArithDialect, mlir::LLVM::LLVMDialect,
                   mlir::gpu::GPUDialect, mlir::spirv::SPIRVDialect,
                   mlir::scf::SCFDialect, mlir::func::FuncDialect,
-                  mlir::memref::MemRefDialect, mlir::vector::VectorDialect>();
+                  mlir::memref::MemRefDialect, mlir::vector::VectorDialect,
+                  mlir::index::IndexDialect>();
   mlir::registerBuiltinDialectTranslation(registry);
   mlir::registerLLVMDialectTranslation(registry);
 

Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add to the PR description some more detailed motivation. What does this test exercise that is not already covered by the other tests?

@angelz913
Copy link
Contributor Author

Could you add to the PR description some more detailed motivation. What does this test exercise that is not already covered by the other tests?

Updated PR description

@kuhar kuhar requested a review from Hardcode84 August 28, 2024 18:20
@angelz913 angelz913 force-pushed the convert-to-spirv-argmax-e2e branch from 94cbf47 to 86afde8 Compare August 28, 2024 18:42
Copy link
Member

@kuhar kuhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@angelz913 angelz913 force-pushed the convert-to-spirv-argmax-e2e branch from 86afde8 to 85609d0 Compare August 28, 2024 19:18
@angelz913 angelz913 force-pushed the convert-to-spirv-argmax-e2e branch from 85609d0 to 8e82754 Compare August 28, 2024 19:57
@llvmbot llvmbot added the bazel "Peripheral" support tier build system: utils/bazel label Aug 28, 2024
@kuhar kuhar merged commit 17b7a9d into llvm:main Aug 28, 2024
7 of 8 checks passed
@angelz913 angelz913 deleted the convert-to-spirv-argmax-e2e branch August 28, 2024 20:33
@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 28, 2024

LLVM Buildbot has detected a new failure on builder mlir-nvidia running on mlir-nvidia while building mlir,utils at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/138/builds/2853

Here is the relevant piece of the build log for the reference
Step 6 (test-build-check-mlir-build-only-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: mlir-vulkan-runner/argmax.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
mlir-vulkan-runner /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir   --shared-libs=/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib/libvulkan-runtime-wrappers.so,/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib/libmlir_runner_utils.so   --entry-point-result=void | /vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir
# executed command: mlir-vulkan-runner /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir --shared-libs=/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib/libvulkan-runtime-wrappers.so,/vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/lib/libmlir_runner_utils.so --entry-point-result=void
# executed command: /vol/worker/mlir-nvidia/mlir-nvidia/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir
# .---command stderr------------
# | /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir:12:11: error: CHECK: expected string not found in input
# | // CHECK: [15]
# |           ^
# | <stdin>:1:1: note: scanning from here
# | Compute shader execution time: 5.86us
# | ^
# | <stdin>:4:68: note: possible intended match here
# | Unranked Memref base@ = 0x59d5723da830 rank = 1 offset = 0 sizes = [1] strides = [1] data = 
# |                                                                    ^
# | 
# | Input file: <stdin>
# | Check file: /vol/worker/mlir-nvidia/mlir-nvidia/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: Compute shader execution time: 5.86us 
# | check:12'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2: Command buffer submit time: 7us 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3: Wait idle time: 51us 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~
# |             4: Unranked Memref base@ = 0x59d5723da830 rank = 1 offset = 0 sizes = [1] strides = [1] data =  
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:12'1                                                                        ?                          possible intended match
# |             5: [0] 
# | check:12'0     ~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Aug 28, 2024

LLVM Buildbot has detected a new failure on builder mlir-nvidia-gcc7 running on mlir-nvidia while building mlir,utils at step 6 "test-build-check-mlir-build-only-check-mlir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/2781

Here is the relevant piece of the build log for the reference
Step 6 (test-build-check-mlir-build-only-check-mlir) failure: test (failure)
******************** TEST 'MLIR :: mlir-vulkan-runner/argmax.mlir' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
mlir-vulkan-runner /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir   --shared-libs=/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/libvulkan-runtime-wrappers.so,/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/libmlir_runner_utils.so   --entry-point-result=void | /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir
# executed command: mlir-vulkan-runner /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir --shared-libs=/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/libvulkan-runtime-wrappers.so,/vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/lib/libmlir_runner_utils.so --entry-point-result=void
# executed command: /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.obj/bin/FileCheck /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir
# .---command stderr------------
# | /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir:12:11: error: CHECK: expected string not found in input
# | // CHECK: [15]
# |           ^
# | <stdin>:1:1: note: scanning from here
# | Compute shader execution time: 5.57us
# | ^
# | <stdin>:4:68: note: possible intended match here
# | Unranked Memref base@ = 0x58eae6a5a5f0 rank = 1 offset = 0 sizes = [1] strides = [1] data = 
# |                                                                    ^
# | 
# | Input file: <stdin>
# | Check file: /vol/worker/mlir-nvidia/mlir-nvidia-gcc7/llvm.src/mlir/test/mlir-vulkan-runner/argmax.mlir
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: Compute shader execution time: 5.57us 
# | check:12'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# |             2: Command buffer submit time: 13us 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |             3: Wait idle time: 67us 
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~
# |             4: Unranked Memref base@ = 0x58eae6a5a5f0 rank = 1 offset = 0 sizes = [1] strides = [1] data =  
# | check:12'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | check:12'1                                                                        ?                          possible intended match
# |             5: [0] 
# | check:12'0     ~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************


5c4lar pushed a commit to 5c4lar/llvm-project that referenced this pull request Aug 29, 2024
llvm#106426)

This PR adds an integration test for an argmax kernel with
`mlir-vulkan-runner`. This test exercises the `convert-to-spirv` pass
(landed in llvm#95942) and demonstrates that we can use SPIR-V ops as
"intrinsics" among higher-level dialects.

The support for `index` dialect in `mlir-vulkan-runner` is also added.
5c4lar pushed a commit to 5c4lar/llvm-project that referenced this pull request Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bazel "Peripheral" support tier build system: utils/bazel mlir:core MLIR Core Infrastructure mlir:spirv mlir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants