[all-commits] [llvm/llvm-project] e01e4c: Fix bugs in GPUToNVVM lowering

harsh-nod via All-commits all-commits at lists.llvm.org
Mon Jan 24 19:25:56 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e01e4c9115ad49479d01b6b6de4e83ee454bab24
      https://github.com/llvm/llvm-project/commit/e01e4c9115ad49479d01b6b6de4e83ee454bab24
  Author: harsh <harsh at nod-labs.com>
  Date:   2022-01-25 (Tue, 25 Jan 2022)

  Changed paths:
    M mlir/lib/Conversion/GPUToNVVM/LowerGpuOpsToNVVMOps.cpp
    M mlir/test/Conversion/GPUToNVVM/gpu-to-nvvm.mlir

  Log Message:
  -----------
  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




More information about the All-commits mailing list