Skip to content

[MLIR][ROCDL] Fix BallotOp LLVM translation and add doc #85116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 14, 2024

Conversation

zahimoud
Copy link
Contributor

@zahimoud zahimoud commented Mar 13, 2024

This modifies the return type of the intrinsic call to handle 32 and 64 bits
properly and document the MLIR operation.

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2024

@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-llvm

Author: Zahi Moudallal (zahimoud)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/85116.diff

1 Files Affected:

  • (modified) mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td (+10)
diff --git a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
index abb38a3df8068c..8c641b931de18e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/ROCDLOps.td
@@ -162,10 +162,20 @@ def ROCDL_BallotOp :
   ROCDL_Op<"ballot">,
   Results<(outs LLVM_Type:$res)>,
   Arguments<(ins I1:$pred)> {
+  let summary = "Vote across thread group";
+
+  let description = [{
+      This operation applies a reduction to the source predicate across all the active threads within a warp, 
+      resulting in a destination predicate value that is uniform for every thread in the warp.
+
+      i1 -> i32
+  }];
+
   string llvmBuilder = [{
       $res = createIntrinsicCall(builder,
             llvm::Intrinsic::amdgcn_ballot, {$pred}, {llvm::Type::getInt32Ty(moduleTranslation.getLLVMContext())});
   }];
+
   let assemblyFormat = "$pred attr-dict `:` type($res)";
 }
 

@zahimoud zahimoud changed the title [MLIR][ROCDL] Added summary and description to BallotOp [MLIR][ROCDL] Added summary and description to BallotOp. Modified return type of intrinsic call, and added lit test for i64 return type. Mar 13, 2024
@joker-eph joker-eph changed the title [MLIR][ROCDL] Added summary and description to BallotOp. Modified return type of intrinsic call, and added lit test for i64 return type. [MLIR][ROCDL] Fix BallotOp LLVM translation and add doc Mar 14, 2024
Copy link
Collaborator

@joker-eph joker-eph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

In general try to keep the first line of the commit short (<80 chars), and then leave an empty line before providing a contextual description. Also patches are better described in the present tense I believe :)

@ThomasRaoux ThomasRaoux merged commit 8481fb1 into llvm:main Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants