Skip to content

[gen] add @before and @after predicates for relaxations in diy7#1835

Open
ShaleXIONG wants to merge 3 commits into
herd:masterfrom
ShaleXIONG:config-edge-overlap
Open

[gen] add @before and @after predicates for relaxations in diy7#1835
ShaleXIONG wants to merge 3 commits into
herd:masterfrom
ShaleXIONG:config-edge-overlap

Conversation

@ShaleXIONG
Copy link
Copy Markdown
Collaborator

@ShaleXIONG ShaleXIONG commented May 14, 2026

Add diy7-only predicate syntax for relax inputs:

  • @before(...)
  • @after(...)

The parser entry points are split so predicate syntax is accepted only by diy7. The shared main/diyone7, diycross7, and cumul parsers reject predicate syntax.

During relax expansion, invalid predicate placement is filtered before search:

  • @before(...) is only valid at the start of a relaxation sequence
  • @after(...) is only valid at the end of a relaxation sequence
  • predicates in the middle of a concrete composition are discarded

During diy7 cycle search, boundary predicates are checked against neighbouring concrete edges. Once checked, predicates are stripped before passing candidate cycles to the normal test generator.

Added tests for:

  • diy7 parser acceptance of @before(...) and @after(...), while other parsers reject of predicate syntax
  • filtering invalid predicate placement to []
  • In diy7 cycle generation, the predicates @beforeand @after merge as expected

Example

diy7 -arch AArch64 -cycleonly true -size 4 -relax '[@before(Po) PodRW Rfe @after(Po)]' -safe Po

This constrains the generated boundary edges to match the predicates. Po will match @before(Po) and after(Po) during the searching.

Generator produced 2 tests
Relaxations tested: {[@before(PosRR),PodRW,Rfe,@after(PosRR)]} {[@before(PodRR),PodRW,Rfe,@after(PodRR)]}
LB000: PosRR PodRW Rfe PosRR PodRW Rfe
LB001: PodRR PodRW Rfe PodRR PodRW Rfe

Another example contains composite relax:

diy7 -arch AArch64 -cycleonly true -size 4 -relax '[PodRW Rfe @after([PodRW Rfe])]'

In this case, the only relaxation will be match with themselves, i.e., the leading PodRW Rfe matches the trailing @after([PodRW Rfe]).

Generator produced 3 tests
Relaxations tested: {[PodRW,Rfe,@after(PodRW),@after(Rfe)]}
LB000: PodRW Rfe PodRW Rfe
3.LB000: PodRW Rfe PodRW Rfe PodRW Rfe
4.LB000: PodRW Rfe PodRW Rfe PodRW Rfe PodRW Rfe

Extend the relax AST with a predicate node and teach the lexer/parser to
recognise predicate applications such as `@before(...)` and `@after(...)`.

Add `map_predicate` support to the AST so predicate names can be
converted before expansion. Parse `before` and `after` into edge predicates,
then attach the parsed predicate to every edge produced by the decorated
relax expression.
@ShaleXIONG ShaleXIONG requested a review from relokin May 14, 2026 10:40
@ShaleXIONG ShaleXIONG force-pushed the config-edge-overlap branch from 660be26 to 3f9520e Compare May 14, 2026 10:47
Extend `diy7` cycle searching to recognise predicate-decorated boundary edges.
`@after(...)` predicates at the end of a candidate edge sequence and
`@before(...)` predicates at the start of the existing suffix are matched
against the adjacent concrete edge before the search continues.
Once predicates have been checked, remove them from candidate cycles before
handing them to the normal test generator.
@ShaleXIONG ShaleXIONG force-pushed the config-edge-overlap branch from 3f9520e to 21ff211 Compare May 14, 2026 13:36
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