Skip to content

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

Open

Description

@hi20240217
No description provided.

Activity

  1. ivanradanov commented on Jan 7, 2025

    @ivanradanov
    Collaborator

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

  2. hi20240217 commented on Jan 7, 2025

    @hi20240217
    Author

    commit 26eb428 (HEAD)
    Author: Ivan R. Ivanov ivanov.i.aa@m.titech.ac.jp
    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) -> ()
    
  3. hi20240217 commented on Jan 7, 2025

    @hi20240217
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions