[Mlir-commits] [mlir] [MLIR][NVVM][Refactor] Refactor intrinsic lowering for NVVM Ops (PR #157079)
Durgadoss R
llvmlistbot at llvm.org
Tue Sep 16 04:58:12 PDT 2025
================
@@ -26,380 +26,6 @@ using namespace mlir;
using namespace mlir::LLVM;
using mlir::LLVM::detail::createIntrinsicCall;
-#define REDUX_F32_ID_IMPL(op, abs, hasNaN) \
- hasNaN ? llvm::Intrinsic::nvvm_redux_sync_f##op##abs##_NaN \
- : llvm::Intrinsic::nvvm_redux_sync_f##op##abs
-
-#define GET_REDUX_F32_ID(op, hasAbs, hasNaN) \
- hasAbs ? REDUX_F32_ID_IMPL(op, _abs, hasNaN) : REDUX_F32_ID_IMPL(op, , hasNaN)
-
-static llvm::Intrinsic::ID getReduxIntrinsicId(llvm::Type *resultType,
- NVVM::ReduxKind kind,
- bool hasAbs, bool hasNaN) {
- if (!(resultType->isIntegerTy(32) || resultType->isFloatTy()))
- llvm_unreachable("unsupported data type for redux");
-
- switch (kind) {
- case NVVM::ReduxKind::ADD:
- return llvm::Intrinsic::nvvm_redux_sync_add;
- case NVVM::ReduxKind::UMAX:
- return llvm::Intrinsic::nvvm_redux_sync_umax;
- case NVVM::ReduxKind::UMIN:
- return llvm::Intrinsic::nvvm_redux_sync_umin;
- case NVVM::ReduxKind::AND:
- return llvm::Intrinsic::nvvm_redux_sync_and;
- case NVVM::ReduxKind::OR:
- return llvm::Intrinsic::nvvm_redux_sync_or;
- case NVVM::ReduxKind::XOR:
- return llvm::Intrinsic::nvvm_redux_sync_xor;
- case NVVM::ReduxKind::MAX:
- return llvm::Intrinsic::nvvm_redux_sync_max;
- case NVVM::ReduxKind::MIN:
- return llvm::Intrinsic::nvvm_redux_sync_min;
- case NVVM::ReduxKind::FMIN:
- return GET_REDUX_F32_ID(min, hasAbs, hasNaN);
- case NVVM::ReduxKind::FMAX:
- return GET_REDUX_F32_ID(max, hasAbs, hasNaN);
- }
- llvm_unreachable("unknown redux kind");
-}
----------------
durga4github wrote:
ok, I feel moving functions from here to the other file, should be a separate change in itself.
Would leave it up to you to do it before or after the refactor. But let us not mix the refactor with this NFC code-movement.
https://github.com/llvm/llvm-project/pull/157079
More information about the Mlir-commits
mailing list