-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite variable pointers tests as SPIRVProducer tests (#1300)
refs #1292 * Rewrite as more targeted tests to reduce potential perturbations
- Loading branch information
1 parent
00fc6dc
commit 54e49d8
Showing
36 changed files
with
819 additions
and
388 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
; RUN: clspv-opt %s -o %t -producer-out-file %t.spv --passes=spirv-producer | ||
; RUN: spirv-dis %t.spv -o %t.spvasm | ||
; RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
; RUN: FileCheck %s < %t.spvasm | ||
|
||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK-NOT: OpExtension "SPV_KHR_variable_pointers" | ||
; CHECK: [[image:%[a-zA-Z0-9_]+]] = OpTypeImage | ||
; CHECK: OpFunctionParameter [[image]] | ||
|
||
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 | ||
|
||
declare spir_func void @_Z12write_imagef22ocl_image2d_wo_t.floatDv2_iDv4_f(target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0), <2 x i32>, <4 x float>) | ||
|
||
define spir_func void @bar(target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) %image) { | ||
entry: | ||
tail call spir_func void @_Z12write_imagef22ocl_image2d_wo_t.floatDv2_iDv4_f(target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) %image, <2 x i32> zeroinitializer, <4 x float> zeroinitializer) | ||
ret void | ||
} | ||
|
||
define spir_kernel void @foo(target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) %image) !clspv.pod_args_impl !15 { | ||
entry: | ||
%0 = call target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) @_Z14clspv.resource.0(i32 0, i32 0, i32 7, i32 0, i32 0, i32 0, target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) undef) | ||
tail call spir_func void @bar(target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) %0) | ||
ret void | ||
} | ||
|
||
declare target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, target("spirv.Image", float, 1, 0, 0, 0, 2, 0, 1, 0)) | ||
|
||
!15 = !{i32 2} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
; RUN: clspv-opt %s -o %t -producer-out-file %t.spv --passes=spirv-producer | ||
; RUN: spirv-dis %t.spv -o %t.spvasm | ||
; RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
; RUN: FileCheck %s < %t.spvasm | ||
|
||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK-NOT: OpExtension "SPV_KHR_variable_pointers" | ||
; CHECK-DAG: [[image:%[a-zA-Z0-9_]+]] = OpTypeImage | ||
; CHECK-DAG: [[sampler:%[a-zA-Z0-9_]+]] = OpTypeSampler | ||
; CHECK: OpFunctionParameter [[image]] | ||
; CHECK: OpFunctionParameter [[sampler]] | ||
|
||
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 | ||
|
||
declare spir_func <4 x float> @_Z11read_imagef30ocl_image2d_ro_t.float.sampled11ocl_samplerDv2_f(target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0), target("spirv.Sampler"), <2 x float>) | ||
|
||
define spir_func <4 x float> @bar(target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) %image, target("spirv.Sampler") %sampler) { | ||
entry: | ||
%call = tail call spir_func <4 x float> @_Z11read_imagef30ocl_image2d_ro_t.float.sampled11ocl_samplerDv2_f(target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) %image, target("spirv.Sampler") %sampler, <2 x float> zeroinitializer) | ||
ret <4 x float> %call | ||
} | ||
|
||
define spir_kernel void @foo(target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) %image, target("spirv.Sampler") %sampler, ptr addrspace(1) nocapture writeonly align 16 %out) !clspv.pod_args_impl !17 { | ||
entry: | ||
%0 = call target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) @_Z14clspv.resource.0(i32 0, i32 0, i32 6, i32 0, i32 0, i32 0, target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) undef) | ||
%1 = call target("spirv.Sampler") @_Z14clspv.resource.1(i32 0, i32 1, i32 8, i32 1, i32 1, i32 0, target("spirv.Sampler") zeroinitializer) | ||
%2 = call ptr addrspace(1) @_Z14clspv.resource.2(i32 0, i32 2, i32 0, i32 2, i32 2, i32 0, { [0 x <4 x float>] } zeroinitializer) | ||
%3 = getelementptr { [0 x <4 x float>] }, ptr addrspace(1) %2, i32 0, i32 0, i32 0 | ||
%call = tail call spir_func <4 x float> @bar(target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) %0, target("spirv.Sampler") %1) #4 | ||
store <4 x float> %call, ptr addrspace(1) %3, align 16 | ||
ret void | ||
} | ||
|
||
declare target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, target("spirv.Image", float, 1, 0, 0, 0, 1, 0, 0, 0)) | ||
|
||
declare target("spirv.Sampler") @_Z14clspv.resource.1(i32, i32, i32, i32, i32, i32, target("spirv.Sampler")) | ||
|
||
declare ptr addrspace(1) @_Z14clspv.resource.2(i32, i32, i32, i32, i32, i32, { [0 x <4 x float>] }) | ||
|
||
!17 = !{i32 2} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
; RUN: clspv-opt %s -o %t -producer-out-file %t.spv --passes=spirv-producer | ||
; RUN: spirv-dis %t.spv -o %t.spvasm | ||
; RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
; RUN: FileCheck %s < %t.spvasm | ||
|
||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK: OpCapability VariablePointersStorageBuffer | ||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK: OpExtension "SPV_KHR_variable_pointers" | ||
; CHECK: [[uint:%[a-zA-Z0-9_]+]] = OpTypeInt 32 0 | ||
; CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer StorageBuffer [[uint]] | ||
; CHECK: OpFunctionParameter [[ptr]] | ||
|
||
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 readonly align 4 %in, ptr addrspace(1) nocapture writeonly align 4 %out) !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 0, { [0 x i32] } zeroinitializer) | ||
%1 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 0 | ||
%2 = call ptr addrspace(1) @_Z14clspv.resource.1(i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, { [0 x i32] } zeroinitializer) | ||
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %2, i32 0, i32 0, i32 0 | ||
%call = tail call spir_func i32 @bar(ptr addrspace(1) %1) | ||
store i32 %call, ptr addrspace(1) %3, align 4 | ||
ret void | ||
} | ||
|
||
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 i32] }) | ||
|
||
!16 = !{i32 2} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
; RUN: clspv-opt %s -o %t -producer-out-file %t.spv --passes=spirv-producer | ||
; RUN: spirv-dis %t.spv -o %t.spvasm | ||
; RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
; RUN: FileCheck %s < %t.spvasm | ||
|
||
; Passing SSBO to function call requires VariablePointersStorageBuffer. | ||
; SSBO args do not require memory object declarations. | ||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK: OpCapability VariablePointersStorageBuffer | ||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK: OpExtension "SPV_KHR_variable_pointers" | ||
; CHECK: [[uint:%[a-zA-Z0-9_]+]] = OpTypeInt 32 0 | ||
; CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer StorageBuffer [[uint]] | ||
; CHECK: [[uint_0:%[a-zA-Z0-9_]+]] = OpConstant [[uint]] 0 | ||
; CHECK: [[uint_1:%[a-zA-Z0-9_]+]] = OpConstant [[uint]] 1 | ||
; CHECK: [[gep:%[a-zA-Z0-9_]+]] = OpAccessChain [[ptr]] {{.*}} [[uint_0]] [[uint_1]] | ||
; CHECK-NEXT: OpFunctionCall [[uint]] {{.*}} [[gep]] | ||
|
||
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 spir_kernel void @foo(ptr addrspace(1) nocapture readonly align 4 %in, ptr addrspace(1) nocapture writeonly align 4 %out) !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 0, { [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 i32] } zeroinitializer) | ||
%2 = getelementptr { [0 x i32] }, ptr addrspace(1) %1, i32 0, i32 0, i32 0 | ||
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %0, i32 0, i32 0, i32 1 | ||
%call.i = tail call spir_func i32 @bar(ptr addrspace(1) %3) | ||
store i32 %call.i, ptr addrspace(1) %2, align 4 | ||
ret void | ||
} | ||
|
||
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 i32] }) | ||
|
||
declare ptr addrspace(9) @_Z14clspv.resource.2(i32, i32, i32, i32, i32, i32, { { i32 } }) | ||
|
||
!16 = !{i32 2} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
; RUN: clspv-opt %s -o %t -producer-out-file %t.spv --passes=spirv-producer | ||
; RUN: spirv-dis %t.spv -o %t.spvasm | ||
; RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
; RUN: FileCheck %s < %t.spvasm | ||
|
||
; Pass base workgroup object to a function shouldn't require variable | ||
; pointers, but the representation inserts an OpAccessChain so we require | ||
; VariablePointers because it is NOT a memory object declaration. | ||
; CHECK-NOT: OpCapability VariablePointersStorageBuffer | ||
; CHECK: OpCapability VariablePointers | ||
; CHECK-NOT: StorageBuffer | ||
; CHECK: OpExtension "SPV_KHR_variable_pointers" | ||
; CHECK: [[uint:%[a-zA-Z0-9_]+]] = OpTypeInt 32 0 | ||
; CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer Workgroup [[uint]] | ||
; CHECK: [[gep:%[a-zA-Z0-9_]+]] = OpAccessChain [[ptr]] | ||
; CHECK: OpFunctionCall [[uint]] {{.*}} [[gep]] | ||
|
||
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(3) nocapture readonly %x) { | ||
entry: | ||
%0 = load i32, ptr addrspace(3) %x, align 4 | ||
ret i32 %0 | ||
} | ||
|
||
define dso_local spir_kernel void @foo(ptr addrspace(3) nocapture readonly align 4 %in, ptr addrspace(1) nocapture writeonly align 4 %out) !clspv.pod_args_impl !19 { | ||
entry: | ||
%0 = call ptr addrspace(3) @_Z11clspv.local.3(i32 3, [0 x i32] zeroinitializer) | ||
%1 = getelementptr [0 x i32], ptr addrspace(3) %0, i32 0, i32 0 | ||
%2 = call ptr addrspace(1) @_Z14clspv.resource.0(i32 0, i32 0, i32 0, i32 1, i32 0, i32 0, { [0 x i32] } zeroinitializer) | ||
%3 = getelementptr { [0 x i32] }, ptr addrspace(1) %2, i32 0, i32 0, i32 0 | ||
%call = tail call spir_func i32 @bar(ptr addrspace(3) %1) | ||
store i32 %call, ptr addrspace(1) %3, align 4 | ||
ret void | ||
} | ||
|
||
declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] }) | ||
|
||
declare ptr addrspace(3) @_Z11clspv.local.3(i32, [0 x i32]) | ||
|
||
!19 = !{i32 2} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
; RUN: clspv-opt %s -o %t -producer-out-file %t.spv --passes=spirv-producer | ||
; RUN: spirv-dis %t.spv -o %t.spvasm | ||
; RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
; RUN: FileCheck %s < %t.spvasm | ||
|
||
; Null pointer for SSBO requires VariablePointersStorageBuffer. | ||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK: OpCapability VariablePointersStorageBuffer | ||
; CHECK-NOT: OpCapability VariablePointers | ||
; CHECK: OpExtension "SPV_KHR_variable_pointers" | ||
; CHECK: [[uint:%[a-zA-Z0-9_]+]] = OpTypeInt 32 0 | ||
; CHECK: [[ptr:%[a-zA-Z0-9_]+]] = OpTypePointer StorageBuffer [[uint]] | ||
; CHECK: OpConstantNull [[ptr]] | ||
|
||
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 spir_kernel void @foo(ptr addrspace(1) nocapture writeonly align 4 %out, { i32 } %podargs) !clspv.pod_args_impl !14 !kernel_arg_map !15 { | ||
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) null, align 2147483648 | ||
store i32 %2, ptr addrspace(1) %1, align 4 | ||
ret void | ||
} | ||
|
||
declare ptr addrspace(1) @_Z14clspv.resource.0(i32, i32, i32, i32, i32, i32, { [0 x i32] }) | ||
|
||
!14 = !{i32 2} | ||
!15 = !{!16, !17} | ||
!16 = !{!"out", i32 0, i32 0, i32 0, i32 0, !"buffer"} | ||
!17 = !{!"n", i32 1, i32 1, i32 0, i32 4, !"pod_pushconstant"} | ||
|
Oops, something went wrong.