llvm-project/mlir/lib/Conversion/GPUToNVVM
harsh e01e4c9115 Fix bugs in GPUToNVVM lowering
The current lowering from GPU to NVVM does
not correctly handle the following cases when
lowering the gpu shuffle op.

1. When the active width is set to 32 (all lanes),
then the current approach computes (1 << 32) -1 which
results in poison values in the LLVM IR. We fix this by
defining the active mask as (-1) >> (32 - width).

2. In the case of shuffle up, the computation of the third
operand c has to be different from the other 3 modes due to
the op definition in the ISA reference.
(https://docs.nvidia.com/cuda/parallel-thread-execution/index.html)
Specifically, the predicate value is computed as j >= maxLane
for up and j <= maxLane for all other modes. We fix this by
computing maskAndClamp as 32 - width for this mode.

TEST: We modify the existing test and add more checks for the up mode.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D118086
2022-01-25 03:24:14 +00:00
..
CMakeLists.txt [MLIR] Replace std ops with arith dialect ops 2021-10-13 03:07:03 +00:00
GPUToNVVM.td Mass update the MLIR license header to mention "Part of the LLVM project" 2020-01-26 03:58:30 +00:00
LowerGpuOpsToNVVMOps.cpp Fix bugs in GPUToNVVM lowering 2022-01-25 03:24:14 +00:00
WmmaOpsToNvvm.cpp Adjust "end namespace" comment in MLIR to match new agree'd coding style 2021-12-08 06:05:26 +00:00