Manually building schedule trees

34 views
Skip to first unread message

Louis Narmour

unread,
Nov 25, 2023, 10:18:57 AM11/25/23
to isl Development
Hi,

I have been playing around with schedule trees recently and I have some difficulty when trying to manually build/augment schedule tree instances.

For example, suppose I have a top-level domain (union_set):

{ S0[t,i] : …; S1[t,i] : …; S2[t,i] : …; }

Suppose that I’d like to put the execution of S0 before S1 and S2. I could use a sequence, where the first element is a filter on S0, and the second element on S1 and S2. Then I could use separate schedule_band_nodes for each. For example something like this:

domain: { S0[t,i] : …; S1[t,i] : …; S2[t,i] : …; }
child:
  sequence:
  - filter: { S0[t,i] }
    child:
      schedule: <some multi_union_pw_aff involving S0>
      options: ...
  - filter: { S1[t,i] : …; S2[t,i] : …; }
    child:
      schedule: <some multi_union_pw_aff involving S1 and S2>
      options: …

Can this be constructed manually with the functions currently exposed in the API (version isl-0.22.1-GMP)?

Or rather, assuming that I can manually construct the corresponding union_sets (for the filter nodes), and multi_union_pw_affs (for the schedule_band_nodes), is there a good way to do this? I see many functions to “insert” nodes in the tree, but this is disallowed everywhere except the root it seems.

If my question is too vague or imprecise, please let me know.

Thanks,
Louis Narmour

Sven Verdoolaege

unread,
Nov 30, 2023, 5:07:40 PM11/30/23
to Louis Narmour, isl Development
On Sat, Nov 25, 2023 at 06:59:57AM -0800, Louis Narmour wrote:
> Or rather, assuming that I can manually construct the corresponding
> union_sets (for the filter nodes), and multi_union_pw_affs (for the
> schedule_band_nodes), is there a good way to do this? I see many functions
> to “insert” nodes in the tree, but this is disallowed everywhere except the
> root it seems.

An insert should be *allowed* everywhere except at the root
(and at children of a sequence or set node).
There are some examples in earlier posts, but some of them
are about stuff not working as intended.
Here's an example that should work (using the python interface):

isl.schedule_node.from_domain("{ S0[0:9]; S1[0:9]; S2[0:9] }").child(0).insert_sequence(isl.union_set_list("({ S0[*] }, { S1[*]; S2[*] })")).child(0).child(0).insert_partial_schedule(isl.multi_union_pw_aff("[{ S0[i] -> [-i] }]")).parent().parent().child(1).child(0).insert_partial_schedule(isl.multi_union_pw_aff("[{ S1[i] -> [i]; S2[i] -> [i + 1] }]"))

skimo
Reply all
Reply to author
Forward
0 new messages