From 66a5608c11c69b4775ac2f1c5e0f746bf0f5dfab Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Thu, 6 Jun 2024 17:57:51 -0500 Subject: [PATCH] nak/legalize: Uniform instructions can't have cbuf sources Part-of: --- src/nouveau/compiler/nak/legalize.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/nouveau/compiler/nak/legalize.rs b/src/nouveau/compiler/nak/legalize.rs index 4148039419f..4fd6f5716f2 100644 --- a/src/nouveau/compiler/nak/legalize.rs +++ b/src/nouveau/compiler/nak/legalize.rs @@ -177,6 +177,17 @@ fn copy_alu_src( src.src_ref = val.into(); } +fn copy_alu_src_if_cbuf( + b: &mut impl SSABuilder, + src: &mut Src, + reg_file: RegFile, + src_type: SrcType, +) { + if matches!(src.src_ref, SrcRef::CBuf(_)) { + copy_alu_src(b, src, reg_file, src_type); + } +} + fn copy_alu_src_if_not_reg( b: &mut impl SSABuilder, src: &mut Src, @@ -589,6 +600,14 @@ fn legalize_sm70_instr( RegFile::GPR }; + if !matches!(&instr.op, Op::Ldc(_) | Op::Copy(_)) && instr.is_uniform() { + // Uniform instructions can't support cbufs + let src_types = instr.src_types(); + for (i, src) in instr.srcs_mut().iter_mut().enumerate() { + copy_alu_src_if_cbuf(b, src, gpr, src_types[i]); + } + } + match &mut instr.op { Op::FAdd(op) => { let [ref mut src0, ref mut src1] = op.srcs;