Loading clang/lib/CodeGen/CGKokkos.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -191,12 +191,12 @@ bool CodeGenFunction::EmitKokkosConstruct(const CallExpr *CE, } // hidden/local namespace std::vector<const ParmVarDecl*> std::queue<const ParmVarDecl*> CodeGenFunction::EmitKokkosParallelForInductionVar(const LambdaExpr *Lambda) { const CXXMethodDecl *MD = Lambda->getCallOperator(); assert(MD && "EmitKokkosParallelFor() -- bad method decl from labmda call."); std::vector<const ParmVarDecl*> params; std::queue<const ParmVarDecl*> params; for (int i = 0; i<MD->getNumParams(); i++) { const ParmVarDecl *InductionVarDecl = MD->getParamDecl(i); Loading @@ -207,7 +207,7 @@ CodeGenFunction::EmitKokkosParallelForInductionVar(const LambdaExpr *Lambda) { llvm::Value *Zero = llvm::ConstantInt::get(ConvertType(InductionVarDecl->getType()), 0); Builder.CreateStore(Zero, Addr); params.push_back(InductionVarDecl); params.push(InductionVarDecl); } return params; Loading Loading @@ -287,13 +287,14 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE, } // Get the induction varaibles std::vector<const ParmVarDecl*> params = EmitKokkosParallelForInductionVar(Lambda); std::queue<const ParmVarDecl*> params = EmitKokkosParallelForInductionVar(Lambda); // These are extra steps that we can probably optimize away BE = DimQueue.front(); DimQueue.pop(); const ParmVarDecl *InductionVarDecl = params.at(0); const ParmVarDecl *InductionVarDecl = params.front(); params.pop(); // Create all jump destinations and basic blocks in the order they // appear in the IR. Loading Loading @@ -434,13 +435,14 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE, bool CodeGenFunction::EmitKokkosInnerLoop(const CallExpr *CE, const LambdaExpr *Lambda, llvm::BasicBlock *TopBlock, std::queue<const Expr*> DimQueue, std::vector<const ParmVarDecl*> params) { std::queue<const ParmVarDecl*> params) { // Get arguments int pos = DimQueue.size(); const Expr *BE = DimQueue.front(); DimQueue.pop(); const ParmVarDecl *InductionVarDecl = params.at(pos); const ParmVarDecl *InductionVarDecl = params.front(); params.pop(); llvm::BasicBlock *Zero = createBasicBlock("kokkos.forall.zero" + std::to_string(pos)); JumpDest Condition = getJumpDestInCurrentScope("kokkos.forall.cond" + std::to_string(pos)); Loading clang/lib/CodeGen/CodeGenFunction.h +2 −2 Original line number Diff line number Diff line Loading @@ -3522,7 +3522,7 @@ public: // Kitsune support for Kokkos. bool EmitKokkosConstruct(const CallExpr *CE, ArrayRef<const Attr *> Attrs = ArrayRef<const Attr *>()); std::vector<const ParmVarDecl*> EmitKokkosParallelForInductionVar(const LambdaExpr* Lambda); std::queue<const ParmVarDecl*> EmitKokkosParallelForInductionVar(const LambdaExpr* Lambda); void EmitKokkosParallelForCond(const Expr *BoundsExpr, const ParmVarDecl *LoopVar, llvm::BasicBlock *DetachBlock, llvm::BasicBlock *ExitBlock, Loading @@ -3531,7 +3531,7 @@ public: bool EmitKokkosInnerLoop(const CallExpr *CE, const LambdaExpr *Lambda, llvm::BasicBlock *TopBlock, std::queue<const Expr*> DimQueue, std::vector<const ParmVarDecl*> params); std::queue<const ParmVarDecl*> params); bool EmitKokkosParallelReduce(const CallExpr *CE, ArrayRef<const Attr *> Attrs); bool InKokkosConstruct = false; // FIXME: Should/can we refactor this away? Loading Loading
clang/lib/CodeGen/CGKokkos.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -191,12 +191,12 @@ bool CodeGenFunction::EmitKokkosConstruct(const CallExpr *CE, } // hidden/local namespace std::vector<const ParmVarDecl*> std::queue<const ParmVarDecl*> CodeGenFunction::EmitKokkosParallelForInductionVar(const LambdaExpr *Lambda) { const CXXMethodDecl *MD = Lambda->getCallOperator(); assert(MD && "EmitKokkosParallelFor() -- bad method decl from labmda call."); std::vector<const ParmVarDecl*> params; std::queue<const ParmVarDecl*> params; for (int i = 0; i<MD->getNumParams(); i++) { const ParmVarDecl *InductionVarDecl = MD->getParamDecl(i); Loading @@ -207,7 +207,7 @@ CodeGenFunction::EmitKokkosParallelForInductionVar(const LambdaExpr *Lambda) { llvm::Value *Zero = llvm::ConstantInt::get(ConvertType(InductionVarDecl->getType()), 0); Builder.CreateStore(Zero, Addr); params.push_back(InductionVarDecl); params.push(InductionVarDecl); } return params; Loading Loading @@ -287,13 +287,14 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE, } // Get the induction varaibles std::vector<const ParmVarDecl*> params = EmitKokkosParallelForInductionVar(Lambda); std::queue<const ParmVarDecl*> params = EmitKokkosParallelForInductionVar(Lambda); // These are extra steps that we can probably optimize away BE = DimQueue.front(); DimQueue.pop(); const ParmVarDecl *InductionVarDecl = params.at(0); const ParmVarDecl *InductionVarDecl = params.front(); params.pop(); // Create all jump destinations and basic blocks in the order they // appear in the IR. Loading Loading @@ -434,13 +435,14 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE, bool CodeGenFunction::EmitKokkosInnerLoop(const CallExpr *CE, const LambdaExpr *Lambda, llvm::BasicBlock *TopBlock, std::queue<const Expr*> DimQueue, std::vector<const ParmVarDecl*> params) { std::queue<const ParmVarDecl*> params) { // Get arguments int pos = DimQueue.size(); const Expr *BE = DimQueue.front(); DimQueue.pop(); const ParmVarDecl *InductionVarDecl = params.at(pos); const ParmVarDecl *InductionVarDecl = params.front(); params.pop(); llvm::BasicBlock *Zero = createBasicBlock("kokkos.forall.zero" + std::to_string(pos)); JumpDest Condition = getJumpDestInCurrentScope("kokkos.forall.cond" + std::to_string(pos)); Loading
clang/lib/CodeGen/CodeGenFunction.h +2 −2 Original line number Diff line number Diff line Loading @@ -3522,7 +3522,7 @@ public: // Kitsune support for Kokkos. bool EmitKokkosConstruct(const CallExpr *CE, ArrayRef<const Attr *> Attrs = ArrayRef<const Attr *>()); std::vector<const ParmVarDecl*> EmitKokkosParallelForInductionVar(const LambdaExpr* Lambda); std::queue<const ParmVarDecl*> EmitKokkosParallelForInductionVar(const LambdaExpr* Lambda); void EmitKokkosParallelForCond(const Expr *BoundsExpr, const ParmVarDecl *LoopVar, llvm::BasicBlock *DetachBlock, llvm::BasicBlock *ExitBlock, Loading @@ -3531,7 +3531,7 @@ public: bool EmitKokkosInnerLoop(const CallExpr *CE, const LambdaExpr *Lambda, llvm::BasicBlock *TopBlock, std::queue<const Expr*> DimQueue, std::vector<const ParmVarDecl*> params); std::queue<const ParmVarDecl*> params); bool EmitKokkosParallelReduce(const CallExpr *CE, ArrayRef<const Attr *> Attrs); bool InKokkosConstruct = false; // FIXME: Should/can we refactor this away? Loading