SPIR-V has this concept of "logical pointers" that represent things that have an abstract form of storage backing them, such as shader stage I/O or thread-private variables in Vulkan shaders. Thread-private variables in CL work differently: they have physical pointers instead.
Logical pointers have stringent rules about what you can do with them because they might not actually be implemented as pointers at all (instead stage i/o might be done using custom instructions, for example). You can't look at their bits, cast them, do arbitrary ptr arithmetic and many more things.
Variable pointers somewhat loosen those rules in an attempt to make logical pointers more usable for lowering high-level languages. They're not very effective in doing so and many consider them a bit of a failed experiment.
Note that in all cases thread-private pointers are only valid in a given invocation, and only for the lifetime of that one thread. Pointers are useful even if pointing into temporary memory or not aligned with the host's address map, they're a fundamental part of lower-level program representations like LLVM or SPIR-V.
Not really. It's more an issue of overcoming ecosystem inertia and convincing vendors that the current restrictions are absurd and harmful. OpenCL has this "unified cpu/gpu addressing" feature already, they call it SVM.
3
u/Gobrosse May 17 '24 edited May 17 '24
SPIR-V has this concept of "logical pointers" that represent things that have an abstract form of storage backing them, such as shader stage I/O or thread-private variables in Vulkan shaders. Thread-private variables in CL work differently: they have physical pointers instead.
Logical pointers have stringent rules about what you can do with them because they might not actually be implemented as pointers at all (instead stage i/o might be done using custom instructions, for example). You can't look at their bits, cast them, do arbitrary ptr arithmetic and many more things.
Variable pointers somewhat loosen those rules in an attempt to make logical pointers more usable for lowering high-level languages. They're not very effective in doing so and many consider them a bit of a failed experiment.
Note that in all cases thread-private pointers are only valid in a given invocation, and only for the lifetime of that one thread. Pointers are useful even if pointing into temporary memory or not aligned with the host's address map, they're a fundamental part of lower-level program representations like LLVM or SPIR-V.