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

add SPIR-V 1.4 testing for no integer wrap decorations #2041

Merged
merged 5 commits into from
Oct 22, 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
2 changes: 1 addition & 1 deletion test_conformance/spirv_new/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ set(${MODULE_NAME}_SOURCES
main.cpp
test_basic_versions.cpp
test_cl_khr_expect_assume.cpp
test_cl_khr_spirv_no_integer_wrap_decoration.cpp
test_decorate.cpp
test_get_program_il.cpp
test_linkage.cpp
test_no_integer_wrap_decoration.cpp
test_op_atomic.cpp
test_op_branch_conditional.cpp
test_op_branch.cpp
Expand Down
41 changes: 41 additions & 0 deletions test_conformance/spirv_new/spirvInfo.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Copyright (c) 2024 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#pragma once

#include "harness/compat.h"

#include <string>

extern bool gVersionSkip;

static bool is_spirv_version_supported(cl_device_id deviceID,
const char* version)
{
std::string ilVersions = get_device_il_version_string(deviceID);

if (gVersionSkip)
{
log_info(" Skipping version check for %s.\n", version);
return true;
}
else if (ilVersions.find(version) == std::string::npos)
{
return false;
}

return true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoSignedWrap
OpGroupDecorate %7 %lhs %rhs
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
%2 = OpFunction %void None %14
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%15 = OpLabel
%16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %17
%21 = OpLoad %uint %20 Aligned 4
%8 = OpIAdd %uint %19 %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %17
OpStore %22 %8 Aligned 4
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 28
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoSignedWrap
OpGroupDecorate %7 %lhs %rhs
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
%2 = OpFunction %void None %15
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%16 = OpLabel
%17 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId
%18 = OpCompositeExtract %ulong %17 0
%19 = OpUConvert %uint %18
%20 = OpSConvert %ulong %19
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %20
%22 = OpLoad %uint %21 Aligned 4
%23 = OpSConvert %ulong %19
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %23
%25 = OpLoad %uint %24 Aligned 4
%8 = OpIAdd %uint %22 %25
%26 = OpSConvert %ulong %19
%27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %26
OpStore %27 %8 Aligned 4
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoUnsignedWrap
OpGroupDecorate %7 %lhs %rhs
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
%2 = OpFunction %void None %14
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%15 = OpLabel
%16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %17
%21 = OpLoad %uint %20 Aligned 4
%8 = OpIAdd %uint %19 %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %17
OpStore %22 %8 Aligned 4
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 28
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoUnsignedWrap
OpGroupDecorate %7 %lhs %rhs
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
%2 = OpFunction %void None %15
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%16 = OpLabel
%17 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId
%18 = OpCompositeExtract %ulong %17 0
%19 = OpUConvert %uint %18
%20 = OpSConvert %ulong %19
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %20
%22 = OpLoad %uint %21 Aligned 4
%23 = OpSConvert %ulong %19
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %23
%25 = OpLoad %uint %24 Aligned 4
%8 = OpIAdd %uint %22 %25
%26 = OpSConvert %ulong %19
%27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %26
OpStore %27 %8 Aligned 4
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoSignedWrap
OpGroupDecorate %7 %lhs %rhs
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
%2 = OpFunction %void None %14
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%15 = OpLabel
%16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %17
%21 = OpLoad %uint %20 Aligned 4
%8 = OpIMul %uint %19 %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %17
OpStore %22 %8 Aligned 4
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 28
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoSignedWrap
OpGroupDecorate %7 %lhs %rhs
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%v3ulong = OpTypeVector %ulong 3
%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%15 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input
%2 = OpFunction %void None %15
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%16 = OpLabel
%17 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId
%18 = OpCompositeExtract %ulong %17 0
%19 = OpUConvert %uint %18
%20 = OpSConvert %ulong %19
%21 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %20
%22 = OpLoad %uint %21 Aligned 4
%23 = OpSConvert %ulong %19
%24 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %23
%25 = OpLoad %uint %24 Aligned 4
%8 = OpIMul %uint %22 %25
%26 = OpSConvert %ulong %19
%27 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %26
OpStore %27 %8 Aligned 4
OpReturn
OpFunctionEnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
; SPIR-V
; Version: 1.4
; Generator: Khronos SPIR-V Tools Assembler; 0
; Bound: 23
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpMemoryModel Physical32 OpenCL
OpEntryPoint Kernel %2 "fmath_cl" %__spirv_BuiltInGlobalInvocationId
OpSource OpenCL_C 200000
OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId"
OpName %out "out"
OpName %lhs "lhs"
OpName %rhs "rhs"
OpDecorate %7 FuncParamAttr NoWrite
%7 = OpDecorationGroup
OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId
OpDecorate %__spirv_BuiltInGlobalInvocationId Constant
OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import
OpDecorate %8 NoUnsignedWrap
OpGroupDecorate %7 %lhs %rhs
%uint = OpTypeInt 32 0
%v3uint = OpTypeVector %uint 3
%_ptr_Input_v3uint = OpTypePointer Input %v3uint
%void = OpTypeVoid
%_ptr_CrossWorkgroup_uint = OpTypePointer CrossWorkgroup %uint
%14 = OpTypeFunction %void %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint %_ptr_CrossWorkgroup_uint
%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input
%2 = OpFunction %void None %14
%out = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%lhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%rhs = OpFunctionParameter %_ptr_CrossWorkgroup_uint
%15 = OpLabel
%16 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId
%17 = OpCompositeExtract %uint %16 0
%18 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %lhs %17
%19 = OpLoad %uint %18 Aligned 4
%20 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %rhs %17
%21 = OpLoad %uint %20 Aligned 4
%8 = OpIMul %uint %19 %21
%22 = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_uint %out %17
OpStore %22 %8 Aligned 4
OpReturn
OpFunctionEnd
Loading
Loading