diff options
| author | Christian Sigg <csigg@google.com> | 2019-10-19 01:52:51 -0700 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-10-19 01:53:25 -0700 |
| commit | c3e56cd12cf6d4ab3223d402370dc9236acd0f1b (patch) | |
| tree | fa9acb867a0d78980cc7cff4776bb377dff6a619 /mlir/lib/Target | |
| parent | 5f6bdd144af44ff0840e2dd0d66a21dec3624299 (diff) | |
| download | bcm5719-llvm-c3e56cd12cf6d4ab3223d402370dc9236acd0f1b.tar.gz bcm5719-llvm-c3e56cd12cf6d4ab3223d402370dc9236acd0f1b.zip | |
Get active source lane predicate from shuffle instruction.
nvvm.shfl.sync.bfly optionally returns a predicate whether source lane was active. Support for this was added to clang in https://reviews.llvm.org/D68892.
Add an optional 'pred' unit attribute to the instruction to return this predicate. Specify this attribute in the partial warp reduction so we don't need to manually compute the predicate.
PiperOrigin-RevId: 275616564
Diffstat (limited to 'mlir/lib/Target')
| -rw-r--r-- | mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp b/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp index 13043d78105..606e91b955f 100644 --- a/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp +++ b/mlir/lib/Target/LLVMIR/ConvertToNVVMIR.cpp @@ -44,6 +44,17 @@ static llvm::Value *createIntrinsicCall(llvm::IRBuilder<> &builder, return builder.CreateCall(fn, args); } +static llvm::Intrinsic::ID getShflBflyIntrinsicId(llvm::Type *resultType, + bool withPredicate) { + if (withPredicate) { + resultType = cast<llvm::StructType>(resultType)->getElementType(0); + return resultType->isFloatTy() ? llvm::Intrinsic::nvvm_shfl_sync_bfly_f32p + : llvm::Intrinsic::nvvm_shfl_sync_bfly_i32p; + } + return resultType->isFloatTy() ? llvm::Intrinsic::nvvm_shfl_sync_bfly_f32 + : llvm::Intrinsic::nvvm_shfl_sync_bfly_i32; +} + class ModuleTranslation : public LLVM::ModuleTranslation { public: |

