nak: Remove hfma2 src 1 modifiers

This fixes a compilation issue in Marvel Rivals where the legalization
logic and the encoding logic don't line up, which results in an
assertion failure on this instruction:

    r17 = hfma2 r17.xx -r18.xx 0x3c003c00

The fix here is a little overly restrictive because it turns out we
actually do have modifiers for all 3 sources. Those modifiers will
be added in later commits.

Fixes: 567cae69c3 ("nak: Add 16-bits float operations")
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34750>
(cherry picked from commit 1ff7135691d9fd3e0135ef5a13f6c95ad259094c)
This commit is contained in:
Mel Henning
2025-04-29 01:13:36 -04:00
committed by Eric Engestrom
parent fd80d0027b
commit d0627d243d
2 changed files with 5 additions and 3 deletions

View File

@@ -84,7 +84,7 @@
"description": "nak: Remove hfma2 src 1 modifiers", "description": "nak: Remove hfma2 src 1 modifiers",
"nominated": true, "nominated": true,
"nomination_type": 2, "nomination_type": 2,
"resolution": 0, "resolution": 1,
"main_sha": null, "main_sha": null,
"because_sha": "567cae69c3efd0070e3b9b8444dc8a24f0f83838", "because_sha": "567cae69c3efd0070e3b9b8444dc8a24f0f83838",
"notes": null "notes": null

View File

@@ -1113,14 +1113,16 @@ impl SM70Op for OpHFma2 {
b.copy_alu_src_if_not_reg(src1, gpr, SrcType::F16v2); b.copy_alu_src_if_not_reg(src1, gpr, SrcType::F16v2);
b.copy_alu_src_if_both_not_reg(src1, src2, gpr, SrcType::F16v2); b.copy_alu_src_if_both_not_reg(src1, src2, gpr, SrcType::F16v2);
// HFMA2 doesn't have fabs or fneg on SRC2. if !src1.src_mod.is_none() {
b.copy_alu_src_and_lower_fmod(src1, gpr, SrcType::F16v2);
}
if !src2.src_mod.is_none() { if !src2.src_mod.is_none() {
b.copy_alu_src_and_lower_fmod(src2, gpr, SrcType::F16v2); b.copy_alu_src_and_lower_fmod(src2, gpr, SrcType::F16v2);
} }
} }
fn encode(&self, e: &mut SM70Encoder<'_>) { fn encode(&self, e: &mut SM70Encoder<'_>) {
// HFMA2 doesn't have fneg and fabs on SRC2. assert!(self.srcs[1].src_mod.is_none());
assert!(self.srcs[2].src_mod.is_none()); assert!(self.srcs[2].src_mod.is_none());
e.encode_fp16_alu( e.encode_fp16_alu(