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

Commit 70008f5

Browse files
author
Sven Verdoolaege
committed
consistently use specializeToContext to specialize scop to context
Using specializeToContext improves consistency of the representation, both by not having outside users modify the domain, but also by having only a single location that takes into account the context.
1 parent 2a318d2 commit 70008f5

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

tc/core/polyhedral/scop.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ struct Scop {
102102
// strategy.proto.fix_parameters_before_scheduling to true.
103103
// If you want to fix the parameters in the support domain,
104104
// then you need to do it explicitly.
105-
// Note that the access relations must be intersect with the context as
106-
// well to obtain consistent dependences.
107105
// TODO: this is still subject to interpretation but intersecting seems
108106
// final here so probably we're right not doing it.
109-
// res->domain() =
110-
// res->domain().intersect_params(res->globalParameterContext);
107+
// res->specializeToContext();
111108
return res;
112109
}
113110

test/test_cuda_mapper.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,9 @@ constexpr auto kExpectedMatmul_64_64_64 =
520520
TEST_F(PolyhedralMapperTest, MergedContexts) {
521521
auto scop = PrepareAndJoinBandsMatMul();
522522

523-
// Unit test claims to use scop->globalParameterContext properly
523+
// Unit test claims to use the specialized context properly
524524
scop->fixParameters<int>({{"M", 64}, {"N", 64}, {"K", 64}});
525-
auto globalParameterContext = scop->globalParameterContext;
526-
scop->domain() = scop->domain().intersect_params(globalParameterContext);
525+
scop->specializeToContext();
527526

528527
auto mscop = TileAndMapThreads(std::move(scop), {16, 16}, {32ul, 8ul});
529528
auto res = std::get<0>(mscop->codegen(specializedName));

test/test_cuda_mapper_memory_promotion.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ class TestMapper : public ::testing::Test {
4646
auto ctx = isl::with_exceptions::globalIslCtx();
4747
auto scop = Scop::makeScop(ctx, tc);
4848
scop = Scop::makeSpecializedScop(*scop, problemSizes);
49-
scop->domain() =
50-
scop->domain().intersect_params(scop->globalParameterContext);
49+
scop->specializeToContext();
5150
return MappedScop::makeWithOuterBlockInnerThreadStrategy(
5251
std::move(scop), mappingOptions);
5352
}
@@ -251,7 +250,7 @@ def fun(float(N, M) A, float(N, M) B) -> (C) {
251250
{tile1, tile2});
252251
auto& scop = const_cast<Scop&>(mscop->scop());
253252
// Must force domain intersection for overapproximation to work
254-
scop.domain() = scop.domain().intersect_params(scop.globalParameterContext);
253+
scop.specializeToContext();
255254
auto ctx = scop.domain().get_ctx();
256255
auto groups = TensorReferenceGroup::accessedBySubtree(
257256
scop.scheduleRoot()->child(childPos), scop);
@@ -331,7 +330,7 @@ def fun(float(N, M) A) -> (B, C) {
331330
{tile1, tile2});
332331
auto& scop = const_cast<Scop&>(mscop->scop());
333332
// Must force domain intersection for overapproximation to work
334-
scop.domain() = scop.domain().intersect_params(scop.globalParameterContext);
333+
scop.specializeToContext();
335334
auto ctx = scop.domain().get_ctx();
336335
auto groups = TensorReferenceGroup::accessedBySubtree(
337336
scop.scheduleRoot()->child(childPos), scop);

0 commit comments

Comments
 (0)