Alias analysis pass. More...
#include <alias_analysis.h>
Data Structures | |
class | WorkingSet |
Public Member Functions | |
TORCH_API | AliasDb (std::shared_ptr< Graph > graph) |
bool | hasUntrackedEffects (Node *n) const |
bool | writesToAlias (Node *n, const ValueSet &vs, bool recurseBlocks=false) const |
bool | mayAlias (const Value *a, const Value *b) const |
template<typename... Other1, template< typename, typename... > class T, typename... Other2, template< typename, typename... > class U> | |
bool | mayAlias (const T< const Value *, Other1... > &a, const U< const Value *, Other2... > &b) const |
bool | hasWriters (const Node *n) const |
bool | moveAfterTopologicallyValid (Node *n, Node *movePoint) |
bool | moveBeforeTopologicallyValid (Node *n, Node *movePoint) |
bool | couldMoveAfterTopologically (Node *n, Node *movePoint) |
bool | couldMoveBeforeTopologically (Node *n, Node *movePoint) |
TORCH_API void | dump () const |
Alias analysis pass.
This pass produces an AliasDb that contains aliasing and mutation information about the graph. Users can use this information to determine whether mutations to the graph are safe, i.e. they don't reorder/change nodes in a way that affects output.
Every value with a mutable type (Tensors, Lists, Tuples, etc.) will be associated with one or more "alias sets". If two values share an alias set, that means they may alias, implying that a mutation to one value cannot be reordered past a use of the other. Only reordering two reads of an alias set is considered safe.
There is a special alias set called the "wildcard set", which indicates that we're not sure what this value may alias. To be conservative, we consider the wildcard alias set as potentially aliasing any value.
Definition at line 28 of file alias_analysis.h.