WaSH Docs
Enumerations | Functions | Variables
ws2st::dependency_detection Namespace Reference

Enumerations

enum  PropertyList {
  PropertyList::Pos, PropertyList::Vel, PropertyList::Acc, PropertyList::Density,
  PropertyList::Mass, PropertyList::SmoothingLength
}
 

Functions

std::vector< std::string > get_force_kernel_read_variables ()
 Get all variables that are read by force kernels. More...
 
std::vector< std::string > get_domain_sync_invalidated_halos ()
 
std::vector< bool > compute_domain_syncs ()
 Compute whether or not we should run a domain sync after each kernel. More...
 
std::vector< bool > compute_domain_syncs_clever ()
 Compute whether or not we should run a domain sync after each kernel, as per Scott's algorithm in the report. More...
 
std::vector< std::vector< std::string > > compute_halo_exchanges ()
 Compute which variables need to be exchanged after the execution of each kernel. exchanges[i] contains v if v needs to be exchanged after kernel i executes. More...
 
void HandleDomainSync (const MatchFinder::MatchResult &Result, Replacements &Replace)
 Rewriter callback for inserting domain syncs. More...
 
void HandleHaloExchange (const MatchFinder::MatchResult &Result, Replacements &Replace)
 Rewriter callback for inserting domain syncs. More...
 
std::string RunHaloExchange (std::vector< std::string > exchanges)
 Generate code for a single halo exchange on a list of variables. More...
 
void UnrollKernelDependencyLoop (const MatchFinder::MatchResult &Result, Replacements &Replace)
 Rewriter callback for unrolling the kernel loop. More...
 
void InsertInitialHaloExchange (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
bool RecordAssignment (std::string function_name, std::string force_name)
 Record a force that is assigned to in a function. More...
 
bool RecordRead (std::string function_name, std::string force_name)
 Record a force that is read from in function. More...
 
void RegisterForceKernel (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
void RegisterInitKernel (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
void RegisterNeighbourSearchKernel (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
void DefaultNeighbourSearchKernel (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
void HandleFunctionCallInFunction (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
const StatementMatcher WritePropertyMatcher (const std::string propertyName)
 
const StatementMatcher ReadPropertyMatcher (const std::string propertyName)
 
void RegisterForceAssignment (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
void RegisterForceRead (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
template<PropertyList property>
void RegisterReadProperty (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
template<PropertyList property>
void RegisterWriteProperty (const MatchFinder::MatchResult &Result, Replacements &Replace)
 
const std::string getPropertyName (PropertyList property)
 

Variables

DeclarationMatcher InsertDomainSyncsMatcher
 AST matcher for the empty _domain_syncs class. More...
 
DeclarationMatcher InsertHaloExchangeMatcher
 AST matcher for the empty _halo_exchange class. More...
 
DeclarationMatcher LoopRewriteMatcher
 AST matcher for the empty _wash_loop_rewriter class. More...
 
DeclarationMatcher InitialHaloExchangeMatcher
 AST matcher for the empty _wash_initial_halo_exchange class. More...
 
StatementMatcher AddInitKernelMatcher
 
StatementMatcher AddForceKernelMatcher
 
StatementMatcher SetNeighbourSearchKernelMatcher
 
StatementMatcher SetDefaultNeighbourSearchKernelMatcher
 
StatementMatcher GenericFunctionCallInFunction
 
StatementMatcher ForceAssignmentInFunction
 
StatementMatcher ForceReadInFunction
 
StatementMatcher PosReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Pos))
 
StatementMatcher VelReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Vel))
 
StatementMatcher AccReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Acc))
 
StatementMatcher DensityReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Density))
 
StatementMatcher MassReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Mass))
 
StatementMatcher SmoothingLengthReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::SmoothingLength))
 
WashCallbackFn RegisterPosRead = RegisterReadProperty<PropertyList::Pos>
 
WashCallbackFn RegisterVelRead = RegisterReadProperty<PropertyList::Vel>
 
WashCallbackFn RegisterAccRead = RegisterReadProperty<PropertyList::Acc>
 
WashCallbackFn RegisterDensityRead = RegisterReadProperty<PropertyList::Density>
 
WashCallbackFn RegisterMassRead = RegisterReadProperty<PropertyList::Mass>
 
