[Mlir-commits] [mlir] 6f4f9e3 - [mlir][spirv] Add a test covering load/store with memory operands

Lei Zhang llvmlistbot at llvm.org
Mon Aug 15 14:48:47 PDT 2022


Author: Lei Zhang
Date: 2022-08-15T17:48:33-04:00
New Revision: 6f4f9e316c9c8c873eb930e24d2e66b204d3e3da

URL: https://github.com/llvm/llvm-project/commit/6f4f9e316c9c8c873eb930e24d2e66b204d3e3da
DIFF: https://github.com/llvm/llvm-project/commit/6f4f9e316c9c8c873eb930e24d2e66b204d3e3da.diff

LOG: [mlir][spirv] Add a test covering load/store with memory operands

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D131904

Added: 
    

Modified: 
    mlir/test/Target/SPIRV/memory-ops.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/Target/SPIRV/memory-ops.mlir b/mlir/test/Target/SPIRV/memory-ops.mlir
index 8730044d769e2..ae6cb9cd5a5c6 100644
--- a/mlir/test/Target/SPIRV/memory-ops.mlir
+++ b/mlir/test/Target/SPIRV/memory-ops.mlir
@@ -1,15 +1,25 @@
 // RUN: mlir-translate -test-spirv-roundtrip -split-input-file %s | FileCheck %s
 
-// CHECK:           spv.func {{@.*}}([[ARG1:%.*]]: !spv.ptr<f32, Input>, [[ARG2:%.*]]: !spv.ptr<f32, Output>) "None" {
-// CHECK-NEXT:        [[VALUE:%.*]] = spv.Load "Input" [[ARG1]] : f32
-// CHECK-NEXT:        spv.Store "Output" [[ARG2]], [[VALUE]] : f32
 
 spv.module Logical GLSL450 requires #spv.vce<v1.0, [Shader], []> {
+  // CHECK-LABEL: spv.func @load_store
+  //  CHECK-SAME: ([[ARG1:%.*]]: !spv.ptr<f32, Input>, [[ARG2:%.*]]: !spv.ptr<f32, Output>)
   spv.func @load_store(%arg0 : !spv.ptr<f32, Input>, %arg1 : !spv.ptr<f32, Output>) "None" {
+    // CHECK-NEXT: [[VALUE:%.*]] = spv.Load "Input" [[ARG1]] : f32
     %1 = spv.Load "Input" %arg0 : f32
+    // CHECK-NEXT: spv.Store "Output" [[ARG2]], [[VALUE]] : f32
     spv.Store "Output" %arg1, %1 : f32
     spv.Return
   }
+
+  // CHECK-LABEL: spv.func @load_store_memory_operands
+  spv.func @load_store_memory_operands(%arg0 : !spv.ptr<f32, Input>, %arg1 : !spv.ptr<f32, Output>) "None" {
+    // CHECK: spv.Load "Input" %{{.+}} ["Volatile|Aligned", 4] : f32
+    %1 = spv.Load "Input" %arg0 ["Volatile|Aligned", 4]: f32
+    // CHECK: spv.Store "Output" %{{.+}}, %{{.+}} ["Volatile|Aligned", 4] : f32
+    spv.Store "Output" %arg1, %1 ["Volatile|Aligned", 4]: f32
+    spv.Return
+  }
 }
 
 // -----


        


More information about the Mlir-commits mailing list