Commit 1fae9849 authored by Patrick Flynn's avatar Patrick Flynn
Browse files

Merge branch 'lanl-release/10.x' into develop

parents e42b9f7c efae67ce
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -260,10 +260,16 @@ def warn_alias_with_section : Warning<
  InGroup<IgnoredAttributes>;

def warn_kokkos_no_functor : Warning<
    "kokkos - functors unsupported (reverting to C++ mode for construct).">,
    "kokkos - parallel_for functors unsupported.\n"
    "Falling back to standard C++ mode but executable could be unstable.">,
    InGroup<BackendOptimizationFailure>;
def warn_kokkos_unknown_stmt_class : Warning<
    "kokkos - unrecognized/unsupported construct in parallel_for statement.\n"
    "Failling back to standard C++ mode but executable could be unstable.">,
    InGroup<BackendOptimizationFailure>;
def warn_kokkos_unknown_bounds_expr : Warning<
    "kokkos - unrecognized bounds/limit expression (reverting to C++ mode for construct).">,
    "kokkos - unrecognized bounds/limit expression.\n"
    "Falling back to standard C++ mode but executable could be unstable.">,
    InGroup<BackendOptimizationFailure>;
def warn_kokkos_reduce_unsupported : Warning<
    "kokkos - reduction constructs are currently unsupported.">,
+24 −28
Original line number Diff line number Diff line
@@ -2580,7 +2580,6 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {

    // Check for captured variables.
    if (E->refersToEnclosingVariableOrCapture()) {

      // kitsune: if we are generating a kokkos-based lambda construct
      // we are likely going to eventually tarnsform it into a parallel
      // loop construct. Thus we have to carefully consider how we handle
@@ -4622,7 +4621,7 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
  // a traditional loop construct -- thus our result is not a call expr
  // but essentially the removal of the call.
  //
  // FIXME: is this sound in all lambda use cases?  --PM 
  // TODO: is this path sound in all lambda use cases?  --PM
  //
  if (getLangOpts().Kokkos) {
    const FunctionDecl *fdecl = E->getDirectCallee();
@@ -4632,12 +4631,9 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
          qname == "Kokkos::parallel_reduce") {
	    if (EmitKokkosConstruct(E))
	      return RValue::get(nullptr);
	// else fall through to standard C++ support. 
    } else if (getLangOpts().KokkosNoInit &&
		    (qname == "Kokkos::initialize" ||
  		   qname == "Kokkos::finalize"))
	// In "no-init" mode we skip code generation for the
	// Kokkos initialization entry (and finalize) points. 
      return RValue::get(nullptr);
    }
  }
+86 −90
Original line number Diff line number Diff line
@@ -96,7 +96,8 @@ namespace {
  static void
  ExtractParallelForComponents(const CallExpr* CE,
					   std::string &CN, const Expr *& BE,
					   const LambdaExpr *& LE)
					   const LambdaExpr *& LE,
             DiagnosticsEngine &Diags)
  {
    // Recongized constructs:
    //
@@ -151,7 +152,8 @@ namespace {
      OE = CE->getArg(curArgIndex);
      SE = SimplifyExpr(OE);
    } else {
      SE->dump();
      Diags.Report(SE->getExprLoc(), diag::warn_kokkos_unknown_stmt_class);
      //SE->dump();
      BE = nullptr;
      LE = nullptr;
      return;
@@ -160,6 +162,7 @@ namespace {
    if (SE->getStmtClass() == Expr::LambdaExprClass) {
      LE = dyn_cast<LambdaExpr>(SE);
    } else {
      Diags.Report(CE->getExprLoc(), diag::warn_kokkos_no_functor);
      LE = nullptr;
      return;
    }
@@ -248,19 +251,12 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE,
  std::string      PFName; // construct name (for kokkos profiling)
  const Expr       *BE = nullptr; // "bounds" expression
  const LambdaExpr *Lambda = nullptr; // the lambda
  ExtractParallelForComponents(CE, PFName, BE, Lambda);
  DiagnosticsEngine &Diags = CGM.getDiags();
  ExtractParallelForComponents(CE, PFName, BE, Lambda, Diags);

  if (Lambda == nullptr) { 
  if (Lambda == nullptr)
    // The parallel_for doesn't have a (recognizable) lambda expression.
    // 
    // Functor support is problematic as it can live in a different 
    // compilaton unit.  We always punt and go the pure C++ route in
    // these cases. 
    DiagnosticsEngine &Diags = CGM.getDiags();
    // TODO: should reword this warning terminology. 
    Diags.Report(CE->getExprLoc(), diag::warn_kokkos_no_functor);
    return false;
  }

  if (BE == nullptr) {
    // We didn't get a known bounds expression back -- this is most likely
@@ -312,6 +308,7 @@ bool CodeGenFunction::EmitKokkosParallelFor(const CallExpr *CE,
  //    2. We ignore the details of what is captured by the lambda.
  //
  // TODO: Do we need to "relax" these assumptions to support broader code coverage?
  
  // This is 'equivalent' to the Init statement in a traditional for loop (e.g. int i = 0). 
  const ParmVarDecl *InductionVarDecl; 
  InductionVarDecl = EmitKokkosParallelForInductionVar(Lambda).at(0);
@@ -650,4 +647,3 @@ bool CodeGenFunction::EmitKokkosParallelReduce(const CallExpr *CE,
  Diags.Report(CE->getExprLoc(), diag::warn_kokkos_reduce_unsupported);
  return false;
}
+2 −2
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ option(LLVM_APPEND_VC_REV
set(PACKAGE_NAME LLVM)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
# set(PACKAGE_BUGREPORT "https://bugs.llvm.org/")
set(PACKAGE_BUGREPORT "https://github.com/OpenCilk/opencilk-project/issues")
set(PACKAGE_BUGREPORT "https://github.com/lanl/kitsune/issues")

set(BUG_REPORT_URL "${PACKAGE_BUGREPORT}" CACHE STRING
  "Default URL where bug reports are to be submitted.")
+2 −0
Original line number Diff line number Diff line
@@ -253,6 +253,8 @@ public:
  /// Returns true if Function F should be processed.
  virtual bool shouldProcessFunction(const Function &F) const;

  virtual void prepareModule() {}

  /// Returns true if tasks in Function F should be outlined into their own
  /// functions.  Such outlining is a common step for many Tapir backends.
  virtual bool shouldDoOutlining(const Function &F) const { return true; }
Loading