KhronosGroup / KhronosGroup/OpenCL-Docs
Supported Types for SPIR-V Atomic Instructions
- Dominant language
- Python
- Stars
- 420
- Forks
- 131
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 11
Description
The OpenCL SPIR-V Environment Specification currently says that for all atomic instructions "only 32-bit integer types are supported for the _Result Type_ and/or type of _Value_", yet the OpenCL C spec describes an `atomic_float` type that supports at least some atomic operations. While I believe all of the float atomic operations can be implemented using bitcasts and atomic operations on 32-bit integer values, I don't think this is the intent, and the SPIR-V LLVM Translator is generating atomic operations on floating-point types directly.
Are the current rules in the OpenCL SPIR-V Environment specification too strict, and should atomic operations on 32-bit (and probably 64-bit?) floating-point types be supported, at least in some cases and for some atomic operations?
One especially interesting case to consider is the OpenCL C floating-point compare-and-exchange operation, which is supported but is specified to operate using a bitwise comparison. Note that the SPIR-V **OpAtomicCompareExchange** is only supported for integer types, unlike **OpAtomicLoad**, **OpAtomicStore**, and **OpAtomicExchange**, which support for both integer types and floating-point types.
Contributor guide
Research direction
Start by comparing the OpenCL SPIR-V Environment Specification's atomic type rules with the OpenCL C `atomic_float` behavior and the SPIR-V operations listed in the issue. Review the SPIR-V LLVM Translator behavior, especially floating-point compare-and-exchange, and consider the issue resolved when the specification's supported types and operations are clearly decided and documented.
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
- Needs clarification
- Newbie friendliness
- 25/100