// RUN: mlir-translate -split-input-file -test-spirv-roundtrip %s | FileCheck %s spv.module Logical GLSL450 requires #spv.vce { // CHECK-LABEL: @matrix_access_chain spv.func @matrix_access_chain(%arg0 : !spv.ptr>, Function>, %arg1 : i32) -> !spv.ptr, Function> "None" { // CHECK: {{%.*}} = spv.AccessChain {{%.*}}[{{%.*}}] : !spv.ptr>, Function> %0 = spv.AccessChain %arg0[%arg1] : !spv.ptr>,Function>, i32 spv.ReturnValue %0 : !spv.ptr, Function> } // CHECK-LABEL: @matrix_times_scalar_1 spv.func @matrix_times_scalar_1(%arg0 : !spv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> !spv.matrix<3 x vector<3xf32>> "None" { // CHECK: {{%.*}} = spv.MatrixTimesScalar {{%.*}}, {{%.*}} : !spv.matrix<3 x vector<3xf32>>, f32 -> !spv.matrix<3 x vector<3xf32>> %result = spv.MatrixTimesScalar %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, f32 -> !spv.matrix<3 x vector<3xf32>> spv.ReturnValue %result : !spv.matrix<3 x vector<3xf32>> } // CHECK-LABEL: @matrix_times_scalar_2 spv.func @matrix_times_scalar_2(%arg0 : !spv.matrix<3 x vector<3xf16>>, %arg1 : f16) -> !spv.matrix<3 x vector<3xf16>> "None" { // CHECK: {{%.*}} = spv.MatrixTimesScalar {{%.*}}, {{%.*}} : !spv.matrix<3 x vector<3xf16>>, f16 -> !spv.matrix<3 x vector<3xf16>> %result = spv.MatrixTimesScalar %arg0, %arg1 : !spv.matrix<3 x vector<3xf16>>, f16 -> !spv.matrix<3 x vector<3xf16>> spv.ReturnValue %result : !spv.matrix<3 x vector<3xf16>> } // CHECK-LABEL: @matrix_transpose_1 spv.func @matrix_transpose_1(%arg0 : !spv.matrix<3 x vector<2xf32>>) -> !spv.matrix<2 x vector<3xf32>> "None" { // CHECK: {{%.*}} = spv.Transpose {{%.*}} : !spv.matrix<3 x vector<2xf32>> -> !spv.matrix<2 x vector<3xf32>> %result = spv.Transpose %arg0 : !spv.matrix<3 x vector<2xf32>> -> !spv.matrix<2 x vector<3xf32>> spv.ReturnValue %result : !spv.matrix<2 x vector<3xf32>> } // CHECK-LABEL: @matrix_times_matrix_1 spv.func @matrix_times_matrix_1(%arg0: !spv.matrix<3 x vector<3xf32>>, %arg1: !spv.matrix<3 x vector<3xf32>>) -> !spv.matrix<3 x vector<3xf32>> "None"{ // CHECK: {{%.*}} = spv.MatrixTimesMatrix {{%.*}}, {{%.*}} : !spv.matrix<3 x vector<3xf32>>, !spv.matrix<3 x vector<3xf32>> -> !spv.matrix<3 x vector<3xf32>> %result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<3xf32>>, !spv.matrix<3 x vector<3xf32>> -> !spv.matrix<3 x vector<3xf32>> spv.ReturnValue %result : !spv.matrix<3 x vector<3xf32>> } // CHECK-LABEL: @matrix_times_matrix_2 spv.func @matrix_times_matrix_2(%arg0: !spv.matrix<3 x vector<2xf32>>, %arg1: !spv.matrix<2 x vector<3xf32>>) -> !spv.matrix<2 x vector<2xf32>> "None"{ // CHECK: {{%.*}} = spv.MatrixTimesMatrix {{%.*}}, {{%.*}} : !spv.matrix<3 x vector<2xf32>>, !spv.matrix<2 x vector<3xf32>> -> !spv.matrix<2 x vector<2xf32>> %result = spv.MatrixTimesMatrix %arg0, %arg1 : !spv.matrix<3 x vector<2xf32>>, !spv.matrix<2 x vector<3xf32>> -> !spv.matrix<2 x vector<2xf32>> spv.ReturnValue %result : !spv.matrix<2 x vector<2xf32>> } } // ----- spv.module Logical GLSL450 requires #spv.vce { // CHECK: spv.globalVariable {{@.*}} : !spv.ptr>, StorageBuffer> spv.globalVariable @var0 : !spv.ptr>, StorageBuffer> // CHECK: spv.globalVariable {{@.*}} : !spv.ptr>, StorageBuffer> spv.globalVariable @var1 : !spv.ptr>, StorageBuffer> // CHECK: spv.globalVariable {{@.*}} : !spv.ptr>, StorageBuffer> spv.globalVariable @var2 : !spv.ptr>, StorageBuffer> }