google / google/clspv

invalid SPIRV generated for frexp

Open
#1,542 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
LLVM
Stars
729
Forks
110
Avg merge
17h 51m
Merged PRs (30d)
23

Description

https://github.com/kpet/clvk/pull/813

clspv is generating invalid SPIRV for frexp:
```
%64 = OpAccessChain %_ptr_StorageBuffer__arr_uint_uint_8 %25 %uint_0 %39
%66 = OpExtInst %float %65 Frexp %42 %64
```
spirv-val outputs the following error:
```
error: line 106: GLSL.std.450 Frexp: expected operand Exp data type to be a 32-bit int scalar or vector type
%66 = OpExtInst %float %65 Frexp %42 %64
```

`Exp` is a pointer on an array 8 unit, while SPIRV-Tools expects it to be a pointer on "a 32-bit int scalar of vector"

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the generated SPIR-V shown in the issue and running spirv-val to confirm the invalid Frexp operand. Trace clspv's frexp lowering from the generated instruction and check how the Exp pointer type is selected; done means the output validates with the expected 32-bit integer scalar or vector operand.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.