From 37f7983bcca1afd4d570bc654b927a92308d1c68 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 27 Jan 2018 13:19:57 -0800 Subject: intel/compiler: Do image load/store lowering to NIR This commit moves our storage image format conversion codegen into NIR instead of doing it in the back-end. This has the advantage of letting us run it through NIR's optimizer which is pretty effective at shrinking things down. In the common case of rgba8, the number of instructions emitted after NIR is done with it is half of what it was with the lowering happening in the back-end. On the downside, the back-end's lowering is able to directly use predicates and the NIR lowering has to use IFs. Shader-db results on Kaby Lake: total instructions in shared programs: 15166910 -> 15166872 (<.01%) instructions in affected programs: 5895 -> 5857 (-0.64%) helped: 15 HURT: 0 Clearly, we don't have that much image_load_store happening in the shaders in shader-db.... Reviewed-by: Kenneth Graunke --- src/compiler/nir/nir_intrinsics.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/compiler/nir') diff --git a/src/compiler/nir/nir_intrinsics.py b/src/compiler/nir/nir_intrinsics.py index 17212c4862f..170f954e375 100644 --- a/src/compiler/nir/nir_intrinsics.py +++ b/src/compiler/nir/nir_intrinsics.py @@ -312,6 +312,15 @@ intrinsic("image_deref_atomic_fadd", src_comp=[1, 4, 1, 1], dest_comp=1) intrinsic("image_deref_size", src_comp=[1], dest_comp=0, flags=[CAN_ELIMINATE, CAN_REORDER]) intrinsic("image_deref_samples", src_comp=[1], dest_comp=1, flags=[CAN_ELIMINATE, CAN_REORDER]) +# Intel-specific query for loading from the brw_image_param struct passed +# into the shader as a uniform. The variable is a deref to the image +# variable. The const index specifies which of the six parameters to load. +intrinsic("image_deref_load_param_intel", src_comp=[1], dest_comp=0, + indices=[BASE], flags=[CAN_ELIMINATE, CAN_REORDER]) +intrinsic("image_deref_load_raw_intel", src_comp=[1, 1], dest_comp=0, + flags=[CAN_ELIMINATE]) +intrinsic("image_deref_store_raw_intel", src_comp=[1, 1, 0]) + # Vulkan descriptor set intrinsics # # The Vulkan API uses a different binding model from GL. In the Vulkan -- cgit v1.2.3