WashCallbackFn RegisterSmoothingLengthRead = RegisterReadProperty<PropertyList::SmoothingLength>
 
StatementMatcher PosWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Pos))
 
StatementMatcher VelWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Vel))
 
StatementMatcher AccWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Acc))
 
StatementMatcher DensityWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Density))
 
StatementMatcher MassWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Mass))
 
StatementMatcher SmoothingLengthWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::SmoothingLength))
 
WashCallbackFn RegisterPosWrite = RegisterWriteProperty<PropertyList::Pos>
 
WashCallbackFn RegisterVelWrite = RegisterWriteProperty<PropertyList::Vel>
 
WashCallbackFn RegisterAccWrite = RegisterWriteProperty<PropertyList::Acc>
 
WashCallbackFn RegisterDensityWrite = RegisterWriteProperty<PropertyList::Density>
 
WashCallbackFn RegisterMassWrite = RegisterWriteProperty<PropertyList::Mass>
 
WashCallbackFn RegisterSmoothingLengthWrite = RegisterWriteProperty<PropertyList::SmoothingLength>
 

Enumeration Type Documentation

◆ PropertyList

Enumerator
Pos 
Vel 
Acc 
Density 
Mass 
SmoothingLength 

Function Documentation

◆ compute_domain_syncs()

std::vector< bool > ws2st::dependency_detection::compute_domain_syncs ( )

Compute whether or not we should run a domain sync after each kernel.

◆ compute_domain_syncs_clever()

std::vector<bool> ws2st::dependency_detection::compute_domain_syncs_clever ( )

Compute whether or not we should run a domain sync after each kernel, as per Scott's algorithm in the report.

◆ compute_halo_exchanges()

std::vector< std::vector< std::string > > ws2st::dependency_detection::compute_halo_exchanges ( )

Compute which variables need to be exchanged after the execution of each kernel. exchanges[i] contains v if v needs to be exchanged after kernel i executes.

◆ DefaultNeighbourSearchKernel()

void ws2st::dependency_detection::DefaultNeighbourSearchKernel ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ get_domain_sync_invalidated_halos()

std::vector<std::string> ws2st::dependency_detection::get_domain_sync_invalidated_halos ( )

◆ get_force_kernel_read_variables()

std::vector<std::string> ws2st::dependency_detection::get_force_kernel_read_variables ( )

Get all variables that are read by force kernels.

◆ getPropertyName()

const std::string ws2st::dependency_detection::getPropertyName ( PropertyList  property)

◆ HandleDomainSync()

void ws2st::dependency_detection::HandleDomainSync ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

Rewriter callback for inserting domain syncs.

◆ HandleFunctionCallInFunction()

void ws2st::dependency_detection::HandleFunctionCallInFunction ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ HandleHaloExchange()

void ws2st::dependency_detection::HandleHaloExchange ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

Rewriter callback for inserting domain syncs.

◆ InsertInitialHaloExchange()

void ws2st::dependency_detection::InsertInitialHaloExchange ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ ReadPropertyMatcher()

const StatementMatcher ws2st::dependency_detection::ReadPropertyMatcher ( const std::string  propertyName)

◆ RecordAssignment()

bool ws2st::dependency_detection::RecordAssignment ( std::string  function_name,
std::string  force_name 
)

Record a force that is assigned to in a function.

◆ RecordRead()

bool ws2st::dependency_detection::RecordRead ( std::string  function_name,
std::string  force_name 
)

Record a force that is read from in function.

◆ RegisterForceAssignment()

void ws2st::dependency_detection::RegisterForceAssignment ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RegisterForceKernel()

void ws2st::dependency_detection::RegisterForceKernel ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RegisterForceRead()

void ws2st::dependency_detection::RegisterForceRead ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RegisterInitKernel()

void ws2st::dependency_detection::RegisterInitKernel ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RegisterNeighbourSearchKernel()

void ws2st::dependency_detection::RegisterNeighbourSearchKernel ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RegisterReadProperty()

template<PropertyList property>
void ws2st::dependency_detection::RegisterReadProperty ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RegisterWriteProperty()

template<PropertyList property>
void ws2st::dependency_detection::RegisterWriteProperty ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

◆ RunHaloExchange()

std::string ws2st::dependency_detection::RunHaloExchange ( std::vector< std::string >  exchanges)

