Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Draft autoscheduler #831

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[WIP] Draft autoscheduler #831

wants to merge 1 commit into from

Conversation

mtsokol
Copy link
Collaborator

@mtsokol mtsokol commented Jan 7, 2025

WIP

@mtsokol mtsokol self-assigned this Jan 7, 2025
Copy link

codspeed-hq bot commented Jan 7, 2025

CodSpeed Performance Report

Merging #831 will degrade performances by 30.19%

Comparing ms/draft-autoscheduler (219b11f) with main (ada7871)

Summary

❌ 1 regressions
✅ 339 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main ms/draft-autoscheduler Change
test_index_slice[side=100-rank=2-format='gcxs'] 2.4 ms 3.4 ms -30.19%

@mtsokol mtsokol force-pushed the ms/draft-autoscheduler branch from 3e5894a to 219b11f Compare January 8, 2025 12:12
@hameerabbasi
Copy link
Collaborator

I feel we're implementing a lot of IR pass infrastructure which we don't really need -- IMHO it'd be better to define an IR and do it via egglog or MLIR.

@mtsokol
Copy link
Collaborator Author

mtsokol commented Jan 9, 2025

I think the only part of pass infrastructure rewritten here is rewrite_tools.py taken from Julia Finch. The rest is scheduler logic (passes, IR).
I used egglog for the first try but using pure Python and its structural pattern matching ended up more convenient for me (I could directly map Julia implementation, I can have side-effects inside matches).

@willow-ahrens
Copy link
Collaborator

egglog is overkill for a lot of Finch rewriting (especially since e-graph behavior is unbounded for the rules Finch uses, and deterministic matching works fine). The only time we might want to consider using Egglog would be for the theorem-proving rules. In the past, Jaeyeon has used Z3 for this to great success. However, the use of e-graphs should be considered a research topic for our initial rewriting.

@willow-ahrens
Copy link
Collaborator

as for defining AST's, we might consider using the approach used in EXO: https://github.com/ChezJrk/asdl

@willow-ahrens
Copy link
Collaborator

one last thing: I think the deferred node may change soon, all of the rest of this ast is stable but we may need to change deferred node. I'll try to remind y'all when I make the update.

@willow-ahrens
Copy link
Collaborator

I personally really like that you can use the default python pattern matching here, it's a big benefit for readability and maintainability. I struggled for a long time to teach new users how to use the custom julia rewriting library because julia had no inbuilt pattern matching syntax.

@mtsokol
Copy link
Collaborator Author

mtsokol commented Jan 9, 2025

as for defining AST's, we might consider using the approach used in EXO: https://github.com/ChezJrk/asdl

I will take a look at it! Here the requirement is that each AST class must be a Python @dataclass to be used in the pattern matching. Right, pattern matching well suited here.

@willow-ahrens
Copy link
Collaborator

I don't want to push too hard for ASDL,having each ast node be it's own class is simpler and easy to understand.

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.

3 participants