mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 05:18:08 +02:00
nak/legalize: Take a RegFile in copy_alu_src_and_lower_fmod
Otherwise, we'll screw up uniform GPRs.
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33107>
(cherry picked from commit 22a30bfa4f)
This commit is contained in:
parent
6491da3220
commit
9fa9cd870f
4 changed files with 23 additions and 17 deletions
|
|
@ -1984,7 +1984,7 @@
|
|||
"description": "nak/legalize: Take a RegFile in copy_alu_src_and_lower_fmod",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -231,11 +231,12 @@ pub trait LegalizeBuildHelpers: SSABuilder {
|
|||
fn copy_alu_src_and_lower_fmod(
|
||||
&mut self,
|
||||
src: &mut Src,
|
||||
reg_file: RegFile,
|
||||
src_type: SrcType,
|
||||
) {
|
||||
match src_type {
|
||||
SrcType::F16 | SrcType::F16v2 => {
|
||||
let val = self.alloc_ssa(RegFile::GPR, 1);
|
||||
let val = self.alloc_ssa(reg_file, 1);
|
||||
self.push_op(OpHAdd2 {
|
||||
dst: val.into(),
|
||||
srcs: [Src::new_zero().fneg(), *src],
|
||||
|
|
@ -246,7 +247,7 @@ pub trait LegalizeBuildHelpers: SSABuilder {
|
|||
*src = val.into();
|
||||
}
|
||||
SrcType::F32 => {
|
||||
let val = self.alloc_ssa(RegFile::GPR, 1);
|
||||
let val = self.alloc_ssa(reg_file, 1);
|
||||
self.push_op(OpFAdd {
|
||||
dst: val.into(),
|
||||
srcs: [Src::new_zero().fneg(), *src],
|
||||
|
|
@ -257,7 +258,7 @@ pub trait LegalizeBuildHelpers: SSABuilder {
|
|||
*src = val.into();
|
||||
}
|
||||
SrcType::F64 => {
|
||||
let val = self.alloc_ssa(RegFile::GPR, 2);
|
||||
let val = self.alloc_ssa(reg_file, 2);
|
||||
self.push_op(OpDAdd {
|
||||
dst: val.into(),
|
||||
srcs: [Src::new_zero().fneg(), *src],
|
||||
|
|
@ -292,9 +293,14 @@ pub trait LegalizeBuildHelpers: SSABuilder {
|
|||
*src = val.into();
|
||||
}
|
||||
|
||||
fn copy_alu_src_if_fabs(&mut self, src: &mut Src, src_type: SrcType) {
|
||||
fn copy_alu_src_if_fabs(
|
||||
&mut self,
|
||||
src: &mut Src,
|
||||
reg_file: RegFile,
|
||||
src_type: SrcType,
|
||||
) {
|
||||
if src.src_mod.has_fabs() {
|
||||
self.copy_alu_src_and_lower_fmod(src, src_type);
|
||||
self.copy_alu_src_and_lower_fmod(src, reg_file, src_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -538,9 +538,9 @@ impl SM50Op for OpFFma {
|
|||
fn legalize(&mut self, b: &mut LegalizeBuilder) {
|
||||
use RegFile::GPR;
|
||||
let [src0, src1, src2] = &mut self.srcs;
|
||||
b.copy_alu_src_if_fabs(src0, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src1, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src2, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src0, GPR, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src1, GPR, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src2, GPR, SrcType::F32);
|
||||
swap_srcs_if_not_reg(src0, src1, GPR);
|
||||
b.copy_alu_src_if_not_reg(src0, GPR, SrcType::F32);
|
||||
b.copy_alu_src_if_f20_overflow(src1, GPR, SrcType::F32);
|
||||
|
|
@ -645,8 +645,8 @@ impl SM50Op for OpFMul {
|
|||
fn legalize(&mut self, b: &mut LegalizeBuilder) {
|
||||
use RegFile::GPR;
|
||||
let [src0, src1] = &mut self.srcs;
|
||||
b.copy_alu_src_if_fabs(src0, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src1, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src0, GPR, SrcType::F32);
|
||||
b.copy_alu_src_if_fabs(src1, GPR, SrcType::F32);
|
||||
swap_srcs_if_not_reg(src0, src1, GPR);
|
||||
b.copy_alu_src_if_not_reg(src0, GPR, SrcType::F32);
|
||||
|
||||
|
|
@ -986,9 +986,9 @@ impl SM50Op for OpDFma {
|
|||
fn legalize(&mut self, b: &mut LegalizeBuilder) {
|
||||
use RegFile::GPR;
|
||||
let [src0, src1, src2] = &mut self.srcs;
|
||||
b.copy_alu_src_if_fabs(src0, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src1, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src2, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src0, GPR, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src1, GPR, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src2, GPR, SrcType::F64);
|
||||
swap_srcs_if_not_reg(src0, src1, GPR);
|
||||
b.copy_alu_src_if_not_reg(src0, GPR, SrcType::F64);
|
||||
b.copy_alu_src_if_f20_overflow(src1, GPR, SrcType::F64);
|
||||
|
|
@ -1085,8 +1085,8 @@ impl SM50Op for OpDMul {
|
|||
fn legalize(&mut self, b: &mut LegalizeBuilder) {
|
||||
use RegFile::GPR;
|
||||
let [src0, src1] = &mut self.srcs;
|
||||
b.copy_alu_src_if_fabs(src0, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src1, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src0, GPR, SrcType::F64);
|
||||
b.copy_alu_src_if_fabs(src1, GPR, SrcType::F64);
|
||||
swap_srcs_if_not_reg(src0, src1, GPR);
|
||||
b.copy_alu_src_if_not_reg(src0, GPR, SrcType::F64);
|
||||
b.copy_alu_src_if_f20_overflow(src1, GPR, SrcType::F64);
|
||||
|
|
|
|||
|
|
@ -1115,7 +1115,7 @@ impl SM70Op for OpHFma2 {
|
|||
|
||||
// HFMA2 doesn't have fabs or fneg on SRC2.
|
||||
if !src2.src_mod.is_none() {
|
||||
b.copy_alu_src_and_lower_fmod(src2, SrcType::F16v2);
|
||||
b.copy_alu_src_and_lower_fmod(src2, gpr, SrcType::F16v2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue