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

Convert coherent tests to SPIRVProducer tests #1299

Merged
merged 1 commit into from
Feb 5, 2024
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
16 changes: 0 additions & 16 deletions test/Coherent/coherent_barrier_subfunction.cl

This file was deleted.

37 changes: 37 additions & 0 deletions test/Coherent/coherent_barrier_subfunction.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; CHECK: OpDecorate [[var:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[var]] Binding 0
; CHECK: OpDecorate [[var]] Coherent

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_func void @bar() {
entry:
tail call void @_Z8spirv.op.224.jjj(i32 224, i32 2, i32 2, i32 72)
ret void
}

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data)!clspv.pod_args_impl !14 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, { [0 x i32] } zeroinitializer)
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%2 = load i32, ptr addrspace(1) %1, align 4
tail call spir_func void @bar()
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
store i32 %2, ptr addrspace(1) %3, align 4
ret void
}

declare void @_Z8spirv.op.224.jjj(i32, i32, i32, i32)

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

!14 = !{i32 2}

14 changes: 0 additions & 14 deletions test/Coherent/coherent_fence_simple.cl

This file was deleted.

31 changes: 31 additions & 0 deletions test/Coherent/coherent_fence_simple.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; CHECK: OpDecorate [[var:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[var]] Binding 0
; CHECK: OpDecorate [[var]] Coherent

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data)!clspv.pod_args_impl !13 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, { [0 x i32] } zeroinitializer)
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%2 = load i32, ptr addrspace(1) %1, align 4
tail call void @_Z8spirv.op.225.jj(i32 225, i32 2, i32 72)
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
store i32 %2, ptr addrspace(1) %3, align 4
ret void
}

declare void @_Z8spirv.op.225.jj(i32, i32, i32)

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

!13 = !{i32 2}

31 changes: 0 additions & 31 deletions test/Coherent/coherent_multiple_subfunctions.cl

This file was deleted.

50 changes: 50 additions & 0 deletions test/Coherent/coherent_multiple_subfunctions.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; CHECK: OpDecorate [[var:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[var]] Binding 0
; CHECK: OpDecorate [[var]] Coherent
; CHECK: OpDecorate [[param1:%[a-zA-Z0-9_]+]] Coherent
; CHECK: OpDecorate [[param2:%[a-zA-Z0-9_]+]] Coherent
; CHECK: [[baz:%[a-zA-Z0-9_]+]] = OpFunction
; CHECK: [[param1]] = OpFunctionParameter
; CHECK: = OpFunction
; CHECK: [[param2]] = OpFunctionParameter
; CHECK: OpFunctionCall {{.*}} [[baz]] [[param2]]

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_func i32 @baz(ptr addrspace(1) nocapture readonly %x) {
entry:
%0 = load i32, ptr addrspace(1) %x, align 4
ret i32 %0
}

define dso_local spir_func i32 @bar(ptr addrspace(1) nocapture readonly %x) {
entry:
%call = tail call spir_func i32 @baz(ptr addrspace(1) %x)
ret i32 %call
}

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data) !clspv.pod_args_impl !16 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, { [0 x i32] } zeroinitializer)
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%call = tail call spir_func i32 @bar(ptr addrspace(1) %1)
tail call void @_Z8spirv.op.224.jjj(i32 224, i32 2, i32 2, i32 72)
%2 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
store i32 %call, ptr addrspace(1) %2, align 4
ret void
}

declare void @_Z8spirv.op.224.jjj(i32, i32, i32, i32)

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

!16 = !{i32 2}

14 changes: 0 additions & 14 deletions test/Coherent/coherent_simple.cl

This file was deleted.

31 changes: 31 additions & 0 deletions test/Coherent/coherent_simple.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; CHECK: OpDecorate [[var:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[var]] Binding 0
; CHECK: OpDecorate [[var]] Coherent

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data) !clspv.pod_args_impl !13 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, { [0 x i32] } zeroinitializer)
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%2 = load i32, ptr addrspace(1) %1, align 4
tail call void @_Z8spirv.op.224.jjj(i32 224, i32 2, i32 2, i32 72)
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
store i32 %2, ptr addrspace(1) %3, align 4
ret void
}

