Skip to content

Commit

Permalink
Add OpenMP code generation to isl backend
Browse files Browse the repository at this point in the history
This backend supports besides the classical code generation the upcoming SCEV
based code generation (which the existing CLooG backend does not support
robustly).

OpenMP code generation in the isl backend benefits from our run-time alias
checks such that the set of loops that can possibly be parallelized is a lot
larger.

The code was tested on LNT. We do not regress on builds without -polly-parallel.
When using -polly-parallel most tests work flawlessly, but a few issues still
remain and will be addressed in follow up commits.

SCEV/non-SCEV codegen:
  - Compile time failure in ldecod and TimberWolfMC due a problem in our
    run-time alias check generation triggered by pointers that escape through
    the OpenMP subfunction (OpenMP specific).

  - Several execution time failures. Due to the larger set of loops that we now
    parallelize (compared to the classical code generation),  we currently run
    into some timeouts in tests with a lot loops that have a low trip count and
    are slowed down by parallelizing them.

SCEV only:

  - One existing failure in lencod due to llvm.org/PR21204 (not OpenMP specific)

OpenMP code generation is the last feature that was only available in the CLooG
backend. With the isl backend being the only one supporting features such as
run-time alias checks and delinearization, we will soon switch to use the isl
ast generator by the default and subsequently remove our dependency on CLooG.

http://reviews.llvm.org/D5517

llvm-svn: 222088
  • Loading branch information
tobiasgrosser committed Nov 15, 2014
1 parent 6d675f4 commit e3c0558
Show file tree
Hide file tree
Showing 16 changed files with 1,047 additions and 11 deletions.
8 changes: 4 additions & 4 deletions polly/include/polly/CodeGen/IslExprBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

#include "polly/CodeGen/IRBuilder.h"

#include "isl/ast.h"
#include "llvm/ADT/MapVector.h"

#include <map>
#include "isl/ast.h"

namespace llvm {
class SCEVExpander;
Expand Down Expand Up @@ -81,7 +81,7 @@ namespace polly {
class IslExprBuilder {
public:
/// @brief A map from isl_ids to llvm::Values.
typedef std::map<isl_id *, llvm::Value *> IDToValueTy;
typedef llvm::MapVector<isl_id *, llvm::Value *> IDToValueTy;

/// @brief Construct an IslExprBuilder.
///
Expand Down Expand Up @@ -125,7 +125,7 @@ class IslExprBuilder {

private:
PollyIRBuilder &Builder;
std::map<isl_id *, llvm::Value *> &IDToValue;
IDToValueTy &IDToValue;

/// @brief A SCEVExpander to translate dimension sizes to llvm values.
llvm::SCEVExpander &Expander;
Expand Down
16 changes: 16 additions & 0 deletions polly/include/polly/Support/SCEVValidator.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,32 @@
#ifndef POLLY_SCEV_VALIDATOR_H
#define POLLY_SCEV_VALIDATOR_H

#include "llvm/ADT/SetVector.h"
#include <vector>

namespace llvm {
class Region;
class SCEV;
class ScalarEvolution;
class Value;
class Loop;
}

namespace polly {
/// @brief Find the loops referenced from a SCEV expression.
///
/// @param Expr The SCEV expression to scan for loops.
/// @param Loops A vector into which the found loops are inserted.
void findLoops(const llvm::SCEV *Expr,
llvm::SetVector<const llvm::Loop *> &Loops);

/// @brief Find the values referenced by SCEVUnknowns in a given SCEV
/// expression.
///
/// @param Expr The SCEV expression to scan for SCEVUnknowns.
/// @param Expr A vector into which the found values are inserted.
void findValues(const llvm::SCEV *Expr, llvm::SetVector<llvm::Value *> &Values);

/// Returns true when the SCEV contains references to instructions within the
/// region.
///
Expand Down
Loading

0 comments on commit e3c0558

Please sign in to comment.