<p dir="ltr"><br>
On Mar 31, 2016 12:09 PM, "Samuel Pitoiset" <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>> wrote:<br>
><br>
> For Maxwell, the ATOMS instruction can be used to perform atomic<br>
> operations on shared memory instead of this load/store lowering pass.<br>
><br>
> Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com">samuel.pitoiset@gmail.com</a>><br>
> ---<br>
> .../nouveau/codegen/nv50_ir_lowering_nvc0.cpp | 20 +++++++++++++-------<br>
> 1 file changed, 13 insertions(+), 7 deletions(-)<br>
><br>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp<br>
> index 7e6c87a..83e753e 100644<br>
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp<br>
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_lowering_nvc0.cpp<br>
> @@ -1294,10 +1294,14 @@ NVC0LoweringPass::handleATOM(Instruction *atom)<br>
> sv = SV_LBASE;<br>
> break;<br>
> case FILE_MEMORY_SHARED:<br>
> - if (targ->getChipset() >= NVISA_GK104_CHIPSET) {<br>
> - handleSharedATOMNVE4(atom);<br>
> - } else {<br>
> - handleSharedATOM(atom);<br>
> + if (targ->getChipset() < NVISA_GM107_CHIPSET) {<br>
> + // For Fermi/Kepler, we have to use ld lock/st unlock to perform<br>
> + // atomic operations on shared memory. For Maxwell, ATOMS is enough.<br>
> + if (targ->getChipset() >= NVISA_GK104_CHIPSET) {<br>
> + handleSharedATOMNVE4(atom);<br>
> + } else {<br>
> + handleSharedATOM(atom);<br>
> + }<br>
> }</p>
<p dir="ltr">Or, with fewer branches...</p>
<p dir="ltr">If (<nve4) do nvc0 thing<br>
Else if (<gm107) do nve4 thing</p>
<p dir="ltr">Which will drop the outer if, making it more comprehensible.<br></p>
<p dir="ltr">> return true;<br>
> default:<br>
> @@ -1326,9 +1330,11 @@ NVC0LoweringPass::handleATOM(Instruction *atom)<br>
> bool<br>
> NVC0LoweringPass::handleCasExch(Instruction *cas, bool needCctl)<br>
> {<br>
> - if (cas->src(0).getFile() == FILE_MEMORY_SHARED) {<br>
> - // ATOM_CAS and ATOM_EXCH are handled in handleSharedATOM().<br>
> - return false;<br>
> + if (targ->getChipset() < NVISA_GM107_CHIPSET) {<br>
> + if (cas->src(0).getFile() == FILE_MEMORY_SHARED) {<br>
> + // ATOM_CAS and ATOM_EXCH are handled in handleSharedATOM().<br>
> + return false;<br>
> + }<br>
> }<br>
><br>
> if (cas->subOp != NV50_IR_SUBOP_ATOM_CAS &&<br>
> --<br>
> 2.7.4<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>