Skip to content
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

CollectKernelStatistics.cpp:39:22: error: 'ceilDiv' is not a member of 'mlir' #433

Open
hi20240217 opened this issue Jan 6, 2025 · 3 comments

Comments

@hi20240217
Copy link

No description provided.

@ivanradanov
Copy link
Collaborator

Could you check if the llvm-project git submodule is at exactly the specified commit? Polygeist does not support any other version.

@hi20240217
Copy link
Author

commit 26eb4285b56edd8c897642078d91f16ff0fd3472 (HEAD)
Author: Ivan R. Ivanov [email protected]
Date: Thu Sep 28 15:26:45 2023 +0900

[MLIR][LLVM] Add vararg support in LLVM::CallOp and InvokeOp (#67274)

In order to support indirect vararg calls, we need to have information about the
callee type - this patch adds a `callee_type` attribute that holds that.

The attribute is required for vararg calls, else, it is optional and the callee
type is inferred by the operands and results of the operation if not present.

The syntax for non-vararg calls remains the same, whereas for vararg calls, it
is changed to this:

```
llvm.call %p(%arg0, %arg0) vararg(!llvm.func<void (i32, ...)>) : !llvm.ptr, (i32, i32) -> ()
llvm.call @s(%arg0, %arg0) vararg(!llvm.func<void (i32, ...)>) : (i32, i32) -> ()

@hi20240217
Copy link
Author

I have modified it in the following way. Is it feasible?

diff --git a/lib/polygeist/Passes/ParallelLoopUnroll.cpp b/lib/polygeist/Passes/ParallelLoopUnroll.cpp
index ae2475fa5c24..f51807866026 100644
--- a/lib/polygeist/Passes/ParallelLoopUnroll.cpp
+++ b/lib/polygeist/Passes/ParallelLoopUnroll.cpp
@@ -20,7 +20,7 @@
 #include "mlir/IR/IRMapping.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/IR/Value.h"
-#include "mlir/Support/MathExtras.h"
+#include "llvm/Support/MathExtras.h"
 #include "mlir/Transforms/RegionUtils.h"
 #include "polygeist/Ops.h"
 #include "polygeist/Passes/Passes.h"
@@ -339,7 +339,8 @@ LogicalResult mlir::polygeist::scfParallelUnrollByFactor(
       llvm_unreachable("expected positive loop bounds and step");
       return failure();
     }
-    int64_t upperBoundRem = mlir::mod(ubCst, unrollFactor);
+    //int64_t upperBoundRem = mlir::mod(ubCst, unrollFactor);
+    int64_t upperBoundRem = ubCst%unrollFactor;

     if (upperBoundRem && !generateEpilogueLoop) {
       return failure();

diff --git a/lib/polygeist/Passes/CollectKernelStatistics.cpp b/lib/polygeist/Passes/CollectKernelStatistics.cpp
index 176f2b311cc0..028dc7f6b94e 100644
--- a/lib/polygeist/Passes/CollectKernelStatistics.cpp
+++ b/lib/polygeist/Passes/CollectKernelStatistics.cpp
@@ -9,7 +9,7 @@
 #include "mlir/IR/Value.h"
 #include "mlir/IR/Verifier.h"
 #include "mlir/Pass/PassManager.h"
-#include "mlir/Support/MathExtras.h"
+#include "llvm/Support/MathExtras.h"
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 #include "mlir/Transforms/Passes.h"

@@ -36,8 +36,8 @@ static double estimateTripCount(Block *block, unsigned threadNum) {
           forOp.getUpperBound().getDefiningOp<arith::ConstantIndexOp>();
       auto stepCstOp = forOp.getStep().getDefiningOp<arith::ConstantIndexOp>();
       if (lbCstOp && ubCstOp && stepCstOp)
-        return mlir::ceilDiv(ubCstOp.value() - lbCstOp.value(),
-                             stepCstOp.value());
+        //return mlir::ceilDiv(ubCstOp.value() - lbCstOp.value(), stepCstOp.value());
+        return (ubCstOp.value() - lbCstOp.value())/stepCstOp.value();
       else
         return 1.0;
     } else if (auto ifOp = dyn_cast<scf::IfOp>(op)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants