KhronosGroup / KhronosGroup/SPIRV-LLVM-Translator

spt file containing GlobalVariableHostAccessINTEL changes after -to-binary and then -to-text

Open
#2,558 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

Content of global_var_host_access.spt:
```
119734787 65536 393230 10 0
2 Capability Addresses
2 Capability Linkage
2 Capability Kernel
2 Capability GlobalVariableHostAccessINTEL
11 Extension "SPV_INTEL_global_variable_host_access"
5 ExtInstImport 1 "OpenCL.std"
3 MemoryModel 2 2
3 Source 0 0
4 Name 5 "int_var"
5 Name 9 "bool_var"

6 Decorate 5 LinkageAttributes "int_var" Export
7 Decorate 5 HostAccessINTEL ReadINTEL "IntVarName"
7 Decorate 9 LinkageAttributes "bool_var" Export
7 Decorate 9 HostAccessINTEL ReadWriteINTEL "BoolVarName"
4 TypeInt 2 32 0
4 Constant 2 4 42
4 TypePointer 3 5 2
2 TypeBool 6
4 TypePointer 7 5 6
5 Variable 3 5 5 4
3 ConstantFalse 6 8
5 Variable 7 9 5 8
```
Apply commands `llvm-spirv -to-binary global_var_host_access.spt` and then `llvm-spirv -to-text global_var_host_access.spv -o global_var_host_access.spv.spt`. Output global_var_host_access.spv.spt is
```
119734787 65536 393230 10 0
2 Capability Addresses
2 Capability Linkage
2 Capability Kernel
2 Capability GlobalVariableDecorationsINTEL
2 Capability GlobalVariableHostAccessINTEL
11 Extension "SPV_INTEL_global_variable_host_access"
5 ExtInstImport 1 "OpenCL.std"
3 MemoryModel 2 2
3 Source 0 0
4 Name 5 "int_var"
5 Name 9 "bool_var"

6 Decorate 5 LinkageAttributes "int_var" Export
7 Decorate 5 HostAccessINTEL 0 ""
```
Differences in the new global_var_host_access.spv.spt:
1. GlobalVariableDecorationsINTEL is added
2. In `Decorate 5`, `ReadINTEL "IntVarName"` are missing
3. `Decorate 9` is missing
4. two global variables are missing

Please check if there is expected.

Contributor guide

Open the contributing guide

Research direction

Reproduce the round trip with global_var_host_access.spt using llvm-spirv -to-binary and -to-text, then compare the generated .spv.spt with the input decorations and variables. Determine whether the GlobalVariableHostAccessINTEL decorations and global variables should be preserved, and document the expected output.

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.