Skip to content

loopy ignores memory dependencies where source=target

This is since DependencyTracker.describe_dependency() doesn't classify memory accesses as a memory dependency unless the given pair of instructions have a (syntactic) dependency edge or are in conflicting groups.

Example:

import loopy as lp
knl = lp.make_kernel("{[i,j]: 0 <=i,j<10}",
"""
for i
 for j
  B[i+1,j] = B[i,j]
 end
end
""",
"...")
knl = lp.prioritize_loops(knl, "i,j")
print(lp.get_one_scheduled_kernel(lp.preprocess_kernel(knl)))

which yields:

---------------------------------------------------------------------------
KERNEL: loopy_kernel
---------------------------------------------------------------------------
ARGUMENTS:
B: GlobalArg, type: <runtime>, shape: (11, 10), dim_tags: (N1:stride:10, N0:stride:1)
---------------------------------------------------------------------------
DOMAINS:
{ [i, j] : 0 <= i <= 9 and 0 <= j <= 9 }
---------------------------------------------------------------------------
INAME IMPLEMENTATION TAGS:
i: None
j: None
---------------------------------------------------------------------------
INSTRUCTIONS:
[i,j]                                B[i + 1, j] <- B[i, j]   # insn
---------------------------------------------------------------------------
SCHEDULE:
   0: CALL KERNEL loopy_kernel(extra_args=[], extra_inames=[])
   1:     FOR i
   2:         FOR j
   3:             [insn] B[i + 1, j] <- B[i, j]
   4:         END j
   5:     END i
   6: RETURN FROM KERNEL loopy_kernel
---------------------------------------------------------------------------