KhronosGroup / KhronosGroup/OpenCL-CTS

Missing SPIR-V test testing struct entry point parameters

Open
#2,148 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
232
Forks
235
Avg merge
8d 7h
Merged PRs (30d)
18

Description

We got a bug report for this in mesa: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12149

The tldr: The SPIR-V env spec allows struct parameters, but the SPIR-V-LLVM-Translator never ends up making use of this. What the translator is doing is to create a pointer parameter with the ByVal decoration instead.

We should add a specific test for this to ensure all implementations are handling this correctly and in order to catch regressions, because it's really not wildly tested.

SPIR-V from the bug:
```spirv
; SPIR-V
; Version: 1.0
; Generator: Khronos LLVM/SPIR-V Translator; 14
; Bound: 31
; Schema: 0
OpCapability Addresses
OpCapability Linkage
OpCapability Kernel
OpCapability Int64
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical64 OpenCL
OpEntryPoint Kernel %k "k"
OpExecutionMode %k ContractionOff
OpSource OpenCL_C 200000
OpName %struct_Vec3 "struct.Vec3"
OpName %k "k"
OpName %out "out"
OpName %v "v"
OpName %entry "entry"
OpName %add "add"
OpName %add1 "add1"
OpDecorate %out FuncParamAttr NoCapture
OpDecorate %out Alignment 4
%ulong = OpTypeInt 64 0
%uint = OpTypeInt 32 0
%ulong_0 = OpConstant %ulong 0
%uint_1 = OpConstant %uint 1
%uint_2 = OpConstant %uint 2
%void = OpTypeVoid
%float = OpTypeFloat 32
%_ptr_CrossWorkgroup_float = OpTypePointer CrossWorkgroup %float
%struct_Vec3 = OpTypeStruct %float %float %float
%_ptr_Function_struct_Vec3 = OpTypePointer Function %struct_Vec3
%7 = OpTypeFunction %void %_ptr_CrossWorkgroup_float %struct_Vec3
%_ptr_Function_float = OpTypePointer Function %float
%k = OpFunction %void None %7
%out = OpFunctionParameter %_ptr_CrossWorkgroup_float
%v = OpFunctionParameter %struct_Vec3
%entry = OpLabel
%14 = OpCompositeExtract %float %v 0
%20 = OpCompositeExtract %float %v 1
%add = OpFAdd %float %14 %20
%24 = OpCompositeExtract %float %v 2
%add1 = OpFAdd %float %add %24
OpStore %out %add1 Aligned 4
OpReturn
OpFunctionEnd
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Read the linked Mesa report and the supplied SPIR-V module to understand the struct entry-point parameter case. Locate the existing OpenCL CTS SPIR-V or kernel parameter tests, then add a regression case covering a struct parameter and verify it through the relevant conformance test run.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.