[Mesa-dev] [PATCH] nvc0/ir: always use CG mode for loads from atomic-only buffers
Karol Herbst
kherbst at redhat.com
Sun Feb 3 23:46:39 UTC 2019
Reviewed-by: Karol Herbst <kherbst at redhat.com>
On Sun, Feb 3, 2019 at 4:10 PM Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>
> Atomic operations don't update the local cache, which means that we
> would have to issue CCTL operations in order to get the updated values.
> When we know that a buffer is primarily used for atomic operations, it's
> easier to just avoid the caching at that level entirely.
>
> The same issue persists for non-atomic buffers, which will have to be
> fixed separately.
>
> Fixes the failing dEQP-GLES31.functional.atomic_counter.* tests.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> .../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> index afd7916a321..335e708c5cb 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
> @@ -1087,6 +1087,8 @@ public:
> };
> std::vector<MemoryFile> memoryFiles;
>
> + std::vector<bool> bufferAtomics;
> +
> private:
> int inferSysValDirection(unsigned sn) const;
> bool scanDeclaration(const struct tgsi_full_declaration *);
> @@ -1137,6 +1139,7 @@ bool Source::scanSource()
> //resources.resize(scan.file_max[TGSI_FILE_RESOURCE] + 1);
> tempArrayId.resize(scan.file_max[TGSI_FILE_TEMPORARY] + 1);
> memoryFiles.resize(scan.file_max[TGSI_FILE_MEMORY] + 1);
> + bufferAtomics.resize(scan.file_max[TGSI_FILE_BUFFER] + 1);
>
> info->immd.bufSize = 0;
>
> @@ -1483,11 +1486,14 @@ bool Source::scanDeclaration(const struct tgsi_full_declaration *decl)
> tempArrayInfo.insert(std::make_pair(arrayId, std::make_pair(
> first, last - first + 1)));
> break;
> + case TGSI_FILE_BUFFER:
> + for (i = first; i <= last; ++i)
> + bufferAtomics[i] = decl->Declaration.Atomic;
> + break;
> case TGSI_FILE_ADDRESS:
> case TGSI_FILE_CONSTANT:
> case TGSI_FILE_IMMEDIATE:
> case TGSI_FILE_SAMPLER:
> - case TGSI_FILE_BUFFER:
> case TGSI_FILE_IMAGE:
> break;
> default:
> @@ -2720,7 +2726,11 @@ Converter::handleLOAD(Value *dst0[4])
> }
>
> Instruction *ld = mkLoad(TYPE_U32, dst0[c], sym, off);
> - ld->cache = tgsi.getCacheMode();
> + if (tgsi.getSrc(0).getFile() == TGSI_FILE_BUFFER &&
> + code->bufferAtomics[r])
> + ld->cache = nv50_ir::CACHE_CG;
> + else
> + ld->cache = tgsi.getCacheMode();
> if (ind)
> ld->setIndirect(0, 1, ind);
> }
> --
> 2.19.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list