Skip to content

Commit

Permalink
Continued work on replacing tag-centric decls and types for meshes
Browse files Browse the repository at this point in the history
with our own stand-alone versions.  Things should compile in this
version but the toolchain is broken -- specifically in codegen...  I'm
still digging into this but suspect we have some lurking use of tag
and record-based code in CG and that is conflicting with our new
mesh types and supporting infrastructure.
  • Loading branch information
pmccormick committed Sep 27, 2013
1 parent 862ffb3 commit bf7e0d6
Show file tree
Hide file tree
Showing 20 changed files with 299 additions and 67 deletions.
83 changes: 50 additions & 33 deletions flyer/flyer.tex
Expand Up @@ -59,41 +59,58 @@

\maketitle

\section*{Introduction}
Simulation and modeling play a fundamental role in the mission of
the Department of Energy's Office of Science. In support of these
efforts, the DOE has made significant investments over the past two
decades in large-scale, high-performance computer systems.
During this time, the scientific community has relied heavily on
the performance growth of microprocessors within these systems to
provide the building blocks for innovation and discovery across a
range of disciplines. As energy constraints drive a revolutionary
shift towards multi-core and heterogeneous, \emph{throughput-oriented},
processor designs, the community faces a significant challenge in
maintaining our rate of productivity across these critical scientific
endeavors. In particular, we face a dilemma in finding productive
techniques for successfully programming these new architectures.
Tightly coupled with the past growth in computational capabilities has
been an ever-growing wealth of data with increasingly complex levels of
detail. An often under-appreciated aspect of these ongoing architecture
changes is the impact they will have on our ability to gather
observable, empirical, and measurable data essential to the formulation
and testing of hypotheses. A fundamental challenge in guaranteeing the
future success of scientific computing within DOE is to provide
scientists with an effective, yet flexible way to leverage the power
of new architectures to explore and analyze the results of
computational experiments. This will require an \emph{end-to-end} solution
that begins with the details of the underlying hardware architectures and
ends with a set of powerful abstractions that reduce the complexity of
programming.

%\section*{Introduction}

Over the past twenty years the Department of Energy (DOE) has firmly
established the fundamental role that high-performance computing
plays in a wide range of scientific disciplines. Today this success
faces several critical challenges as rapid changes in the design of
computer architectures impacts our abilities to effectively program
future systems and ever-increasing amounts of data continue to
overwhelm our capabilities to explore, analyze, hypothesize, and
thereby successfully interpret the underlying phenomena. While the
full range of topics covered by these challenges are often viewed
individually, we believe it is critical that they be considered in
concert with the goal of improving the rate of scientific innovation
and discovery. This will require an \emph{end-to-end} solution that
begins with the details of the underlying computer hardware and ends
with a set of powerful abstractions that reduce the complexity of
programming not only the scientific application itself but also the
supporting data analysis operations.

\section*{Science-Centric Strategy}

The overarching goal of our effort is to provide computational
scientists with an approach to software development that promotes
the full integration of computation, data analysis, and
visualization as \emph{first-class} constructs within a programming
language. This is achieved by designing and implementing a
The overarching goal of our effort is to provide scientists with an
approach to software development that promotes the full integration of
computation, data analysis, and visualization as \emph{first-class}
constructs within a programming language. This not only serves to
improve productivity, but also provides a focused interface for
dealing with the specific needs of the scientific community. This
methodology is commonly referred to as a \emph{domain-specific}
approach to programming and it provides several attractive properties
for dealing with the emerging challenges of extreme-scale computing.
This allows us to tailor an approach geared to the needs of the
community that in particular address the challenges of rapidly changing
computer hardware and data-centric operations.