Generate code for a single halo exchange on a list of variables.

◆ UnrollKernelDependencyLoop()

void ws2st::dependency_detection::UnrollKernelDependencyLoop ( const MatchFinder::MatchResult &  Result,
Replacements &  Replace 
)

Rewriter callback for unrolling the kernel loop.

◆ WritePropertyMatcher()

const StatementMatcher ws2st::dependency_detection::WritePropertyMatcher ( const std::string  propertyName)

Variable Documentation

◆ AccReadInFunction

StatementMatcher ws2st::dependency_detection::AccReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Acc))

◆ AccWriteInFunction

StatementMatcher ws2st::dependency_detection::AccWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Acc))

◆ AddForceKernelMatcher

StatementMatcher ws2st::dependency_detection::AddForceKernelMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, callExpr(
hasAncestor(functionDecl(hasName("main"))),
hasDescendant(
declRefExpr(
to(functionDecl(anyOf(
hasName("wash::add_force_kernel"),
hasName("wash::add_update_kernel"),
hasName("wash::add_reduction_kernel"),
hasName("wash::add_void_kernel")
)))
).bind("kernelType")
),
hasArgument(0, ignoringImplicit(unaryOperator(
hasOperatorName("&"),
hasDescendant(
declRefExpr().bind("kernel")
)
).bind("kernelPtr") ))
).bind("callExpr"))

◆ AddInitKernelMatcher

StatementMatcher ws2st::dependency_detection::AddInitKernelMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, callExpr(
hasAncestor(functionDecl(hasName("main"))),
hasDescendant(declRefExpr(to(functionDecl(anyOf(
hasName("wash::add_init_update_kernel"),
hasName("wash::add_init_void_kernel")
))))),
hasArgument(0, ignoringImplicit(unaryOperator(
hasOperatorName("&"),
hasDescendant(
declRefExpr().bind("kernel")
)
).bind("kernelPtr") ))
).bind("callExpr"))

◆ DensityReadInFunction

StatementMatcher ws2st::dependency_detection::DensityReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Density))

◆ DensityWriteInFunction

StatementMatcher ws2st::dependency_detection::DensityWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Density))

◆ ForceAssignmentInFunction

StatementMatcher ws2st::dependency_detection::ForceAssignmentInFunction
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, cxxMemberCallExpr(
hasAncestor(functionDecl().bind("caller")),
anyOf(
callee(cxxMethodDecl(hasName("set_force_vector"))),
callee(cxxMethodDecl(hasName("set_force_scalar")))
),
hasArgument(0, ignoringImplicit( stringLiteral().bind("assignVariableName") ))
).bind("assignExpr")
)

◆ ForceReadInFunction

StatementMatcher ws2st::dependency_detection::ForceReadInFunction
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, cxxMemberCallExpr(
hasAncestor(functionDecl().bind("caller")),
anyOf(
callee(cxxMethodDecl(hasName("get_force_vector"))),
callee(cxxMethodDecl(hasName("get_force_scalar")))
),
hasArgument(0, ignoringImplicit( stringLiteral().bind("readVariableName") ))
).bind("readExpr")
)

◆ GenericFunctionCallInFunction

StatementMatcher ws2st::dependency_detection::GenericFunctionCallInFunction
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, callExpr(
hasAncestor(functionDecl().bind("caller"))
).bind("callee"))

◆ InitialHaloExchangeMatcher

DeclarationMatcher ws2st::dependency_detection::InitialHaloExchangeMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource,
cxxRecordDecl(hasName("_wash_initial_halo_exchange")).bind("decl")
)

AST matcher for the empty _wash_initial_halo_exchange class.

◆ InsertDomainSyncsMatcher

DeclarationMatcher ws2st::dependency_detection::InsertDomainSyncsMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource,
cxxRecordDecl(hasName("_domain_syncs")).bind("decl")
)

AST matcher for the empty _domain_syncs class.

◆ InsertHaloExchangeMatcher

DeclarationMatcher ws2st::dependency_detection::InsertHaloExchangeMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource,
cxxRecordDecl(hasName("_halo_exchanges")).bind("decl")
)

AST matcher for the empty _halo_exchange class.

◆ LoopRewriteMatcher

