forked from google/clspv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use \n as delimiter for stripping OpenCL features
The previous regex was matching a semicolon to end the string to be removed, which was nuking many additional lines when matching macro definitions like as_type(). Fixes google#166
- Loading branch information
Showing
2 changed files
with
86 additions
and
19 deletions.
There are no files selected for viewing
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
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,70 @@ | ||
// Test for https://github.com/google/clspv/issues/166 | ||
// Function declarations were missing from builtin header. | ||
|
||
// RUN: clspv %s -S -o %t.spvasm | ||
// RUN: FileCheck %s < %t.spvasm | ||
// RUN: clspv %s -o %t.spv | ||
// RUN: spirv-dis -o %t2.spvasm %t.spv | ||
// RUN: FileCheck %s < %t2.spvasm | ||
// RUN: spirv-val --target-env vulkan1.0 %t.spv | ||
|
||
|
||
kernel void foo(global float *A, uint a) { | ||
*A = as_float(a); | ||
} | ||
|
||
// CHECK: ; SPIR-V | ||
// CHECK: ; Version: 1.0 | ||
// CHECK: ; Generator: Codeplay; 0 | ||
// CHECK: ; Bound: 28 | ||
// CHECK: ; Schema: 0 | ||
// CHECK: OpCapability Shader | ||
// CHECK: OpCapability VariablePointers | ||
// CHECK: OpExtension "SPV_KHR_storage_buffer_storage_class" | ||
// CHECK: OpExtension "SPV_KHR_variable_pointers" | ||
// CHECK: OpMemoryModel Logical GLSL450 | ||
// CHECK: OpEntryPoint GLCompute [[_22:%[0-9a-zA-Z_]+]] "foo" | ||
// CHECK: OpSource OpenCL_C 120 | ||
// CHECK: OpDecorate [[_15:%[0-9a-zA-Z_]+]] SpecId 0 | ||
// CHECK: OpDecorate [[_16:%[0-9a-zA-Z_]+]] SpecId 1 | ||
// CHECK: OpDecorate [[_17:%[0-9a-zA-Z_]+]] SpecId 2 | ||
// CHECK: OpDecorate [[__runtimearr_float:%[0-9a-zA-Z_]+]] ArrayStride 4 | ||
// CHECK: OpMemberDecorate [[__struct_3:%[0-9a-zA-Z_]+]] 0 Offset 0 | ||
// CHECK: OpDecorate [[__struct_3]] Block | ||
// CHECK: OpMemberDecorate [[__struct_6:%[0-9a-zA-Z_]+]] 0 Offset 0 | ||
// CHECK: OpDecorate [[__struct_6]] Block | ||
// CHECK: OpDecorate [[_gl_WorkGroupSize:%[0-9a-zA-Z_]+]] BuiltIn WorkgroupSize | ||
// CHECK: OpDecorate [[_20:%[0-9a-zA-Z_]+]] DescriptorSet 0 | ||
// CHECK: OpDecorate [[_20]] Binding 0 | ||
// CHECK: OpDecorate [[_21:%[0-9a-zA-Z_]+]] DescriptorSet 0 | ||
// CHECK: OpDecorate [[_21]] Binding 1 | ||
// CHECK: [[_float:%[0-9a-zA-Z_]+]] = OpTypeFloat 32 | ||
// CHECK: [[__runtimearr_float]] = OpTypeRuntimeArray [[_float]] | ||
// CHECK: [[__struct_3]] = OpTypeStruct [[__runtimearr_float]] | ||
// CHECK: [[__ptr_StorageBuffer__struct_3:%[0-9a-zA-Z_]+]] = OpTypePointer StorageBuffer [[__struct_3]] | ||
// CHECK: [[_uint:%[0-9a-zA-Z_]+]] = OpTypeInt 32 0 | ||
// CHECK: [[__struct_6]] = OpTypeStruct [[_uint]] | ||
// CHECK: [[__ptr_StorageBuffer__struct_6:%[0-9a-zA-Z_]+]] = OpTypePointer StorageBuffer [[__struct_6]] | ||
// CHECK: [[_void:%[0-9a-zA-Z_]+]] = OpTypeVoid | ||
// CHECK: [[_9:%[0-9a-zA-Z_]+]] = OpTypeFunction [[_void]] | ||
// CHECK: [[__ptr_StorageBuffer_uint:%[0-9a-zA-Z_]+]] = OpTypePointer StorageBuffer [[_uint]] | ||
// CHECK: [[__ptr_StorageBuffer_float:%[0-9a-zA-Z_]+]] = OpTypePointer StorageBuffer [[_float]] | ||
// CHECK: [[_v3uint:%[0-9a-zA-Z_]+]] = OpTypeVector [[_uint]] 3 | ||
// CHECK: [[__ptr_Private_v3uint:%[0-9a-zA-Z_]+]] = OpTypePointer Private [[_v3uint]] | ||
// CHECK: [[_uint_0:%[0-9a-zA-Z_]+]] = OpConstant [[_uint]] 0 | ||
// CHECK: [[_15]] = OpSpecConstant [[_uint]] 1 | ||
// CHECK: [[_16]] = OpSpecConstant [[_uint]] 1 | ||
// CHECK: [[_17]] = OpSpecConstant [[_uint]] 1 | ||
// CHECK: [[_gl_WorkGroupSize]] = OpSpecConstantComposite [[_v3uint]] [[_15]] [[_16]] [[_17]] | ||
// CHECK: [[_19:%[0-9a-zA-Z_]+]] = OpVariable [[__ptr_Private_v3uint]] Private [[_gl_WorkGroupSize]] | ||
// CHECK: [[_20]] = OpVariable [[__ptr_StorageBuffer__struct_3]] StorageBuffer | ||
// CHECK: [[_21]] = OpVariable [[__ptr_StorageBuffer__struct_6]] StorageBuffer | ||
// CHECK: [[_22]] = OpFunction [[_void]] None [[_9]] | ||
// CHECK: [[_23:%[0-9a-zA-Z_]+]] = OpLabel | ||
// CHECK: [[_24:%[0-9a-zA-Z_]+]] = OpAccessChain [[__ptr_StorageBuffer_uint]] [[_21]] [[_uint_0]] | ||
// CHECK: [[_25:%[0-9a-zA-Z_]+]] = OpLoad [[_uint]] [[_24]] | ||
// CHECK: [[_26:%[0-9a-zA-Z_]+]] = OpBitcast [[_float]] [[_25]] | ||
// CHECK: [[_27:%[0-9a-zA-Z_]+]] = OpAccessChain [[__ptr_StorageBuffer_float]] [[_20]] [[_uint_0]] [[_uint_0]] | ||
// CHECK: OpStore [[_27]] [[_26]] | ||
// CHECK: OpReturn | ||
// CHECK: OpFunctionEnd |