Module: Mesa
Branch: main
Commit: c874db93817e66584d5e7c40807849f88939097d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c874db93817e66584d5e7c40807849f88939097d

Author: Faith Ekstrand <faith.ekstr...@collabora.com>
Date:   Fri Nov 17 10:16:51 2023 -0600

nak: Add the predicate destination to OpShfl

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26264>

---

 src/nouveau/compiler/nak_encode_sm70.rs  | 2 +-
 src/nouveau/compiler/nak_from_nir.rs     | 3 +++
 src/nouveau/compiler/nak_ir.rs           | 5 +++--
 src/nouveau/vulkan/nvk_physical_device.c | 1 +
 src/nouveau/vulkan/nvk_shader.c          | 1 +
 5 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/nouveau/compiler/nak_encode_sm70.rs 
b/src/nouveau/compiler/nak_encode_sm70.rs
index dcacbc44271..1e5d9ecfedc 100644
--- a/src/nouveau/compiler/nak_encode_sm70.rs
+++ b/src/nouveau/compiler/nak_encode_sm70.rs
@@ -916,7 +916,7 @@ impl SM70Instr {
         };
 
         self.set_dst(op.dst);
-        self.set_pred_dst(81..84, Dst::None);
+        self.set_pred_dst(81..84, op.in_bounds);
         self.set_reg_src(24..32, op.src);
         self.set_field(
             58..60,
diff --git a/src/nouveau/compiler/nak_from_nir.rs 
b/src/nouveau/compiler/nak_from_nir.rs
index 0c481618be3..5ec911cb890 100644
--- a/src/nouveau/compiler/nak_from_nir.rs
+++ b/src/nouveau/compiler/nak_from_nir.rs
@@ -922,6 +922,7 @@ impl<'a> ShaderFromNir<'a> {
 
                 b.push_op(OpShfl {
                     dst: scratch[0].into(),
+                    in_bounds: Dst::None,
                     src: srcs[0],
                     lane: 1_u32.into(),
                     c: (0x3_u32 | 0x1c_u32 << 8).into(),
@@ -952,6 +953,7 @@ impl<'a> ShaderFromNir<'a> {
 
                 b.push_op(OpShfl {
                     dst: scratch[0].into(),
+                    in_bounds: Dst::None,
                     src: srcs[0],
                     lane: 2_u32.into(),
                     c: (0x3_u32 | 0x1c_u32 << 8).into(),
@@ -1888,6 +1890,7 @@ impl<'a> ShaderFromNir<'a> {
 
                 b.push_op(OpShfl {
                     dst: dst.into(),
+                    in_bounds: Dst::None,
                     src: data,
                     lane: idx,
                     c: 0x1f.into(),
diff --git a/src/nouveau/compiler/nak_ir.rs b/src/nouveau/compiler/nak_ir.rs
index a15636070e5..8fba9ef3597 100644
--- a/src/nouveau/compiler/nak_ir.rs
+++ b/src/nouveau/compiler/nak_ir.rs
@@ -2804,6 +2804,7 @@ impl fmt::Display for OpSel {
 #[derive(SrcsAsSlice, DstsAsSlice)]
 pub struct OpShfl {
     pub dst: Dst,
+    pub in_bounds: Dst,
 
     #[src_type(SSA)]
     pub src: Src,
@@ -2821,8 +2822,8 @@ impl fmt::Display for OpShfl {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(
             f,
-            "SHFL.{} {} {{ {}, {}, {} }}",
-            self.op, self.dst, self.src, self.lane, self.c
+            "SHFL.{} {{ {}, {} }} {{ {}, {}, {} }}",
+            self.op, self.dst, self.in_bounds, self.src, self.lane, self.c
         )
     }
 }
diff --git a/src/nouveau/vulkan/nvk_physical_device.c 
b/src/nouveau/vulkan/nvk_physical_device.c
index 60d037ea6f2..05596d001b7 100644
--- a/src/nouveau/vulkan/nvk_physical_device.c
+++ b/src/nouveau/vulkan/nvk_physical_device.c
@@ -544,6 +544,7 @@ nvk_get_device_properties(const struct nvk_instance 
*instance,
       .subgroupSupportedStages = nvk_nak_stages(info),
       .subgroupSupportedOperations = VK_SUBGROUP_FEATURE_BALLOT_BIT |
                                      VK_SUBGROUP_FEATURE_BASIC_BIT |
+                                     VK_SUBGROUP_FEATURE_SHUFFLE_BIT |
                                      VK_SUBGROUP_FEATURE_VOTE_BIT,
       .subgroupQuadOperationsInAllStages = false,
       .pointClippingBehavior = 
VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY,
diff --git a/src/nouveau/vulkan/nvk_shader.c b/src/nouveau/vulkan/nvk_shader.c
index 47435bd5523..ea39de37a36 100644
--- a/src/nouveau/vulkan/nvk_shader.c
+++ b/src/nouveau/vulkan/nvk_shader.c
@@ -143,6 +143,7 @@ nvk_physical_device_spirv_options(const struct 
nvk_physical_device *pdev,
          .shader_viewport_index_layer = true,
          .subgroup_ballot = true,
          .subgroup_basic = true,
+         .subgroup_shuffle = true,
          .subgroup_vote = true,
          .tessellation = true,
          .transform_feedback = true,

Reply via email to