docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
locality.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <utility>
5#include <vector>
6
9#include "sdfg/tiles/tile.h"
10
11namespace sdfg {
12namespace tiles {
13
25 std::vector<TileAxis> axes_;
26 bool loop_is_outermost_ = false;
27 bool loop_has_scratchpad_ = false;
28 bool has_scratchpad_descendant_ = false;
31 bool enclosing_cooperative_ = false;
32
33public:
34 LocalityPlan() = default; // an empty plan; fill via analyze()
35
39 std::vector<TileAxis> axes,
40 bool loop_is_outermost = false,
41 bool loop_has_scratchpad = false,
42 bool has_scratchpad_descendant = false,
43 bool enclosing_cooperative = false
44 )
45 : axes_(std::move(axes)), loop_is_outermost_(loop_is_outermost), loop_has_scratchpad_(loop_has_scratchpad),
46 has_scratchpad_descendant_(has_scratchpad_descendant), enclosing_cooperative_(enclosing_cooperative) {
47 }
48
54 const std::vector<TileAxis>& axes,
55 analysis::AnalysisManager& analysis_manager
56 );
57
58 const std::vector<TileAxis>& axes() const {
59 return axes_;
60 }
61 bool loop_is_outermost() const {
62 return loop_is_outermost_;
63 }
64 bool loop_has_scratchpad() const {
65 return loop_has_scratchpad_;
66 }
68 return has_scratchpad_descendant_;
69 }
70 bool enclosing_cooperative() const {
71 return enclosing_cooperative_;
72 }
73
79 bool has_cooperative_at(Level level) const;
84 std::vector<TileAxis> private_axes() const;
86 std::vector<TileAxis> cooperative_axes() const;
87
101 std::optional<Space> required_space(bool container_written) const;
102};
103
108);
109
110} // namespace tiles
111} // namespace sdfg
Definition analysis.h:53
Base class for structured loop constructs.
Definition structured_loop.h:244
bool has_scratchpad_descendant() const
Definition locality.h:67
std::vector< TileAxis > private_axes() const
The scratchpad per-thread axes (indvar in a tile base) — each owns a buffer slot.
bool has_cooperative_at(Level level) const
True when a cooperative scratchpad axis at level exists.
bool enclosing_cooperative() const
Definition locality.h:70
LocalityPlan(std::vector< TileAxis > axes, bool loop_is_outermost=false, bool loop_has_scratchpad=false, bool has_scratchpad_descendant=false, bool enclosing_cooperative=false)
Construct a plan from known axes and loop-context flags (e.g.
Definition locality.h:38
bool loop_has_scratchpad() const
Definition locality.h:64
bool loop_is_outermost() const
Definition locality.h:61
std::vector< TileAxis > cooperative_axes() const
The scratchpad cooperative axes (the shared/copy parallelism axes).
std::optional< Space > required_space(bool container_written) const
The memory space this tile must be staged in, or std::nullopt when the schedule cannot be safely loca...
bool has_global_cooperative() const
True when a cooperative axis backed only by global memory exists (no private stack fits: a host-paral...
const std::vector< TileAxis > & axes() const
Definition locality.h:58
bool inside_scratchpad_scope() const
True when a scratchpad-scheduled axis encloses us (we are inside a device kernel).
static LocalityPlan analyze(structured_control_flow::StructuredLoop &loop, const std::vector< TileAxis > &axes, analysis::AnalysisManager &analysis_manager)
Analyze the placement of a tile with the given axes at loop (TileAxis::enclosing produces the axes; T...
bool has_scratchpad_cooperative() const
True when any cooperative scratchpad axis exists (threads share the tile on-chip).
Definition gpu_tile_target.h:13
structured_control_flow::StructuredLoop * find_block_scheduled_descendant(structured_control_flow::StructuredLoop &loop, analysis::AnalysisManager &analysis_manager)
First block-level GPU-offloaded loop in loop's body (a cooperative copy / consumer axis for enclosing...
Level
Cooperation scope of a parallel axis, coarsest to finest — target-neutral tiers (OpenCL/SYCL vocabula...
Definition tile.h:32
Definition analysis.h:7
Schedule-aware tile vocabulary: a Tile is a Layout (geometry from MemoryLayoutAnalysis) partitioned o...