-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add code for unrolling affine.for under threshold #441
base: main
Are you sure you want to change the base?
Conversation
Add corresponding test
When I run
This is presumably something to do with the use of innerOp in the for-loop. Do I need to use something like |
@Pangoraw since you said you had something like this earlier, can you take a quick look? also cc @chelini who might have cycles to help co debug |
affine-to-stable-hlo-raising pass
I ran the upstream affine LICM and affine unrolling passes before invoking raise-affine-to-stablehlo |
@snarang181 |
Thanks for looking into this @ivanradanov; and yes, that makes sense. |
This seems to work fine on the test case but is giving a core dumped error on the full unoptimized mlir (running fullpipe.sh). Here is the error snippet
I am happy to debug further, some co-debugging help to get me on the right track would be appreciated though. |
Probably I’d start by adding a print before each function being raised to make a minimal test case |
Do I need to build with some args to get the LLVM_DEBUG to show on stdout? |
You would add -debug for that. however here I’m suggesting adding llvm::errs() << fn << “\n”; at an appropriate point inside the pass, recompiling, and running (which requires no extra flag) |
I get this:
(not 100% sure) but it seems to be because here we emit a null AffineMap for a constant. I am not entirely sure what the correct one would be though
I am off for today but will continue investigating further tomorrow. |
@ivanradanov, that's right. Feel free to ping me on slack when you get online your tomorrow and I'd like to co-debug if possible to get a feel for things. Thanks again for looking into it. |
cc @Pangoraw |
can you add the failing test here as a test file for ease? |
The current approach is missing handling the converted IV as a constant when raising the memref load/store. In the current situation I guess the load/store would result in slices over all possible values. Solving this problem would probably be a first step into making the loops stablehlo.while since the iv would no longer be a constant but a block argument. In the meantime, we can run the upstream affine unrolling pass? |
So these maps are used to identify for each dim in the raised tensors by which induction variable it is dependent. A scalar constant is raised to a 0-dim tensor and therefore as a map with zero dimensions. For example the following value: %0 = affine.load %a[%i, %j] would have a map like |
Add corresponding test