Increasing limitations in the infrastructure for moving data within a
large-scale computer, relative to the scale of the data the system is
capable of generating, will force scientists away from a model of
post-processing data, stored in secondary or tertiary memory,
towards one based on \emph{in situ} processing. Given that the movement of
data is a significant portion of the energy consumption and directly
impacts performance, this \emph{in situ} mode of operation will require
a strongly coupled coordination between the science-focused and
data-centric components of an application.

Increasing limitations
in the I/O infrastructures of large-scale supercomputers, relative to the
scale of the data the systems will generate, are likely to force scientists
away from the post-processing of data towards a model based on in situ
processing.


This is achieved by designing and implementing a
\emph{domain-specific language} (DSL~\cite{Fowler:DSL:2010}) called
Scout that incorporates these features into a supporting
set of high-level abstractions. Figure~\ref{fig:spasm} presents an
Expand Down
2 changes: 2 additions & 0 deletions llvm/tools/clang/include/clang/AST/ASTContext.h
Expand Up @@ -1174,6 +1174,8 @@ class ASTContext : public RefCountedBase<ASTContext> {
QualType getTagDeclType(const TagDecl *Decl) const;

// ===== Scout ===================================================================
QualType getMeshDeclType(const MeshDecl *MD) const;
// SC_TODO -- not sure we need to specialize on mesh types here...
QualType getUniformMeshDeclType(const UniformMeshDecl *Decl) const;
QualType getStructuredMeshDeclType(const StructuredMeshDecl *Decl) const;
QualType getRectilinearMeshDeclType(const RectilinearMeshDecl *Decl) const;
Expand Down
18 changes: 18 additions & 0 deletions llvm/tools/clang/include/clang/AST/ASTMutationListener.h
Expand Up @@ -31,6 +31,12 @@ namespace clang {
class TagDecl;
class VarDecl;

class MeshDecl;
class UniformMeshDecl;
class RectilinearMeshDecl;
class StructuredMeshDecl;
class UnstructuredMeshDecl;

/// \brief An abstract interface that should be implemented by listeners
/// that want to be notified when an AST entity gets modified after its
/// initial creation.
Expand All @@ -44,6 +50,18 @@ class ASTMutationListener {
/// \brief A new MeshDecl definition was completed.
virtual void CompletedMeshDefinition(const MeshDecl *D) { }

/// \brief A new UniformMeshDecl definition was completed.
virtual void CompletedUniformMeshDefinition(const UniformMeshDecl *D) { }

/// \brief A new RectilinearMeshDecl definition was completed.
virtual void CompletedRectilinearMeshDefinition(const RectilinearMeshDecl *D) { }

/// \brief A new StructuredMeshDecl definition was completed.
virtual void CompletedStructuredMeshDefinition(const StructuredMeshDecl *D) { }

/// \brief A new UnstructuredMeshDecl definition was completed.
virtual void CompletedUnstructuredMeshDefinition(const UnstructuredMeshDecl *D) { }

/// \brief A new declaration with name has been added to a DeclContext.
virtual void AddedVisibleDecl(const DeclContext *DC, const Decl *D) {}

Expand Down
Expand Up @@ -98,6 +98,11 @@ class RectilinearMeshDecl : public MeshDecl {
return cast<RectilinearMeshDecl>(MeshDecl::getMostRecentDecl());
}

void completeDefinition() {
assert(!isCompleteDefinition() && "Cannot redefine rectilinear mesh!");
MeshDecl::completeDefinition();
}

static bool classof(const Decl* D) { return classofKind(D->getKind()); }
static bool classof(const RectilinearMeshDecl* D) { return true; }
static bool classofKind(Kind K) { return K == RectilinearMesh; }
Expand Down
5 changes: 5 additions & 0 deletions llvm/tools/clang/include/clang/AST/scout/StructuredMeshDecl.h
Expand Up @@ -98,6 +98,11 @@ class StructuredMeshDecl : public MeshDecl {
return cast<StructuredMeshDecl>(MeshDecl::getMostRecentDecl());
}

void completeDefinition() {
assert(!isCompleteDefinition() && "Cannot redefine structured mesh!");
MeshDecl::completeDefinition();
}

static bool classof(const Decl* D) { return classofKind(D->getKind()); }
static bool classof(const StructuredMeshDecl* D) { return true; }
static bool classofKind(Kind K) { return K == StructuredMesh; }
Expand Down
6 changes: 6 additions & 0 deletions llvm/tools/clang/include/clang/AST/scout/UniformMeshDecl.h
Expand Up @@ -100,6 +100,12 @@ class UniformMeshDecl : public MeshDecl {
return cast<UniformMeshDecl>(MeshDecl::getMostRecentDecl());
}

void completeDefinition() {
assert(!isCompleteDefinition() && "Cannot redefine uniform mesh!");
MeshDecl::completeDefinition();
}


//void addMember(Decl *D);

static bool classof(const Decl* D) { return classofKind(D->getKind()); }
Expand Down
Expand Up @@ -98,6 +98,11 @@ class UnstructuredMeshDecl : public MeshDecl {
return cast<UnstructuredMeshDecl>(MeshDecl::getMostRecentDecl());
}

void completeDefinition() {
assert(!isCompleteDefinition() && "Cannot redefine unstructured mesh!");
MeshDecl::completeDefinition();
}

static bool classof(const Decl* D) { return classofKind(D->getKind()); }
static bool classof(const UnstructuredMeshDecl* D) { return true; }
static bool classofKind(Kind K) { return K == UnstructuredMesh; }
Expand Down
2 changes: 2 additions & 0 deletions llvm/tools/clang/include/clang/Basic/DiagnosticCommonKinds.td
Expand Up @@ -83,6 +83,8 @@ def err_module_cycle : Error<"cyclic dependency in module '%0': %1">,
def note_pragma_entered_here : Note<"#pragma entered here">;
def note_decl_hiding_tag_type : Note<
"%1 %0 is hidden by a non-type declaration of %0 here">;
def note_decl_hiding_mesh_type : Note<
"%1 %0 is hidden by a non-type declaration of %0 here">;
def err_attribute_not_type_attr : Error<
"%0 attribute cannot be applied to types">;
def err_enum_template : Error<"enumeration cannot be a template">;
Expand Down
2 changes: 2 additions & 0 deletions llvm/tools/clang/include/clang/Basic/DiagnosticParseKinds.td
Expand Up @@ -349,6 +349,8 @@ def err_unknown_typename : Error<
"unknown type name %0">;
def err_use_of_tag_name_without_tag : Error<
"must use '%1' tag to refer to type %0%select{| in this scope}2">;
def err_use_of_mesh_name_without_mesh : Error<
"must use '%1' mesh kind to refer to mesh %0%select{| in this scope}2">;
def err_templated_using_directive : Error<
"cannot template a using directive">;
def err_templated_using_declaration : Error<
Expand Down
7 changes: 7 additions & 0 deletions llvm/tools/clang/include/clang/Sema/CodeCompleteConsumer.h
Expand Up @@ -255,6 +255,13 @@ class CodeCompletionContext {
CCC_ObjCInterfaceName,
/// \brief Code completion where an Objective-C category name is expected.
CCC_ObjCCategoryName,

/// \brief Code completion for the various mesh types.
CCC_UniformMesh,
CCC_RectilinearMesh,
CCC_StructuredMesh,
CCC_UnstructuredMesh,

/// \brief An unknown context, in which we are recovering from a parsing
/// error and don't know which completions we should give.
CCC_Recovery
Expand Down
3 changes: 3 additions & 0 deletions llvm/tools/clang/include/clang/Sema/Sema.h
Expand Up @@ -1292,6 +1292,7 @@ class Sema {
bool WantNontrivialTypeSourceInfo = false,
IdentifierInfo **CorrectedII = 0);
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S);
TypeSpecifierType isMeshName(IdentifierInfo &II, Scope *S);
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
bool DiagnoseUnknownTypeName(IdentifierInfo *&II,
SourceLocation IILoc,
Expand Down Expand Up @@ -2292,6 +2293,8 @@ class Sema {
/// Tag name lookup, which finds the names of enums, classes,
/// structs, and unions.
LookupTagName,
/// Mesh name lookup, which finds the names of meshes.
LookupMeshName,
/// Label name lookup.
LookupLabel,
/// Member name lookup, which finds the names of
Expand Down
10 changes: 10 additions & 0 deletions llvm/tools/clang/lib/AST/Scout/ASTContext.cpp
Expand Up @@ -29,6 +29,16 @@ using namespace clang;

// ===== Mesh Declaration Types ===============================================

/// getMeshDeclType - Return the unique reference to the type for the
/// specified mesh decl.
QualType ASTContext::getMeshDeclType(const MeshDecl *Decl) const {
assert(Decl);
// FIXME: What is the design on getMeshDeclType when it requires
// casting away const? mutable?
return getTypeDeclType(const_cast<MeshDecl*>(Decl));
}

// SC_TODO -- not sure we need these specialized...
QualType
ASTContext::getUniformMeshDeclType(const UniformMeshDecl *Decl) const {
assert (Decl != 0);
Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/clang/lib/CodeGen/CGExpr.cpp
@@ -1,4 +1,4 @@
//===--- CGExpr.cpp - Emit LLVM Code from Expressions ---------------------===//
//===--- CGExpr.cpp - DeclRef LLVM Code from Expressions ---------------------===//
//
// The LLVM Compiler Infrastructure
//
Expand Down Expand Up @@ -1830,6 +1830,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
if (ND->getName() == "color") {
return EmitScoutColorDeclRefLValue(ND);
} else if(CurrentForAllArrayStmt) {
llvm::errs() << "moose food!\n";
return EmitScoutForAllArrayDeclRefLValue(ND);
}
}
Expand Down
7 changes: 4 additions & 3 deletions llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp
Expand Up @@ -208,7 +208,7 @@ isSafeToConvert(const MeshDecl *MD, CodeGenTypes &CGT,
// multiple times in multiple structure fields, don't check again.
if (!AlreadyChecked.insert(MD)) return true;

const Type *Key = CGT.getContext().getTagDeclType(MD).getTypePtr();
const Type *Key = CGT.getContext().getMeshDeclType(MD).getTypePtr();

// If this type is already laid out, converting it is a noop.
if (CGT.isMeshLayoutComplete(Key)) return true;
Expand Down Expand Up @@ -875,11 +875,12 @@ CodeGenTypes::getCGRecordLayout(const RecordDecl *RD) {
return *Layout;
}


/// ConvertMeshDeclType - Layout a mesh decl type.
llvm::StructType *CodeGenTypes::ConvertMeshDeclType(const MeshDecl *MD) {
// TagDecl's are not necessarily unique, instead use the (clang)
// type connected to the decl.
const Type *Key = Context.getTagDeclType(MD).getTypePtr();
const Type *Key = Context.getMeshDeclType(MD).getTypePtr();

llvm::StructType *&Entry = MeshDeclTypes[Key];

Expand Down Expand Up @@ -932,7 +933,7 @@ llvm::StructType *CodeGenTypes::ConvertMeshDeclType(const MeshDecl *MD) {
/// getCGMeshLayout - Return mesh layout info for the given mesh decl.
const CGMeshLayout &
CodeGenTypes::getCGMeshLayout(const MeshDecl *MD) {
const Type *Key = Context.getTagDeclType(MD).getTypePtr();
const Type *Key = Context.getMeshDeclType(MD).getTypePtr();

const CGMeshLayout *Layout = CGMeshLayouts.lookup(Key);
if (!Layout) {
Expand Down

0 comments on commit bf7e0d6

Please sign in to comment.