<div dir="ltr">+idr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 19, 2017 at 11:04 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Not to be confused with variablePointersStorageBuffer which is the<br>
subset of VK_KHR_variable_pointers required to enable the extension.<br>
This gives us "full" support for variable pointers.<br>
<br>
The approach chosen here was to do the lowering to _shared intrinsics<br>
directly in spirv_to_nir instead of using the _var intrinsics and using<br>
nir_lower_io. Pointers with a storage class of Workgroup are given an<br>
implicit std430 layout and now go through the same offset pointer paths as<br>
UBO and SSBO access. The whole thing really ended up working out rather<br>
cleanly.<br>
<br>
There are some downsides to this approach. One, is that we can't delete<br>
unused shared variables post-optimization. Also, the driver may be able to<br>
handle better than std430. Both of these can lead to some waisted SLM<br>
space. This also means that we can't do any deref-based load/store<br>
elimination optimizations on SLM but we didn't really before so that's no<br>
great loss; SLM is now exactly as hard to optimize as SSBOs.<br>
<br>
Connor, Yes, I know that this is not quite the approach you were suggesting<br>
on IRC. I considered how we might add some sort of deref intrinsic and I<br>
don't see a good way of doing so without rewriting large chunks of NIR. I<br>
think that rewrite is probably worth it some day but that day is not today.<br>
We people asking for this feature so I really don't want to delay on a<br>
major NIR rewrite.<br>
<br>
Cc: Connor Abbott <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>><br>
Cc: Chad Versace <<a href="mailto:chadversary@chromium.org">chadversary@chromium.org</a>><br>
Cc: Dave Airlie <<a href="mailto:airlied@redhat.com">airlied@redhat.com</a>><br>
<br>
Jason Ekstrand (12):<br>
spirv: Drop the impl field from vtn_builder<br>
spirv: Only emit functions which are actually used<br>
spirv: Use a dereference instead of vtn_variable_resource_index<br>
spirv: Add a switch statement for the block store opcode<br>
spirv: Refactor the base case of offset_pointer_dereference<br>
spirv: Convert the supported_extensions struct to spirv_options<br>
spirv: Refactor a couple of pointer query helpers<br>
spirv: Use offset_pointer_dereference to instead of<br>
get_vulkan_resource_index<br>
spirv: Add theoretical support for single component pointers<br>
spirv: Rename get_shared_nir_atomic_op to get_var_nir_atomic_op<br>
spirv: Add support for lowering workgroup access to offsets<br>
anv: Add support for the variablePointers feature<br>
<br>
src/amd/vulkan/radv_shader.c | 23 ++--<br>
src/compiler/spirv/nir_spirv.h | 34 ++++--<br>
src/compiler/spirv/spirv_to_<wbr>nir.c | 180 ++++++++++++++++++++++++-----<br>
src/compiler/spirv/vtn_cfg.c | 4 +-<br>
src/compiler/spirv/vtn_<wbr>private.h | 30 +++--<br>
src/compiler/spirv/vtn_<wbr>variables.c | 229 ++++++++++++++++++++++++------<wbr>-------<br>
src/intel/vulkan/anv_device.c | 2 +-<br>
src/intel/vulkan/anv_pipeline.<wbr>c | 25 ++--<br>
8 files changed, 372 insertions(+), 155 deletions(-)<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div>