docc 0.8.3 (0d44999b)
C++ API Reference
Loading...
Searching...
No Matches
tile_target_registry.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <mutex>
5#include <string>
6#include <unordered_map>
7
9
10namespace sdfg {
11namespace tiles {
12
22 mutable std::mutex mutex_;
23 std::unordered_map<std::string, std::shared_ptr<TileTarget>> targets_;
24
25public:
27 static TileTargetRegistry registry;
28 return registry;
29 }
30
31 void register_target(const std::string& schedule_value, std::shared_ptr<TileTarget> target) {
32 std::lock_guard<std::mutex> lock(mutex_);
33 targets_.emplace(schedule_value, std::move(target));
34 }
35
37 const TileTarget* get(const std::string& schedule_value) const {
38 std::lock_guard<std::mutex> lock(mutex_);
39 auto it = targets_.find(schedule_value);
40 return it == targets_.end() ? nullptr : it->second.get();
41 }
42
47 data_flow::ImplementationType implementation_type(const std::string& schedule_value) const {
48 const TileTarget* target = get(schedule_value);
50 }
51
56 std::optional<AxisSchedule> classify(const structured_control_flow::ScheduleType& sched) const;
57
60 std::optional<Level> classify_level(const structured_control_flow::ScheduleType& sched) const;
61
65};
66
67} // namespace tiles
68} // namespace sdfg
Represents a schedule type for Map nodes.
Definition structured_loop.h:31
Maps a schedule value() to the TileTarget that owns it.
Definition tile_target_registry.h:21
bool drives_cooperative_copy(const structured_control_flow::ScheduleType &sched) const
True when sched is a group-level schedule whose parallel threads can drive a cooperative shared-memor...
void register_target(const std::string &schedule_value, std::shared_ptr< TileTarget > target)
Definition tile_target_registry.h:31
std::optional< Level > classify_level(const structured_control_flow::ScheduleType &sched) const
The cooperation Level for sched, or std::nullopt when no registered target treats it as a scratchpad ...
data_flow::ImplementationType implementation_type(const std::string &schedule_value) const
The implementation selector the target owning schedule_value stamps onto its tile codegen library nod...
Definition tile_target_registry.h:47
const TileTarget * get(const std::string &schedule_value) const
The target owning schedule_value, or nullptr if none is registered.
Definition tile_target_registry.h:37
std::optional< AxisSchedule > classify(const structured_control_flow::ScheduleType &sched) const
Classify sched into cooperation facts via the owning target, or the neutral fallback when none is reg...
static TileTargetRegistry & instance()
Definition tile_target_registry.h:26
Definition tile_target.h:39
virtual data_flow::ImplementationType implementation_type() const =0
The implementation selector this target stamps onto its tile codegen library nodes (cp....
StringEnum ImplementationType
Implementation type identifier for library nodes.
Definition library_node.h:75
ImplementationType ImplementationType_NONE
Default implementation type indicating no specific implementation.
Definition library_node.h:84
Definition gpu_tile_target.h:13
Definition analysis.h:7
The complete target-specific contract of the tile algebra.