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

Can we pass to the harness a partially transformed file and execute only a partial pipeline? #94

Open
giuseros opened this issue Dec 8, 2021 · 2 comments

Comments

@giuseros
Copy link
Collaborator

giuseros commented Dec 8, 2021

This stemmed from the discussion here: #83 (comment)

Basically, the situation I often find myself in is that I manually apply some transformation to the MLIR textual code produced by the first N transformations of the pipeline. Then I pass the modified textual code to the last part of the pipeline.

I.e., , if the pipeline is [P0, P1, P2, P3, P4, P5]
a) I apply P0->P1->P2 and generate intermediate.mlir
b) I modify intermediate.mlir to improve things
c) I apply P3->P4->P5 to see if performance got better

Is this doable in the current status?

@nicolasvasilache
Copy link
Contributor

This should be very easy to do today.
We've used https://github.com/google/iree-llvm-sandbox/blob/main/python/examples/core/transforms.py#L60 for the same purpose; you just want the string to be read from a file rather than pasted inline.

f = open ("foo.mlir", "r")
ir = f.readlines()

adding @ftynse to ensure recent refactorings are mindful of Inject / TransformationList interplay.

@ftynse
Copy link
Contributor

ftynse commented Dec 8, 2021

Test harness is ultimately about running the code, so we cannot just instruct it to produce unrunnable code. If you want human-in-the-loop, you can do something like print(P0.then(P1).then(P2)(your-module)), modify the code manually, parse it back and have an "expert" that does P3.then(P4).then(P5) on it passed to the harness. This should be fine as long as the ABI of the entry point remains the same.

For adventurous ones, it is possible to have a "transform" that prints the IR into a file and then popen's $EDITOR with that file for the user to edit before parsing it back.

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

No branches or pull requests

3 participants