From 1d1d79bbaa385f180acddbe69fb8190d69873d20 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Tue, 25 Mar 2025 15:47:12 -0500 Subject: [PATCH] nak: Always copy sources when handling vec/pack/mov ops It's possible that the source is uniform but the destination is not. In this case, we need to insert a copy or else we might accidentally propagate a uniform into some place we don't expect it. This fixes a bunch of fp64 KHR-Single-GL46.subgroups.arithmetic.* tests. Fixes: d09d3f52468a ("nak/from_nir: Emit uniform instructions when !divergent") Part-of: --- src/nouveau/compiler/nak/from_nir.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/from_nir.rs b/src/nouveau/compiler/nak/from_nir.rs index 22d96ee11ad..15963417453 100644 --- a/src/nouveau/compiler/nak/from_nir.rs +++ b/src/nouveau/compiler/nak/from_nir.rs @@ -543,8 +543,15 @@ impl<'a> ShaderFromNir<'a> { let mut comps = Vec::new(); match src_bit_size { 1 | 32 | 64 => { - for (ssa, _) in srcs { - comps.push(ssa); + for (ssa, byte) in srcs { + assert!(byte == 0); + // Always insert a copy regardless of whether or not + // we need to permute bytes. It's possible that the + // source is uniform but the destination is not and + // we'll need a copy in that case. If the copy + // isn't needed, copy-prop should clean it up for + // us. + comps.push(b.copy(ssa.into())[0]); } } 8 => {