Module: Mesa Branch: main Commit: c074ea621548fcb46b87926b02f681352ca38e53 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c074ea621548fcb46b87926b02f681352ca38e53
Author: Faith Ekstrand <[email protected]> Date: Tue Nov 14 13:27:28 2023 -0600 nak: Handle the num_gpr offsetting inside nak This makes the thing in the nak_shader_info exactly the thing that gets plugged into the hardware. Makes the driver a bit simpler. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26197> --- src/nouveau/compiler/nak.rs | 7 ++++++- src/nouveau/vulkan/nvk_shader.c | 5 +---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/nouveau/compiler/nak.rs b/src/nouveau/compiler/nak.rs index 57ea3f5fa68..a3d9e237388 100644 --- a/src/nouveau/compiler/nak.rs +++ b/src/nouveau/compiler/nak.rs @@ -31,6 +31,7 @@ use crate::nak_ir::ShaderStageInfo; use nak_bindings::*; use nak_from_nir::*; use nak_ir::ShaderIoInfo; +use std::cmp::max; use std::env; use std::ffi::CStr; use std::os::raw::c_void; @@ -279,7 +280,11 @@ pub extern "C" fn nak_compile_shader( let info = nak_shader_info { stage: nir.info.stage(), - num_gprs: s.info.num_gprs, + num_gprs: if s.info.sm >= 75 { + max(4, s.info.num_gprs + 2) + } else { + max(4, s.info.num_gprs) + }, num_barriers: s.info.num_barriers, slm_size: s.info.slm_size, __bindgen_anon_1: match &s.info.stage { diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c index 4580cf2cb66..efb4d5f589c 100644 --- a/src/nouveau/vulkan/nvk_shader.c +++ b/src/nouveau/vulkan/nvk_shader.c @@ -402,10 +402,7 @@ nvk_compile_nir_with_nak(struct nvk_physical_device *pdev, shader->stage = nir->info.stage; - if (pdev->info.cls_eng3d >= TURING_A) - shader->num_gprs = MAX2(4, bin->info.num_gprs + 2); - else - shader->num_gprs = MAX2(4, bin->info.num_gprs); + shader->num_gprs = bin->info.num_gprs; shader->num_barriers = bin->info.num_barriers; shader->slm_size = bin->info.slm_size;
