nak: Fix ldg/stg/atomg encoding to use globalmem

Previously, we were encoding these as the generic pointer ld/st/atom,
which often works but would likely break if you happened to allocate
a page in the wrong spot.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28589>
This commit is contained in:
M Henning
2023-09-23 01:23:03 -04:00
committed by Marge Bot
parent b4bf44a574
commit 078fe5454e
2 changed files with 11 additions and 9 deletions
+9 -7
View File
@@ -1763,11 +1763,13 @@ impl SM70Instr {
}
fn encode_ldg(&mut self, op: &OpLd) {
self.set_opcode(0x980);
self.set_opcode(0x381);
self.set_dst(op.dst);
self.set_pred_dst(81..84, Dst::None);
self.set_reg_src(24..32, op.addr);
self.set_field(32..64, op.offset);
self.set_field(40..64, op.offset);
self.set_mem_access(&op.access);
}
@@ -1829,11 +1831,11 @@ impl SM70Instr {
}
fn encode_stg(&mut self, op: &OpSt) {
self.set_opcode(0x385);
self.set_opcode(0x386);
self.set_reg_src(24..32, op.addr);
self.set_field(32..64, op.offset);
self.set_reg_src(64..72, op.data);
self.set_reg_src(32..40, op.data);
self.set_field(40..64, op.offset);
self.set_mem_access(&op.access);
}
@@ -1907,12 +1909,12 @@ impl SM70Instr {
fn encode_atomg(&mut self, op: &OpAtom) {
if op.atom_op == AtomOp::CmpExch {
self.set_opcode(0x38b);
self.set_opcode(0x3a9);
self.set_reg_src(32..40, op.cmpr);
self.set_reg_src(64..72, op.data);
} else {
self.set_opcode(0x38a);
self.set_opcode(0x3a8);
self.set_reg_src(32..40, op.data);
+2 -2
View File
@@ -2433,7 +2433,7 @@ impl<'a> ShaderFromNir<'a> {
eviction_priority: self
.get_eviction_priority(intrin.access()),
};
let (addr, offset) = self.get_io_addr_offset(&srcs[0], 32);
let (addr, offset) = self.get_io_addr_offset(&srcs[0], 24);
let dst = b.alloc_ssa(RegFile::GPR, size_B.div_ceil(4));
b.push_op(OpLd {
@@ -2831,7 +2831,7 @@ impl<'a> ShaderFromNir<'a> {
eviction_priority: self
.get_eviction_priority(intrin.access()),
};
let (addr, offset) = self.get_io_addr_offset(&srcs[1], 32);
let (addr, offset) = self.get_io_addr_offset(&srcs[1], 24);
b.push_op(OpSt {
addr: addr,