CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
235 lines
12 KiB
MLIR
235 lines
12 KiB
MLIR
// RUN: mlir-opt -allow-unregistered-dialect -split-input-file -verify-diagnostics %s | FileCheck %s
|
|
|
|
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
|
|
// CHECK-LABEL: @matrix_times_scalar_1
|
|
spirv.func @matrix_times_scalar_1(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f32) -> !spirv.matrix<3 x vector<3xf32>> "None" {
|
|
// CHECK: {{%.*}} = spirv.MatrixTimesScalar {{%.*}}, {{%.*}} : !spirv.matrix<3 x vector<3xf32>>, f32
|
|
%result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f32
|
|
spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>>
|
|
}
|
|
|
|
// CHECK-LABEL: @matrix_times_scalar_2
|
|
spirv.func @matrix_times_scalar_2(%arg0 : !spirv.coopmatrix<16x16xf16, Subgroup, MatrixA>, %arg1 : f16) -> !spirv.coopmatrix<16x16xf16, Subgroup, MatrixA> "None" {
|
|
// CHECK: {{%.*}} = spirv.MatrixTimesScalar {{%.*}}, {{%.*}} : !spirv.coopmatrix<16x16xf16, Subgroup, MatrixA>, f16
|
|
%result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.coopmatrix<16x16xf16, Subgroup, MatrixA>, f16
|
|
spirv.ReturnValue %result : !spirv.coopmatrix<16x16xf16, Subgroup, MatrixA>
|
|
}
|
|
|
|
// CHECK-LABEL: @matrix_transpose_1
|
|
spirv.func @matrix_transpose_1(%arg0 : !spirv.matrix<3 x vector<2xf32>>) -> !spirv.matrix<2 x vector<3xf32>> "None" {
|
|
// CHECK: {{%.*}} = spirv.Transpose {{%.*}} : !spirv.matrix<3 x vector<2xf32>> -> !spirv.matrix<2 x vector<3xf32>>
|
|
%result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<2xf32>> -> !spirv.matrix<2 x vector<3xf32>>
|
|
spirv.ReturnValue %result : !spirv.matrix<2 x vector<3xf32>>
|
|
}
|
|
|
|
// CHECK-LABEL: @matrix_transpose_2
|
|
spirv.func @matrix_transpose_2(%arg0 : !spirv.matrix<3 x vector<3xf32>>) -> !spirv.matrix<3 x vector<3xf32>> "None" {
|
|
// CHECK: {{%.*}} = spirv.Transpose {{%.*}} : !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>>
|
|
%result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>>
|
|
spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>>
|
|
}
|
|
|
|
// CHECK-LABEL: @matrix_times_vector_1
|
|
spirv.func @matrix_times_vector_1(%arg0: !spirv.matrix<3 x vector<4xf32>>, %arg1: vector<3xf32>) -> vector<4xf32> "None" {
|
|
// CHECK: {{%.*}} = spirv.MatrixTimesVector {{%.*}}, {{%.*}} : !spirv.matrix<3 x vector<4xf32>>, vector<3xf32> -> vector<4xf32>
|
|
%result = spirv.MatrixTimesVector %arg0, %arg1 : !spirv.matrix<3 x vector<4xf32>>, vector<3xf32> -> vector<4xf32>
|
|
spirv.ReturnValue %result : vector<4xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: @vector_times_matrix_1
|
|
spirv.func @vector_times_matrix_1(%arg0: vector<3xf32>, %arg1: !spirv.matrix<4 x vector<3xf32>>) -> vector<4xf32> "None" {
|
|
// CHECK: {{%.*}} = spirv.VectorTimesMatrix {{%.*}}, {{%.*}} : vector<3xf32>, !spirv.matrix<4 x vector<3xf32>> -> vector<4xf32>
|
|
%result = spirv.VectorTimesMatrix %arg0, %arg1 : vector<3xf32>, !spirv.matrix<4 x vector<3xf32>> -> vector<4xf32>
|
|
spirv.ReturnValue %result : vector<4xf32>
|
|
}
|
|
|
|
// CHECK-LABEL: @outer_product_1
|
|
spirv.func @outer_product_1(%arg0: vector<3xf32>, %arg1: vector<2xf32>) -> !spirv.matrix<2 x vector<3xf32>> "None" {
|
|
// CHECK: {{%.*}} = spirv.OuterProduct {{%.*}}, {{%.*}} : vector<3xf32>, vector<2xf32> -> !spirv.matrix<2 x vector<3xf32>>
|
|
%result = spirv.OuterProduct %arg0, %arg1 : vector<3xf32>, vector<2xf32> -> !spirv.matrix<2 x vector<3xf32>>
|
|
spirv.ReturnValue %result : !spirv.matrix<2 x vector<3xf32>>
|
|
}
|
|
|
|
// CHECK-LABEL: @matrix_times_matrix_1
|
|
spirv.func @matrix_times_matrix_1(%arg0: !spirv.matrix<3 x vector<3xf32>>, %arg1: !spirv.matrix<3 x vector<3xf32>>) -> !spirv.matrix<3 x vector<3xf32>> "None"{
|
|
// CHECK: {{%.*}} = spirv.MatrixTimesMatrix {{%.*}}, {{%.*}} : !spirv.matrix<3 x vector<3xf32>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>>
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>>
|
|
spirv.ReturnValue %result : !spirv.matrix<3 x vector<3xf32>>
|
|
}
|
|
|
|
// CHECK-LABEL: @matrix_times_matrix_2
|
|
spirv.func @matrix_times_matrix_2(%arg0: !spirv.matrix<3 x vector<2xf32>>, %arg1: !spirv.matrix<2 x vector<3xf32>>) -> !spirv.matrix<2 x vector<2xf32>> "None"{
|
|
// CHECK: {{%.*}} = spirv.MatrixTimesMatrix {{%.*}}, {{%.*}} : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<2 x vector<2xf32>>
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<2 x vector<2xf32>>
|
|
spirv.ReturnValue %result : !spirv.matrix<2 x vector<2xf32>>
|
|
}
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @input_type_mismatch(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f16) {
|
|
// expected-error @+1 {{op failed to verify that all of {matrix, scalar} have same element type}}
|
|
%result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f16
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @input_type_mismatch(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : f64) {
|
|
// expected-error @+1 {{op failed to verify that all of {matrix, scalar} have same element type}}
|
|
%result = spirv.MatrixTimesScalar %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, f64
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @transpose_op_shape_mismatch_1(%arg0 : !spirv.matrix<3 x vector<4xf32>>) {
|
|
// expected-error @+1 {{op failed to verify that matrix rows count matches result columns count}}
|
|
%result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<4xf32>> -> !spirv.matrix<3 x vector<3xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @transpose_op_shape_mismatch_2(%arg0 : !spirv.matrix<3 x vector<4xf32>>) {
|
|
// expected-error @+1 {{op failed to verify that matrix rows count matches result columns count}}
|
|
%result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<4xf32>> -> !spirv.matrix<2 x vector<4xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @transpose_op_type_mismatch(%arg0 : !spirv.matrix<3 x vector<4xf32>>) {
|
|
// expected-error @+1 {{op failed to verify that all of {matrix, result} have same element type}}
|
|
%result = spirv.Transpose %arg0 : !spirv.matrix<3 x vector<4xf32>> -> !spirv.matrix<4 x vector<3xf16>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_matrix_invalid_input_shape_1(%arg0 : !spirv.matrix<3 x vector<2xf32>>, %arg1 : !spirv.matrix<2 x vector<3xf32>>){
|
|
// expected-error @+1 {{op failed to verify that rightmatrix columns count matches result columns count}}
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<3 x vector<2xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_matrix_invalid_input_shape_2(%arg0 : !spirv.matrix<3 x vector<2xf32>>, %arg1 : !spirv.matrix<2 x vector<3xf32>>){
|
|
// expected-error @+1 {{op failed to verify that leftmatrix rows count matches result rows count}}
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<3xf32>> -> !spirv.matrix<2 x vector<3xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_matrix_inputs_shape_mismatch(%arg0 : !spirv.matrix<3 x vector<2xf32>>, %arg1 : !spirv.matrix<2 x vector<2xf32>>){
|
|
// expected-error @+1 {{op failed to verify that leftmatrix columns count matches rightmatrix rows count}}
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<2xf32>>, !spirv.matrix<2 x vector<2xf32>> -> !spirv.matrix<2 x vector<2xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_matrix_component_type_mismatch_1(%arg0 : !spirv.matrix<3 x vector<3xf32>>, %arg1 : !spirv.matrix<3x vector<3xf32>>){
|
|
// expected-error @+1 {{op failed to verify that all of {leftmatrix, rightmatrix, result} have same element type}}
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf32>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf64>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_matrix_component_type_mismatch_2(%arg0 : !spirv.matrix<3 x vector<3xf64>>, %arg1 : !spirv.matrix<3x vector<3xf32>>){
|
|
// expected-error @+1 {{op failed to verify that all of {leftmatrix, rightmatrix, result} have same element type}}
|
|
%result = spirv.MatrixTimesMatrix %arg0, %arg1 : !spirv.matrix<3 x vector<3xf64>>, !spirv.matrix<3 x vector<3xf32>> -> !spirv.matrix<3 x vector<3xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_vector_element_type_mismatch(%arg0: !spirv.matrix<4 x vector<3xf32>>, %arg1: vector<4xf16>) {
|
|
// expected-error @+1 {{op failed to verify that all of {vector, result} have same element type}}
|
|
%result = spirv.MatrixTimesVector %arg0, %arg1 : !spirv.matrix<4 x vector<3xf32>>, vector<4xf16> -> vector<3xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_vector_element_type_mismatch(%arg0: !spirv.matrix<4 x vector<3xf16>>, %arg1: vector<4xf32>) {
|
|
// expected-error @+1 {{op failed to verify that all of {matrix, result} have same element type}}
|
|
%result = spirv.MatrixTimesVector %arg0, %arg1 : !spirv.matrix<4 x vector<3xf16>>, vector<4xf32> -> vector<3xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_vector_row_mismatch(%arg0: !spirv.matrix<4 x vector<3xf32>>, %arg1: vector<4xf32>) {
|
|
// expected-error @+1 {{op failed to verify that matrix rows count matches result elements count}}
|
|
%result = spirv.MatrixTimesVector %arg0, %arg1 : !spirv.matrix<4 x vector<3xf32>>, vector<4xf32> -> vector<4xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @matrix_times_vector_column_mismatch(%arg0: !spirv.matrix<4 x vector<3xf32>>, %arg1: vector<3xf32>) {
|
|
// expected-error @+1 {{op failed to verify that matrix columns count matches vector elements count}}
|
|
%result = spirv.MatrixTimesVector %arg0, %arg1 : !spirv.matrix<4 x vector<3xf32>>, vector<3xf32> -> vector<3xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @vector_times_matrix_vector_matrix_mismatch(%arg0: vector<4xf32>, %arg1: !spirv.matrix<4 x vector<3xf32>>) {
|
|
// expected-error @+1 {{op failed to verify that matrix rows count matches vector elements count}}
|
|
%result = spirv.VectorTimesMatrix %arg0, %arg1 : vector<4xf32>, !spirv.matrix<4 x vector<3xf32>> -> vector<3xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @vector_times_matrix_result_matrix_mismatch(%arg0: vector<3xf32>, %arg1: !spirv.matrix<4 x vector<3xf32>>) {
|
|
// expected-error @+1 {{op failed to verify that matrix columns count matches result elements count}}
|
|
%result = spirv.VectorTimesMatrix %arg0, %arg1 : vector<3xf32>, !spirv.matrix<4 x vector<3xf32>> -> vector<3xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @vector_times_matrix_vector_type_mismatch(%arg0: vector<3xf16>, %arg1: !spirv.matrix<4 x vector<3xf32>>) {
|
|
// expected-error @+1 {{op failed to verify that all of {vector, result} have same element type}}
|
|
%result = spirv.VectorTimesMatrix %arg0, %arg1 : vector<3xf16>, !spirv.matrix<4 x vector<3xf32>> -> vector<4xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @vector_times_matrix_matrix_type_mismatch(%arg0: vector<3xf32>, %arg1: !spirv.matrix<4 x vector<3xf16>>) {
|
|
// expected-error @+1 {{op failed to verify that all of {matrix, result} have same element type}}
|
|
%result = spirv.VectorTimesMatrix %arg0, %arg1 : vector<3xf32>, !spirv.matrix<4 x vector<3xf16>> -> vector<4xf32>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @outer_product_element_type_mismatch(%arg0: vector<3xf16>, %arg1: vector<2xf16>) {
|
|
// expected-error @+1 {{op failed to verify that all of {vector1, vector2, result} have same element type}}
|
|
%result = spirv.OuterProduct %arg0, %arg1 : vector<3xf16>, vector<2xf16> -> !spirv.matrix<2 x vector<3xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @outer_product_vector1_result_row_mismatch(%arg0: vector<3xf32>, %arg1: vector<2xf32>) {
|
|
// expected-error @+1 {{op failed to verify that result rows count matches vector1 elements count}}
|
|
%result = spirv.OuterProduct %arg0, %arg1 : vector<3xf32>, vector<2xf32> -> !spirv.matrix<2 x vector<4xf32>>
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @outer_product_vector2_result_column_mismatch(%arg0: vector<3xf32>, %arg1: vector<2xf32>) {
|
|
// expected-error @+1 {{op failed to verify that result columns count matches vector2 elements count}}
|
|
%result = spirv.OuterProduct %arg0, %arg1 : vector<3xf32>, vector<2xf32> -> !spirv.matrix<3 x vector<3xf32>>
|
|
return
|
|
}
|