diff options
author | Karol Herbst <[email protected]> | 2018-02-22 11:58:44 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-07-10 13:23:00 +0200 |
commit | 62362a4abb6f068472d12f884f12ba9a2cb2ca0d (patch) | |
tree | 874c8671ce47fa85e1d6d137633d1ecf5a4310c1 /src | |
parent | 33a9b9fce5a660f19a7a79b34bb414f264abd49b (diff) |
nv50/ir/nir: implement load/store_global
required by OpenCL
v2: fix setting globalAccess
Signed-off-by: Karol Herbst <[email protected]>
Reviewed-by: Pierre Moreau <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp index 68d851f3ac9..950923a0daf 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp @@ -2620,6 +2620,42 @@ Converter::visit(nir_intrinsic_instr *insn) mkOp1(OP_RDSV, dType, newDefs[1], mkSysVal(SV_CLOCK, 0))->fixed = 1; break; } + case nir_intrinsic_load_global: { + const DataType dType = getDType(insn); + LValues &newDefs = convert(&insn->dest); + Value *indirectOffset; + uint32_t offset = getIndirect(&insn->src[0], 0, indirectOffset); + + for (auto i = 0u; i < insn->num_components; ++i) + loadFrom(FILE_MEMORY_GLOBAL, 0, dType, newDefs[i], offset, i, indirectOffset); + + info->io.globalAccess |= 0x1; + break; + } + case nir_intrinsic_store_global: { + DataType sType = getSType(insn->src[0], false, false); + + for (auto i = 0u; i < insn->num_components; ++i) { + if (!((1u << i) & nir_intrinsic_write_mask(insn))) + continue; + if (typeSizeof(sType) == 8) { + Value *split[2]; + mkSplit(split, 4, getSrc(&insn->src[0], i)); + + Symbol *sym = mkSymbol(FILE_MEMORY_GLOBAL, 0, TYPE_U32, i * typeSizeof(sType)); + mkStore(OP_STORE, TYPE_U32, sym, getSrc(&insn->src[1], 0), split[0]); + + sym = mkSymbol(FILE_MEMORY_GLOBAL, 0, TYPE_U32, i * typeSizeof(sType) + 4); + mkStore(OP_STORE, TYPE_U32, sym, getSrc(&insn->src[1], 0), split[1]); + } else { + Symbol *sym = mkSymbol(FILE_MEMORY_GLOBAL, 0, sType, i * typeSizeof(sType)); + mkStore(OP_STORE, sType, sym, getSrc(&insn->src[1], 0), getSrc(&insn->src[0], i)); + } + } + + info->io.globalAccess |= 0x2; + break; + } default: ERROR("unknown nir_intrinsic_op %s\n", nir_intrinsic_infos[op].name); return false; |