Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 701ab91

Browse files
author
Sven Verdoolaege
committed
tightenLaunchBounds: pass in MappedScop
This will be needed for extracting the mapping schedule in the next commit.
1 parent daac7ae commit 701ab91

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

tc/core/polyhedral/cuda/mapped_scop.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ std::unique_ptr<MappedScop> makeSpecializedMappedScop(
906906

907907
tc::Grid grid = mappedScop.numBlocks;
908908
tc::Block block = mappedScop.numThreads;
909-
std::tie(grid, block) = tightenLaunchBounds(*scop, grid, block);
909+
std::tie(grid, block) = tightenLaunchBounds(mappedScop, grid, block);
910910
auto res = MappedScop::makeMappedScop(
911911
std::move(scop),
912912
grid,

tc/core/polyhedral/cuda/tighten_launch_bounds.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
#include "tc/core/polyhedral/cuda/tighten_launch_bounds.h"
1818

1919
#include "tc/core/check.h"
20+
#include "tc/core/polyhedral/cuda/mapped_scop.h"
2021
#include "tc/core/polyhedral/cuda/mapping_types.h"
2122
#include "tc/core/polyhedral/exceptions.h"
2223
#include "tc/core/polyhedral/functional.h"
2324
#include "tc/core/polyhedral/schedule_tree.h"
2425
#include "tc/core/polyhedral/schedule_utils.h"
26+
#include "tc/core/polyhedral/scop.h"
2527

2628
namespace tc {
2729
namespace polyhedral {
@@ -95,11 +97,11 @@ size_t maxValue(const Scop& scop, const MappingIdType& id) {
9597
* by the tightened, actual, launch bounds used in practice.
9698
*/
9799
template <typename MappingIdType, typename Size>
98-
Size launchBounds(const Scop& scop, Size size) {
100+
Size launchBounds(const MappedScop& mscop, Size size) {
99101
Size tightened;
100102

101103
for (size_t i = 0; i < size.view.size(); ++i) {
102-
tightened.view[i] = maxValue(scop, MappingIdType::makeId(i));
104+
tightened.view[i] = maxValue(mscop.scop(), MappingIdType::makeId(i));
103105
}
104106

105107
return tightened;
@@ -111,12 +113,12 @@ Size launchBounds(const Scop& scop, Size size) {
111113
// computes the tightened, actual, launch bounds used in practice after
112114
// specialization of the ScheduleTree.
113115
std::pair<tc::Grid, tc::Block> tightenLaunchBounds(
114-
const Scop& scop,
116+
const MappedScop& mscop,
115117
const tc::Grid& grid,
116118
const tc::Block& block) {
117119
return std::make_pair(
118-
launchBounds<mapping::BlockId>(scop, grid),
119-
launchBounds<mapping::ThreadId>(scop, block));
120+
launchBounds<mapping::BlockId>(mscop, grid),
121+
launchBounds<mapping::ThreadId>(mscop, block));
120122
}
121123
} // namespace polyhedral
122124
} // namespace tc

tc/core/polyhedral/cuda/tighten_launch_bounds.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
#pragma once
1717

1818
#include "tc/core/cuda/cuda_mapping_options.h"
19-
#include "tc/core/polyhedral/scop.h"
19+
#include "tc/core/polyhedral/cuda/mapped_scop.h"
2020

2121
namespace tc {
2222
namespace polyhedral {
2323
std::pair<tc::Grid, tc::Block> tightenLaunchBounds(
24-
const Scop& scop,
24+
const MappedScop& mscop,
2525
const tc::Grid& grid,
2626
const tc::Block& block);
2727
} // namespace polyhedral

0 commit comments

Comments
 (0)