KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator

SPIR-V validator failure with SPV_INTEL_function_pointers extension

Open
#2,043 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
625
Forks
279
Avg merge
3d 5h
Merged PRs (30d)
34

Description

The attached bitcode, featuring an indirect call, does translate to SPIR-V but validator complains following:
```
$ llvm-as-15 llvm-spirv-bug-15.ll -o - \
| llvm-spirv-15 --spirv-max-version=1.1 --spirv-ext=+all - -o - \
| spirv-val -
error: line 62: ID '4[%_ZL6add123i]' has not been defined
%_ZL6add123i_0 = OpConstantFunctionPointerINTEL %_ptr_Function_3 %_ZL6add123i
```
Perhaps, there is a missing forward declaration in the produced SPIR-V binary.

[llvm-spirv-bug-15.zip](https://github.com/KhronosGroup/SPIRV-LLVM-Translator/files/11684840/llvm-spirv-bug-15.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached llvm-spirv-bug-15.zip and reproduce the llvm-as-15, llvm-spirv-15, and spirv-val pipeline shown in the report. Inspect the generated SPIR-V around OpConstantFunctionPointerINTEL and determine what is needed for spirv-val to accept the indirect-call output; done means the reproduced translation validates successfully.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.