Skip to content

Commit

Permalink
access race checker: handle offseted loops
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushikcfd committed Nov 5, 2023
1 parent f8abfa9 commit 5ceabca
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions loopy/schedule/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from loopy.kernel.data import AddressSpace, TemporaryVariable, ArrayArg
from loopy.kernel import LoopKernel
from loopy.isl_helpers import static_min_of_pw_aff


# {{{ block boundary finder
Expand Down Expand Up @@ -381,6 +382,23 @@ def _check_for_access_races(map_a, insn_a, map_b, insn_b, knl, callables_table):
if dt == isl.dim_type.in_:
tag, = filter_iname_tags_by_type(knl.inames[name].tags,
HardwareConcurrentTag)
if any(not aff.plain_is_zero()
for _, aff in (knl
.get_iname_bounds(name)
.lower_bound_pw_aff
.get_pieces())
):
# Non-zero hardware inames are offseted in loopy's codegen. See
# https://github.com/inducer/loopy/issues/600#issuecomment-1104066735
# => Accordingly offset the access maps
lbound_val = (static_min_of_pw_aff(knl
.get_iname_bounds(name)
.lower_bound_pw_aff,
constants_only=True)
.get_constant_val().to_python())
map_ = map_.apply_domain(
isl.Map(f"{{[{name}] -> [{name}-{lbound_val}]}}"))

map_ = map_.set_dim_name(dt, pos, str(tag))

for i_l in lsize:
Expand Down

0 comments on commit 5ceabca

Please sign in to comment.