21 #include <unordered_map>
32 namespace polyhedral {
61 std::unique_ptr<Scop>&& scop,
65 : scop_(std::move(scop)),
71 static inline std::unique_ptr<MappedScop> makeOneBlockOneThread(
72 std::unique_ptr<Scop>&& scop) {
73 return std::unique_ptr<MappedScop>(
new MappedScop(
76 static inline std::unique_ptr<MappedScop> makeMappedScop(
77 std::unique_ptr<Scop>&& scop,
81 return std::unique_ptr<MappedScop>(
82 new MappedScop(std::move(scop), grid, block, unroll));
86 static std::unique_ptr<MappedScop> makeWithOuterBlockInnerThreadStrategy(
87 std::unique_ptr<Scop>&& scopUPtr,
88 const MappingOptions& mappingOptions);
93 inline detail::ScheduleTree*
94 map(detail::ScheduleTree* tree,
int pos,
const mapping::BlockId&
id) {
95 return mapToParameterWithExtent(
96 scop_->scheduleRoot(), tree, pos, id,
id.mappingSize(numBlocks));
98 inline detail::ScheduleTree*
99 map(detail::ScheduleTree* tree,
int pos,
const mapping::ThreadId&
id) {
100 return mapToParameterWithExtent(
101 scop_->scheduleRoot(), tree, pos, id,
id.mappingSize(numThreads));
107 template <
typename MappingTypeId>
108 void mapRemaining(detail::ScheduleTree* tree,
size_t nMapped,
size_t nToMap);
112 template <
typename T>
113 void fixParameters(
const std::unordered_map<std::string, T>& sizes) {
114 scop_->fixParameters(sizes);
118 void insertMappingContext();
122 std::tuple<std::string, tc::Grid, tc::Block> codegen(
123 const std::string& specializedName)
const;
127 inline const detail::ScheduleTree* schedule()
const {
128 return scop_->scheduleRoot();
131 inline const Scop& scop()
const {
134 inline Scop& scop() {
141 void mapToBlocksAndScaleBand(
142 detail::ScheduleTree* band,
143 std::vector<size_t> tileSizes);
147 bool detectReductions(detail::ScheduleTree* band);
149 bool needReductionSeparation(
const detail::ScheduleTree* st);
153 isl::multi_union_pw_aff reductionMapSchedule(
const detail::ScheduleTree* st);
157 detail::ScheduleTree* separateReduction(detail::ScheduleTree* band);
164 size_t mapToThreads(detail::ScheduleTree* band,
size_t nInner);
167 size_t mapInnermostBandsToThreads(detail::ScheduleTree* st);
170 std::unique_ptr<Scop> scop_;
173 const ::tc::Grid numBlocks;
174 const ::tc::Block numThreads;
175 const uint64_t unroll;
182 ThreadIdxxScheduleDepthState threadIdxxScheduleDepthState;
188 Reduction(std::vector<isl::id> ids) : ids(ids), separated(false) {}
190 std::vector<isl::id> ids;
197 std::unordered_map<const detail::ScheduleTree*, const detail::ScheduleTree*>
198 reductionFromParent_;
201 std::map<const detail::ScheduleTree*, Reduction> reductionBandUpdates_;
Specializing CudaDim to differentiate between Block and Grid sizes.
Definition: mapping_options.h:208
Specializing CudaDim to differentiate between Block and Grid sizes.
Definition: mapping_options.h:196