Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supported Types for SPIR-V Atomic Instructions #541

Open
bashbaug opened this issue Jan 14, 2021 · 0 comments
Open

Supported Types for SPIR-V Atomic Instructions #541

bashbaug opened this issue Jan 14, 2021 · 0 comments
Labels
SPIR-V Environment Spec

Comments

@bashbaug
Copy link
Contributor

@bashbaug bashbaug commented Jan 14, 2021

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.

@bashbaug bashbaug added the SPIR-V Environment Spec label Jan 14, 2021
@bashbaug bashbaug added this to To do in OpenCL specification maintenance via automation Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SPIR-V Environment Spec
Development

No branches or pull requests

1 participant