From 64d74ca8160fdf52b0c45c1e76d1def3d02d923b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Thu, 26 Sep 2019 17:48:55 +0200 Subject: [PATCH] aco: Support GFX10 MIMG and GFX9 D16 in aco_assembler. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Daniel Schürmann --- src/amd/compiler/aco_assembler.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/amd/compiler/aco_assembler.cpp b/src/amd/compiler/aco_assembler.cpp index 41c31aeb8d1..42826b213d8 100644 --- a/src/amd/compiler/aco_assembler.cpp +++ b/src/amd/compiler/aco_assembler.cpp @@ -334,10 +334,18 @@ void emit_instruction(asm_context& ctx, std::vector& out, Instruction* encoding |= opcode << 18; encoding |= mimg->lwe ? 1 << 17 : 0; encoding |= mimg->tfe ? 1 << 16 : 0; - encoding |= mimg->r128 ? 1 << 15 : 0; - encoding |= mimg->da ? 1 << 14 : 0; encoding |= mimg->glc ? 1 << 13 : 0; encoding |= mimg->unrm ? 1 << 12 : 0; + if (ctx.chip_class <= GFX9) { + assert(!mimg->dlc); /* Device-level coherent is not supported on GFX9 and lower */ + assert(!mimg->r128); + encoding |= mimg->a16 ? 1 << 15 : 0; + encoding |= mimg->da ? 1 << 14 : 0; + } else { + encoding |= mimg->r128 ? 1 << 15 : 0; /* GFX10: A16 moved to 2nd word, R128 replaces it in 1st word */ + encoding |= mimg->dim << 3; /* GFX10: dimensionality instead of declare array */ + encoding |= mimg->dlc ? 1 << 7 : 0; + } encoding |= (0xF & mimg->dmask) << 8; out.push_back(encoding); encoding = (0xFF & instr->operands[0].physReg().reg); /* VADDR */ @@ -349,7 +357,13 @@ void emit_instruction(asm_context& ctx, std::vector& out, Instruction* encoding |= (0x1F & (instr->operands[1].physReg() >> 2)) << 16; /* T# (resource) */ if (instr->operands.size() > 2) encoding |= (0x1F & (instr->operands[2].physReg() >> 2)) << 21; /* sampler */ - // TODO VEGA: D16 + + assert(!mimg->d16 || ctx.chip_class >= GFX9); + encoding |= mimg->d16 ? 1 << 15 : 0; + if (ctx.chip_class >= GFX10) { + encoding |= mimg->a16 ? 1 << 14 : 0; /* GFX10: A16 still exists, but is in a different place */ + } + out.push_back(encoding); break; } -- 2.30.2