From a13dc0cd0ec51b9c21a61d4c6240d5fa193f963b Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 19 Jul 2022 21:47:45 +0300 Subject: [PATCH] intel/nir/rt: spill/fill the entire ray query data We need the traversal stack to saved/restored along with mem hits. Total spill/fill is 256bytes. We can potentially optimize this but we have to be very careful about what state the query is in. Signed-off-by: Lionel Landwerlin Fixes: c78be5da300ae3 ("intel/fs: lower ray query intrinsics") Reviewed-by: Ivan Briano Part-of: (cherry picked from commit f843bec7de903752734c8cb8e66c57e91f5a10fb) --- .pick_status.json | 2 +- .../compiler/brw_nir_lower_ray_queries.c | 36 +++---------------- 2 files changed, 5 insertions(+), 33 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5a1a19d393e..fcdd90172d3 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1066,7 +1066,7 @@ "description": "intel/nir/rt: spill/fill the entire ray query data", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c78be5da300ae386a12b91a22efb064335e2043a" }, diff --git a/src/intel/compiler/brw_nir_lower_ray_queries.c b/src/intel/compiler/brw_nir_lower_ray_queries.c index 6aa61a35c5b..e2341dd83c3 100644 --- a/src/intel/compiler/brw_nir_lower_ray_queries.c +++ b/src/intel/compiler/brw_nir_lower_ray_queries.c @@ -200,20 +200,8 @@ fill_query(nir_builder *b, nir_ssa_def *shadow_stack_addr, nir_ssa_def *ctrl) { - brw_nir_memcpy_global(b, - brw_nir_rt_mem_hit_addr_from_addr(b, hw_stack_addr, false), 16, - brw_nir_rt_mem_hit_addr_from_addr(b, shadow_stack_addr, false), 16, - BRW_RT_SIZEOF_HIT_INFO); - brw_nir_memcpy_global(b, - brw_nir_rt_mem_hit_addr_from_addr(b, hw_stack_addr, true), 16, - brw_nir_rt_mem_hit_addr_from_addr(b, shadow_stack_addr, true), 16, - BRW_RT_SIZEOF_HIT_INFO); - brw_nir_memcpy_global(b, - brw_nir_rt_mem_ray_addr(b, hw_stack_addr, - BRW_RT_BVH_LEVEL_WORLD), 16, - brw_nir_rt_mem_ray_addr(b, shadow_stack_addr, - BRW_RT_BVH_LEVEL_WORLD), 16, - BRW_RT_SIZEOF_RAY); + brw_nir_memcpy_global(b, hw_stack_addr, 64, shadow_stack_addr, 64, + BRW_RT_SIZEOF_RAY_QUERY); } static void @@ -221,24 +209,8 @@ spill_query(nir_builder *b, nir_ssa_def *hw_stack_addr, nir_ssa_def *shadow_stack_addr) { - struct brw_nir_rt_mem_hit_defs committed_hit = {}; - brw_nir_rt_load_mem_hit_from_addr(b, &committed_hit, hw_stack_addr, true); - - /* Always copy the potential hit back */ - brw_nir_memcpy_global(b, - brw_nir_rt_mem_hit_addr_from_addr(b, shadow_stack_addr, false), 16, - brw_nir_rt_mem_hit_addr_from_addr(b, hw_stack_addr, false), 16, - BRW_RT_SIZEOF_HIT_INFO); - - /* Also copy the committed hit back if it is valid */ - nir_push_if(b, committed_hit.valid); - { - brw_nir_memcpy_global(b, - brw_nir_rt_mem_hit_addr_from_addr(b, shadow_stack_addr, true), 16, - brw_nir_rt_mem_hit_addr_from_addr(b, hw_stack_addr, true), 16, - BRW_RT_SIZEOF_HIT_INFO); - } - nir_pop_if(b, NULL); + brw_nir_memcpy_global(b, shadow_stack_addr, 64, hw_stack_addr, 64, + BRW_RT_SIZEOF_RAY_QUERY); }