Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions mlir/test/Target/SPIRV/entry-point.mlir
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip -split-input-file %s | FileCheck %s

spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
// RUN: %if spirv-tools %{ rm -rf %t %}
// RUN: %if spirv-tools %{ mkdir %t %}
// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}
// RUN: %if spirv-tools %{ spirv-val %t %}

spirv.module Logical OpenCL requires #spirv.vce<v1.0, [Kernel], []> {
spirv.func @noop() -> () "None" {
spirv.Return
}
// CHECK: spirv.EntryPoint "GLCompute" @noop
// CHECK: spirv.EntryPoint "Kernel" @noop
// CHECK-NEXT: spirv.ExecutionMode @noop "ContractionOff"
spirv.EntryPoint "GLCompute" @noop
spirv.EntryPoint "Kernel" @noop
spirv.ExecutionMode @noop "ContractionOff"
}

Expand All @@ -15,13 +20,13 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
// CHECK: spirv.GlobalVariable @var2 : !spirv.ptr<f32, Input>
// CHECK-NEXT: spirv.GlobalVariable @var3 : !spirv.ptr<f32, Output>
// CHECK-NEXT: spirv.func @noop({{%.*}}: !spirv.ptr<f32, Input>, {{%.*}}: !spirv.ptr<f32, Output>) "None"
// CHECK-NEXT: spirv.func @noop() "None"
// CHECK: spirv.EntryPoint "GLCompute" @noop, @var2, @var3
spirv.GlobalVariable @var2 : !spirv.ptr<f32, Input>
spirv.GlobalVariable @var3 : !spirv.ptr<f32, Output>
spirv.func @noop(%arg0 : !spirv.ptr<f32, Input>, %arg1 : !spirv.ptr<f32, Output>) -> () "None" {
spirv.func @noop() -> () "None" {
spirv.Return
}
spirv.EntryPoint "GLCompute" @noop, @var2, @var3
spirv.ExecutionMode @noop "ContractionOff"
spirv.ExecutionMode @noop "LocalSize", 1, 1, 1
}
11 changes: 8 additions & 3 deletions mlir/test/Target/SPIRV/logical-ops.mlir
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// RUN: mlir-translate -no-implicit-module -split-input-file -test-spirv-roundtrip %s | FileCheck %s

spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
// RUN: %if spirv-tools %{ rm -rf %t %}
// RUN: %if spirv-tools %{ mkdir %t %}
// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}
// RUN: %if spirv-tools %{ spirv-val %t %}

spirv.module Logical OpenCL requires #spirv.vce<v1.0, [Kernel, Linkage], []> {
spirv.func @iequal_scalar(%arg0: i32, %arg1: i32) "None" {
// CHECK: {{.*}} = spirv.IEqual {{.*}}, {{.*}} : i32
%0 = spirv.IEqual %arg0, %arg1 : i32
Expand Down Expand Up @@ -92,7 +97,7 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {

// -----

spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
spirv.module Logical GLSL450 requires #spirv.vce<v1.4, [Shader, Linkage], []> {
spirv.SpecConstant @condition_scalar = true
spirv.func @select() -> () "None" {
%0 = spirv.Constant 4.0 : f32
Expand All @@ -115,7 +120,7 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {

// Test select works with bf16 scalar and vectors.

spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
spirv.module Logical GLSL450 requires #spirv.vce<v1.4, [Shader, Linkage, BFloat16TypeKHR], [SPV_KHR_bfloat16]> {
spirv.SpecConstant @condition_scalar = true
spirv.func @select_bf16() -> () "None" {
%0 = spirv.Constant 4.0 : bf16
Expand Down
15 changes: 10 additions & 5 deletions mlir/test/Target/SPIRV/sampled-image.mlir
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
// RUN: mlir-translate -no-implicit-module -test-spirv-roundtrip %s | FileCheck %s

spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
// CHECK: !spirv.ptr<!spirv.sampled_image<!spirv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, UniformConstant>
spirv.GlobalVariable @var0 bind(0, 1) : !spirv.ptr<!spirv.sampled_image<!spirv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NoSampler, Unknown>>, UniformConstant>
// RUN: %if spirv-tools %{ rm -rf %t %}
// RUN: %if spirv-tools %{ mkdir %t %}
// RUN: %if spirv-tools %{ mlir-translate --no-implicit-module --serialize-spirv --split-input-file --spirv-save-validation-files-with-prefix=%t/module %s %}
// RUN: %if spirv-tools %{ spirv-val %t %}

// CHECK: !spirv.ptr<!spirv.sampled_image<!spirv.image<si32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>>, UniformConstant>
spirv.GlobalVariable @var1 bind(0, 0) : !spirv.ptr<!spirv.sampled_image<!spirv.image<si32, SubpassData, DepthUnknown, Arrayed, MultiSampled, NoSampler, Unknown>>, UniformConstant>
spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader, Sampled1D, SampledRect, StorageImageExtendedFormats, Linkage], []> {
// CHECK: !spirv.ptr<!spirv.sampled_image<!spirv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>, UniformConstant>
spirv.GlobalVariable @var0 bind(0, 1) : !spirv.ptr<!spirv.sampled_image<!spirv.image<f32, Dim1D, NoDepth, NonArrayed, SingleSampled, NeedSampler, Unknown>>, UniformConstant>

// CHECK: !spirv.ptr<!spirv.sampled_image<!spirv.image<si32, Cube, DepthUnknown, Arrayed, MultiSampled, NeedSampler, Unknown>>, UniformConstant>
spirv.GlobalVariable @var1 bind(0, 0) : !spirv.ptr<!spirv.sampled_image<!spirv.image<si32, Cube, DepthUnknown, Arrayed, MultiSampled, NeedSampler, Unknown>>, UniformConstant>

// CHECK: !spirv.ptr<!spirv.sampled_image<!spirv.image<i32, Rect, DepthUnknown, Arrayed, MultiSampled, NeedSampler, R8ui>>, UniformConstant>
spirv.GlobalVariable @var2 bind(0, 0) : !spirv.ptr<!spirv.sampled_image<!spirv.image<i32, Rect, DepthUnknown, Arrayed, MultiSampled, NeedSampler, R8ui>>, UniformConstant>
Expand Down
Loading