declare void @_Z8spirv.op.224.jjj(i32, i32, i32, i32)

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

!13 = !{i32 2}

23 changes: 0 additions & 23 deletions test/Coherent/coherent_subfunction_parameter.cl

This file was deleted.

39 changes: 39 additions & 0 deletions test/Coherent/coherent_subfunction_parameter.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; CHECK: OpDecorate [[var:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[var]] Binding 0
; CHECK: OpDecorate [[var]] Coherent
; CHECK: OpDecorate [[param:%[a-zA-Z0-9_]+]] Coherent
; CHECK: [[param]] = OpFunctionParameter

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_func i32 @bar(ptr addrspace(1) nocapture readonly %x) {
entry:
%0 = load i32, ptr addrspace(1) %x, align 4
ret i32 %0
}

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data) !clspv.pod_args_impl !15 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, { [0 x i32] } zeroinitializer)
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%call = tail call spir_func i32 @bar(ptr addrspace(1) %1)
tail call void @_Z8spirv.op.224.jjj(i32 224, i32 2, i32 2, i32 72)
%2 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
store i32 %call, ptr addrspace(1) %2, align 4
ret void
}

declare void @_Z8spirv.op.224.jjj(i32, i32, i32, i32)

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

!15 = !{i32 2}

17 changes: 0 additions & 17 deletions test/Coherent/frexp.cl

This file was deleted.

42 changes: 42 additions & 0 deletions test/Coherent/frexp.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; CHECK: OpDecorate [[data:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[data]] Binding 0
; CHECK: OpDecorate [[data]] Coherent
; CHECK: OpDecorate [[x:%[a-zA-Z0-9_]+]] DescriptorSet 0
; CHECK: OpDecorate [[x]] Binding 1
; CHECK-NOT: OpDecorate [[x]] Coherent

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data, ptr addrspace(1) nocapture writeonly align 4 %x) !clspv.pod_args_impl !14 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, { [0 x i32] } zeroinitializer)
%1 = call ptr addrspace(1) @_Z14clspv.resource.1(i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, { [0 x float] } zeroinitializer)
%2 = getelementptr { [0 x float] }, ptr addrspace(1) %1, i32 0, i32 0, i32 0
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%4 = load i32, ptr addrspace(1) %3, align 1
%conv = sitofp i32 %4 to float
tail call void @_Z8spirv.op.224.jjj(i32 224, i32 2, i32 2, i32 72) #3
%5 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
%call = tail call spir_func float @_Z5frexpfPU3AS1i(float %conv, ptr addrspace(1) %5)
store float %call, ptr addrspace(1) %2, align 4
ret void
}

declare dso_local spir_func float @_Z5frexpfPU3AS1i(float noundef, ptr addrspace(1) nocapture noundef writeonly)

declare void @_Z8spirv.op.224.jjj(i32, i32, i32, i32)

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

declare ptr addrspace(1) @_Z14clspv.resource.1(i32, i32, i32, i32, i32, i32, { [0 x float] })

!14 = !{i32 2}

12 changes: 0 additions & 12 deletions test/Coherent/missing_barrier.cl

This file was deleted.

27 changes: 27 additions & 0 deletions test/Coherent/missing_barrier.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; RUN: clspv-opt %s -o %t.ll -producer-out-file %t.spv --passes=spirv-producer
; RUN: spirv-dis %t.spv -o %t.spvasm
; RUN: spirv-val %t.spv --target-env vulkan1.0
; RUN: FileCheck %s < %t.spvasm

; Lack of barrier means |data| is not coherent.
; CHECK-NOT: OpDecorate {{.*}} Coherent

target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "spir-unknown-unknown"

@__spirv_WorkgroupSize = local_unnamed_addr addrspace(8) global <3 x i32> zeroinitializer

define dso_local spir_kernel void @foo(ptr addrspace(1) nocapture align 4 %data) !clspv.pod_args_impl !13 {
entry:
%0 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, { [0 x i32] } zeroinitializer)
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0
%2 = load i32, ptr addrspace(1) %1, align 4
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1
store i32 %2, ptr addrspace(1) %3, align 4
ret void
}

declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] })

!13 = !{i32 2}

Loading