39 std::vector<int> coop_axes_;
47 size_t coop_lanes_ = 1;
70 plan_ = std::move(
plan);
99 return guard_.discharge(parameters, assumptions);
108 return coop_threads_;
132 std::unique_ptr<DataFlowNode>
151 const nlohmann::json& j,
178 const std::string& dst_expr,
179 const std::string& src_expr,
190 const std::string& type,
191 const std::string& var,
192 const std::string& base,
193 const std::string& index,
201 const std::string& type,
const std::string& var,
const std::string& base,
const std::string& index
218 const std::string& dst_expr,
219 const std::string& src_expr,
221 const std::function<std::string(
const std::string& dst_addr,
const std::string& src_addr,
size_t bytes)>&
247 std::vector<codegen::DispatchInput>& inputs,
248 std::vector<codegen::DispatchOutput>& outputs
Dispatchers for dataflow blocks and library nodes.
size_t element_id() const
const DebugInfo & debug_info() const
Note: Even though the class references unique_ptr, it will never delete an SDFG it has a reference to...
Definition structured_sdfg_builder.h:44
Definition language_extension.h:39
Base class for library node code generation dispatchers.
Definition block_dispatcher.h:163
Definition data_flow_graph.h:29
graph::Vertex vertex() const
Get the graph vertex for this node.
Base class for all library nodes in the dataflow graph.
Definition library_node.h:106
const ImplementationType & implementation_type() const
Get the implementation type (const).
Base class for library node serialization.
Definition json_serializer.h:195
A control flow node representing a basic block with dataflow computations.
Definition block.h:42
Map from symbols to their assumptions.
Definition assumptions.h:313
TileCopyNodeDispatcher(codegen::LanguageExtension &language_extension, const Function &function, const data_flow::DataFlowGraph &data_flow_graph, const TileCopyNode &node)
void dispatch_code_with_edges(codegen::CodegenOutput &out, std::vector< codegen::DispatchInput > &inputs, std::vector< codegen::DispatchOutput > &outputs) override
Definition tile_copy_node.h:147
nlohmann::json serialize(const sdfg::data_flow::LibraryNode &library_node) override
Serialize a library node to JSON.
data_flow::LibraryNode & deserialize(const nlohmann::json &j, sdfg::builder::StructuredSDFGBuilder &builder, sdfg::structured_control_flow::Block &parent) override
Deserialize a library node from JSON.
A tiled copy carried as a value TiledCopy plan.
Definition tile_copy_node.h:28
data_flow::PointerAccessType pointer_access_type(int input_idx) const override
{"_dst", "_src"}: writes _dst, reads _src, captures neither.
void set_atom(CopyAtom atom)
Definition tile_copy_node.h:79
const std::vector< int > & coop_axes() const
Definition tile_copy_node.h:102
void set_bytes(size_t bytes)
Definition tile_copy_node.h:86
CopyDirection direction() const
Definition tile_copy_node.h:73
void validate(const Function &function) const override
Validate the code node's configuration.
bool normalize_guard(const symbolic::SymbolSet ¶meters, const symbolic::Assumptions &assumptions)
Re-discharge the boundary guard against assumptions (dims proven fully covering are dropped),...
Definition tile_copy_node.h:98
std::unique_ptr< DataFlowNode > clone(size_t element_id, const graph::Vertex vertex, data_flow::DataFlowGraph &parent) const override
Clone this node for graph transformations.
symbolic::SymbolSet symbols() const override
Get all symbols used in this node.
size_t coop_lanes() const
Definition tile_copy_node.h:111
void replace(const symbolic::ExpressionMapping &replacements) override
const symbolic::Expression & coop_threads() const
Symbolic cooperating thread count (null = unknown; runtime loop).
Definition tile_copy_node.h:107
size_t bytes() const
Definition tile_copy_node.h:83
int element_input() const
The input (0 = _dst, 1 = _src) whose pointer carries the tile element type — the non-register side of...
Definition tile_copy_node.h:123
void set_plan(TiledCopy plan)
Definition tile_copy_node.h:69
void replace(const symbolic::Expression old_expression, const symbolic::Expression new_expression) override
const TiledCopy & plan() const
Definition tile_copy_node.h:66
void set_phase(CopyPhase phase)
Definition tile_copy_node.h:118
TileCopyNode(size_t element_id, const DebugInfo &debug_info, const graph::Vertex vertex, data_flow::DataFlowGraph &parent, const data_flow::ImplementationType &implementation_type, TiledCopy plan, CopyDirection direction, size_t bytes, TileGuard guard={}, std::vector< int > coop_axes={}, symbolic::Expression coop_threads={}, size_t coop_lanes=1)
std::string toStr() const override
Convert node to string representation.
CopyPhase phase() const
Definition tile_copy_node.h:115
const TileGuard & guard() const
Definition tile_copy_node.h:90
CopyAtom atom() const
Definition tile_copy_node.h:76
SymEngine::RCP< const SymEngine::Basic > Expression
Reference-counted pointer to a symbolic expression (SymEngine Basic).
Definition symbolic.h:83
std::set< Symbol, SymEngine::RCPBasicKeyLess > SymbolSet
Ordered set of symbols.
Definition symbolic.h:95
SymEngine::map_basic_basic ExpressionMapping
Definition symbolic.h:109
Library node definitions for calling functions beyond simple instructions.
Definition function_builder.h:10
StringEnum ImplementationType
Implementation type identifier for library nodes.
Definition library_node.h:75
StringEnum LibraryNodeCode
Definition library_node.h:65
std::unique_ptr< PointerAccessMeta, PtrAccessDeleter > PointerAccessType
Definition pointer_metadata.h:32
boost::graph_traits< Graph >::vertex_descriptor Vertex
Definition graph.h:25
Definition gpu_tile_target.h:13
std::string emit_predicated_guarded_load(const std::string &type, const std::string &var, const std::string &base, const std::string &index)
Vendor-agnostic GuardedLoadFn: a predicated load into a zero-initialized value (CUDA: @p LDG; AMDGPU:...
size_t widest_legal_transfer(const TileCopyNode &node, CopyAtom atom, const std::vector< size_t > &widths)
The first of widths (bytes, widest first) at which each lane of node can move one contiguous multi-el...
std::string emit_tile_copy_stmt(codegen::LanguageExtension &language_extension, const TileCopyNode &node, const std::string &dst_expr, const std::string &src_expr, types::PrimitiveType elem, const symbolic::Expression &index)
The single-element copy statement dst[dst_geo(index)] = src[src_geo(index)]; for the tile coordinate ...
bool guard_axis_aligned(const TileCopyNode &node, size_t axis, long long factor)
Every guard dim on tile axis has a base and exclusive bound that are multiples of factor,...
bool provably_multiple_of(symbolic::Expression e, long long m, const TileCopyNode &node)
True if e is a multiple of m for all values of its symbols: the indvar of each loop enclosing node is...
CopyPhase
Which half of a register-staged copy a node performs.
Definition tiled_copy.h:46
@ LoadRegs
source -> registers (_dst is the register array)
Definition tiled_copy.h:48
@ Full
source -> destination
Definition tiled_copy.h:47
void emit_cooperative_copy_loop(codegen::LanguageExtension &language_extension, codegen::PrettyPrinter &stream, const TileCopyNode &node, const std::string &dst_expr, const std::string &src_expr, types::PrimitiveType elem, const std::function< std::string(const std::string &dst_addr, const std::string &src_addr, size_t bytes)> &async_stmt={}, const GuardedLoadFn &guarded_load={})
Emit the block-cooperative staging loop for node into stream: every thread of the enclosing kernel bl...
CopyAtom
The per-lane transfer primitive a tiled copy lowers to.
Definition tiled_copy.h:24
data_flow::LibraryNodeCode LibraryNodeType_TileCopy
Definition tile_copy_node.h:15
std::function< std::string( const std::string &type, const std::string &var, const std::string &base, const std::string &index, size_t elem_bytes, size_t bytes)> GuardedLoadFn
Renders a guarded (ragged-tile) copy-in load for the cooperative copy loop: a statement declaring typ...
Definition tile_copy_node.h:189
CopyDirection
Which way the tile moves between the flat (global) side and the packed buffer.
Definition tiled_copy.h:38
PrimitiveType
Enumeration of all primitive data types supported by sdfglib.
Definition type.h:35
Definition block_dispatcher.h:108
The ragged-tile boundary predicate, stored per-dim.
Definition tiled_copy.h:68
Definition tiled_copy.h:52
A tiled copy plan: move one tile between memory levels.