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

Commit 16ff65a

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 27c37af commit 16ff65a

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

tc/core/polyhedral/scop.cc

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

354354
using namespace tc::polyhedral;
355355

356+
// Compute the dependence using the given may/must sources, sinks and kills.
357+
// Any of the inputs may be an empty (but non-null) union map.
358+
// Dependence analysis removes the cases transitively covered by a must source
359+
// or a kill.
356360
isl::union_map computeDependences(
357-
isl::union_map sources,
361+
isl::union_map maySources,
362+
isl::union_map mustSources,
358363
isl::union_map sinks,
364+
isl::union_map kills,
359365
isl::schedule schedule) {
360366
auto uai = isl::union_access_info(sinks);
361-
uai = uai.set_may_source(sources);
367+
uai = uai.set_may_source(maySources);
368+
uai = uai.set_must_source(mustSources);
369+
uai = uai.set_kill(kills);
362370
uai = uai.set_schedule(schedule);
363371
auto flow = uai.compute_flow();
364372
return flow.get_may_dependence();
365373
}
366374

367-
// Do the simplest possible dependence analysis.
368-
// Live-range reordering needs tagged access relations to be available.
375+
// Set up schedule constraints by performing the dependence analysis using
376+
// access relations from "scop". Set up callbacks in the constraints depending
377+
// on "scheduleOptions".
378+
//
369379
// The domain of the constraints is intersected with "restrictDomain" if it is
370380
// provided.
371381
isl::schedule_constraints makeScheduleConstraints(
@@ -375,12 +385,16 @@ isl::schedule_constraints makeScheduleConstraints(
375385
auto schedule = toIslSchedule(scop.scheduleRoot());
376386
auto firstChildNode = scop.scheduleRoot()->child({0});
377387
auto reads = scop.reads.domain_factor_domain();
378-
auto writes = scop.mayWrites.domain_factor_domain();
388+
auto mayWrites = scop.mayWrites.domain_factor_domain();
389+
auto mustWrites = scop.mustWrites.domain_factor_domain();
390+
auto empty = isl::union_map::empty(mustWrites.get_space());
379391

380392
// RAW
381-
auto flowDeps = computeDependences(writes, reads, schedule);
393+
auto flowDeps =
394+
computeDependences(mayWrites, mustWrites, reads, mustWrites, schedule);
382395
// WAR and WAW
383-
auto falseDeps = computeDependences(writes.unite(reads), writes, schedule);
396+
auto falseDeps = computeDependences(
397+
mayWrites.unite(reads), empty, mayWrites, mustWrites, schedule);
384398

385399
auto allDeps = flowDeps.unite(falseDeps).coalesce();
386400

0 commit comments

Comments
 (0)