Skip to content

Fix schedule replay and legality checks - #10

Merged
Mascinissa merged 6 commits into
Tiramisu-Compiler:mainfrom
Mascinissa:merge_master
Jul 19, 2026
Merged

Fix schedule replay and legality checks#10
Mascinissa merged 6 commits into
Tiramisu-Compiler:mainfrom
Mascinissa:merge_master

Conversation

@Mascinissa

Copy link
Copy Markdown
Collaborator

Summary

This PR brings the C++ schedule executor in line with the schedule semantics used by iraLib. It fixes group unrolling, final-schedule parallel legality, complete skew-matrix parsing, multi-computation parallelization, and explicit subset unrolling.

The Python-side changes are in TiraLib PR #58. The final parallelism check requires Tiramisu PR #422.

Changes

Keep computation groups fused after unrolling

Commit 75f959b restores the .after() ordering of a computation group after applying unroll() to its members.

Each computation::unroll() call splits that computation's loop independently. Applying it to every member of a fused group can therefore introduce loop fission and change the meaning of schedules with dependencies inside that loop. The handler now re-fuses the group at its new innermost level. Single-computation unrolls are unaffected.

The Python equivalent is TiraLib 861caab.

Check parallelization against the final schedule

Commit e0b6be2 runs tiramisu::check_legality_of_parallelism() after all schedule actions have been applied.

A parallel tag is attached to a loop level when the action is processed. Later loop transformations can change which loop occupies that level, making the original legality decision stale. Rechecking the recorded tags on the final schedule fixes the parallelize-then-interchange case from TiraLib issue #34.

This commit depends on Tiramisu d7ad1e8b. The Python equivalent is TiraLib 9ade86a.

Support complete two-dimensional skew matrices

Commit 067dafe extends the S(...) parser with a four-factor form:

S(Li,Lj,alpha,beta,gamma,sigma,...)

[i']   [alpha  beta ] [i]
[j'] = [gamma  sigma] [j]

The existing two-factor form supplies only the first row and relies on Tiramisu to solve for the second. Since that form cannot represent every valid unimodular matrix, the new syntax passes the complete matrix to Tiramisu's four-factor skew overload. The old syntax, including automatic factor selection, remains unchanged.

The Python parser is updated in TiraLib fc425d3, and Tiramisu emits the lossless form in Tiramisu 5fc025f8.

Apply parallelization to every selected computation

Commit a666990 tags every distinct computation listed in P(...).

The handler previously checked the complete list for legality but called tag_parallel_level() only on its first member. That assumption is valid for a completely fused group, but it leaves independent loops serial. The parser now deduplicates the resolved computation pointers and tags each one. Repeated tags for a shared fused loop still produce one parallel loop.

The Python equivalent is TiraLib 4f16a31.

Support legality-checked subset unrolling

Commit 03d818c adds the internal UCheck(...) action and execution_no_check operation needed to replay an explicit subset unroll without widening its target.

Tiramisu's specialized unrolling legality check expects the complete computation group for a fused loop, while execution must apply the transformation only to the computations listed in the schedule. UCheck(...) validates the full group without mutating the legality schedule. After that succeeds, TiraLib starts a fresh server process and applies the original U(...) action to the exact subset. The unchecked execution operation is internal and is selected only after a successful legality result.

This commit also puts the source tree's headers before installed headers during the build, preventing an older installed protocol definition from shadowing the version being built. Full-loop U(...) actions keep their existing path.

The coordinating Python changes are in TiraLib 1c7ba19.

Compatibility

  • Existing two-factor skew strings remain valid.
  • Full-loop unrolling keeps the existing U(...) behavior.
  • Single-computation unrolling is unchanged.
  • Duplicate parallel targets are idempotent.

Testing

  • TiraLibCpp test suite: 22 passed.
  • Added regression coverage for final-schedule parallel legality, four-factor skew parsing, computation-group parallelization, duplicate targets, UCheck(...), and checked subset execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant