KhronosGroup / KhronosGroup/OpenCL-Docs

SPIR-V: Which storage classes allow initializers?

Open
#554 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

SPIR-V Environment Spec
Dominant language
Python
Stars
421
Forks
131
Avg merge
5d 13h
Merged PRs (30d)
11

Description

The OpenCL C spec says that a local variable cannot have an initializer:

Variables allocated in the __local address space inside a kernel function cannot be initialized.

However, we have no similar restriction in the OpenCL SPIR-V Environment Spec, and I think we should.

Specifically, I think that we should support initializers for the storage classes:

  • Function (equivalent of OpenCL private memory)
  • UniformConstant (equivalent of OpenCL constant memory - initializer required)
  • CrossWorkgroup (equivalent of OpenCL global memory, when program scope global variables are supported)

We wouldn't support initializers for:

  • Input (this is documented in the SPIR-V spec)
  • Workgroup (equivalent of OpenCL local memory)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the OpenCL C specification with the OpenCL SPIR-V Environment Specification, focusing on initializer rules for the Function, UniformConstant, CrossWorkgroup, Input, and Workgroup storage classes. Done means the SPIR-V environment specification clearly states which storage classes permit or prohibit initializers, including the required initializer for UniformConstant.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.