[Mlir-commits] [mlir] [mlir][GPU] Extend gpu.barrier with scope and named-barrier support (PR #195692)
Guray Ozen
llvmlistbot at llvm.org
Mon May 4 12:56:16 PDT 2026
================
@@ -370,6 +370,37 @@ struct AssertOpToAssertfailLowering
/// Import the GPU Ops to NVVM Patterns.
#include "GPUToNVVM.cpp.inc"
+struct GPUBarrierOpNVVMLowering final
+ : public ConvertOpToLLVMPattern<gpu::BarrierOp> {
+ using ConvertOpToLLVMPattern::ConvertOpToLLVMPattern;
+
+ LogicalResult
+ matchAndRewrite(gpu::BarrierOp op, gpu::BarrierOp::Adaptor adaptor,
+ ConversionPatternRewriter &rewriter) const override {
+ if (op.getNamedBarrier())
+ return rewriter.notifyMatchFailure(
+ op, "named barriers are not supported on NVVM");
----------------
grypp wrote:
The named barriers are supported in the NVVM dialect. We have the following op. There are 16 named barrier IDs, and you can synchronize a specified number of threads:
```
nvvm.barrier` (`id` `=` $barrierId^)? (`number_of_threads` `=` $numberOfThreads^)?
```
more info:
https://mlir.llvm.org/docs/Dialects/NVVMDialect/#nvvmbarrier-nvvmbarrierop
https://github.com/llvm/llvm-project/pull/195692
More information about the Mlir-commits
mailing list