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

Commit db02013

Browse files
committed
Scop: use must-sources and kills in dependence analysis
Previous commit introduced must writes in Scop. Use them in the dependence analysis as must sources for flow dependences and as kills for flow and false dependences.
1 parent d88661b commit db02013

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

src/core/polyhedral/scop.cc

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,19 +358,29 @@ namespace {
358358

359359
using namespace tc::polyhedral;
360360

361+
// Compute the dependence using the given may/must sources, sinks and kills.
362+
// Any of the inputs may be an empty (but non-null) union map.
363+
// Dependence analysis removes the cases transitively covered by a must source
364+
// or a kill.
361365
isl::union_map computeDependences(
362-
isl::union_map sources,
366+
isl::union_map maySources,
367+
isl::union_map mustSources,
363368
isl::union_map sinks,
369+
isl::union_map kills,
364370
isl::schedule schedule) {
365371
auto uai = isl::union_access_info(sinks);
366-
uai = uai.set_may_source(sources);
372+
uai = uai.set_may_source(maySources);
373+
uai = uai.set_must_source(mustSources);
374+
uai = uai.set_kill(kills);
367375
uai = uai.set_schedule(schedule);
368376
auto flow = uai.compute_flow();
369377
return flow.get_may_dependence();
370378
}
371379

372-
// Do the simplest possible dependence analysis.
373-
// Live-range reordering needs tagged access relations to be available.
380+
// Set up schedule constraints by performing the dependence analysis using
381+
// access relations from "scop". Set up callbacks in the constraints depending
382+
// on "scheduleOptions".
383+
//
374384
// The domain of the constraints is intersected with "restrictDomain" if it is
375385
// provided.
376386
isl::schedule_constraints makeScheduleConstraints(
@@ -380,12 +390,16 @@ isl::schedule_constraints makeScheduleConstraints(
380390
auto schedule = toIslSchedule(scop.scheduleRoot());
381391
auto firstChildNode = scop.scheduleRoot()->child({0});
382392
auto reads = scop.reads.domain_factor_domain();
383-
auto writes = scop.mayWrites.domain_factor_domain();
393+
auto mayWrites = scop.mayWrites.domain_factor_domain();
394+
auto mustWrites = scop.mustWrites.domain_factor_domain();
395+
auto empty = isl::union_map::empty(mustWrites.get_space());
384396

385397
// RAW
386-
auto flowDeps = computeDependences(writes, reads, schedule);
398+
auto flowDeps =
399+
computeDependences(mayWrites, mustWrites, reads, mustWrites, schedule);
387400
// WAR and WAW
388-
auto falseDeps = computeDependences(writes.unite(reads), writes, schedule);
401+
auto falseDeps = computeDependences(
402+
mayWrites.unite(reads), empty, mayWrites, mustWrites, schedule);
389403

390404
auto allDeps = flowDeps.unite(falseDeps).coalesce();
391405

0 commit comments

Comments
 (0)