Skip to content

Conversation

@mb64
Copy link

@mb64 mb64 commented May 13, 2025

Closes #508 .

Copy link
Owner

@sampsyo sampsyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really awesome work, Mark—this is fantastic. Thanks for the clear explanation of your MLIR-inspired IR and the overview of all the steps in the chain required to make the whole round trip work.

This seems like a fun foundation that someone might want to build on in the future. Would you be interested in contributing your machinery back to the Bril monorepo to perhaps help facilitate that?

Comment on lines +137 to +140
A jump to label `.l` is only allowed when `.l` is in scope (this is what makes
it structured!). Jumping to a `block` label is like a `break`, escaping to the
end of the block, while jumping to a `loop` label is like a `continue`, going
back to the loop header for the next iteration.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a clever way to repurpose Bril labels and jmp in a structured representation.

Comment on lines +187 to +189
flow, or around 65%. Considering just the relooper, interestingly, all 272
functions in these combined test suites exhibit reducible control flow, and
successfully round-trip through just the structured control flow IR.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is interesting! I would have expected some benchmark in there to do something weird with its control flow.

@sampsyo sampsyo merged commit e1a5cdd into sampsyo:2025sp May 14, 2025
2 checks passed
@mb64
Copy link
Author

mb64 commented May 16, 2025

This seems like a fun foundation that someone might want to build on in the future. Would you be interested in contributing your machinery back to the Bril monorepo to perhaps help facilitate that?

I would be interested in this! But I think it deserves some polishing before contributing it. Namely,

  • Either a very clear write-up of the Python interfaces, or a JSON format for Bril with static control flow
  • Better internal docs / comments about code layout, how the algorithm works, and what the limitations are
  • Addressing whatever hacks are there (either redoing them better or at least saying what they are)
  • I would probably want to include a short note about ISL, too. It's not exactly the most intuitive to work with, as the prior polyhedral post pointed out.

Let me know your thoughts -- if this seems reasonable, I'll do it sometime over the summer.

@sampsyo sampsyo added the 2025sp label May 16, 2025
@sampsyo
Copy link
Owner

sampsyo commented May 17, 2025

Great! Sure, all of these sound quite reasonable. FWIW, I wouldn't bother trying to create a JSON representation for the static-control-flow form of Bril… that sounds great to have, but not necessary for an "MVP" that we could merge. Concocting a sensible serialization format for ISL sets seems like an "interesting" design problem that we could leave to future generations.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project Proposal: Polyhedral loop optimizations for Bril

2 participants