DeclarationMatcher ws2st::dependency_detection::LoopRewriteMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource,
cxxRecordDecl(hasName("_wash_loop_rewriter")).bind("decl")
)

AST matcher for the empty _wash_loop_rewriter class.

◆ MassReadInFunction

StatementMatcher ws2st::dependency_detection::MassReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Mass))

◆ MassWriteInFunction

StatementMatcher ws2st::dependency_detection::MassWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Mass))

◆ PosReadInFunction

StatementMatcher ws2st::dependency_detection::PosReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Pos))

◆ PosWriteInFunction

StatementMatcher ws2st::dependency_detection::PosWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Pos))

◆ RegisterAccRead

WashCallbackFn ws2st::dependency_detection::RegisterAccRead = RegisterReadProperty<PropertyList::Acc>

◆ RegisterAccWrite

WashCallbackFn ws2st::dependency_detection::RegisterAccWrite = RegisterWriteProperty<PropertyList::Acc>

◆ RegisterDensityRead

WashCallbackFn ws2st::dependency_detection::RegisterDensityRead = RegisterReadProperty<PropertyList::Density>

◆ RegisterDensityWrite

WashCallbackFn ws2st::dependency_detection::RegisterDensityWrite = RegisterWriteProperty<PropertyList::Density>

◆ RegisterMassRead

WashCallbackFn ws2st::dependency_detection::RegisterMassRead = RegisterReadProperty<PropertyList::Mass>

◆ RegisterMassWrite

WashCallbackFn ws2st::dependency_detection::RegisterMassWrite = RegisterWriteProperty<PropertyList::Mass>

◆ RegisterPosRead

WashCallbackFn ws2st::dependency_detection::RegisterPosRead = RegisterReadProperty<PropertyList::Pos>

◆ RegisterPosWrite

WashCallbackFn ws2st::dependency_detection::RegisterPosWrite = RegisterWriteProperty<PropertyList::Pos>

◆ RegisterSmoothingLengthRead

WashCallbackFn ws2st::dependency_detection::RegisterSmoothingLengthRead = RegisterReadProperty<PropertyList::SmoothingLength>

◆ RegisterSmoothingLengthWrite

WashCallbackFn ws2st::dependency_detection::RegisterSmoothingLengthWrite = RegisterWriteProperty<PropertyList::SmoothingLength>

◆ RegisterVelRead

WashCallbackFn ws2st::dependency_detection::RegisterVelRead = RegisterReadProperty<PropertyList::Vel>

◆ RegisterVelWrite

WashCallbackFn ws2st::dependency_detection::RegisterVelWrite = RegisterWriteProperty<PropertyList::Vel>

◆ SetDefaultNeighbourSearchKernelMatcher

StatementMatcher ws2st::dependency_detection::SetDefaultNeighbourSearchKernelMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, callExpr(
hasAncestor(functionDecl(hasName("main"))),
hasDescendant(
declRefExpr(
to(functionDecl(
hasName("wash::set_default_neighbor_search")
))
)
)
))

◆ SetNeighbourSearchKernelMatcher

StatementMatcher ws2st::dependency_detection::SetNeighbourSearchKernelMatcher
Initial value:
= traverse(TK_IgnoreUnlessSpelledInSource, callExpr(
hasAncestor(functionDecl(hasName("main"))),
hasDescendant(
declRefExpr(
to(functionDecl(
hasName("wash::set_neighbor_search_kernel")
))
)
),
hasArgument(0, ignoringImplicit(unaryOperator(
hasOperatorName("&"),
hasDescendant(
declRefExpr().bind("kernel")
)
).bind("kernelPtr") ))
).bind("callExpr"))

◆ SmoothingLengthReadInFunction

StatementMatcher ws2st::dependency_detection::SmoothingLengthReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::SmoothingLength))

◆ SmoothingLengthWriteInFunction

StatementMatcher ws2st::dependency_detection::SmoothingLengthWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::SmoothingLength))

◆ VelReadInFunction

StatementMatcher ws2st::dependency_detection::VelReadInFunction = ReadPropertyMatcher(getPropertyName(PropertyList::Vel))

◆ VelWriteInFunction

StatementMatcher ws2st::dependency_detection::VelWriteInFunction = WritePropertyMatcher(getPropertyName(PropertyList::Vel))