Repository navigation
Small bugfix in EmplaceAllocations - #15261
Conversation
|
Btw this seems to avoid failure on the RNG PR too. |
e769ad0 to
28b9f58
Compare
|
@benvanik given the diff on the lit tests, are our new checks too strict? it seems like a lot less is getting fused. I suppose maybe this is expected until we can move whole branches up the tree? syntax-colored diff: |
|
(If you push another [empty] commit it will run benchmarks if you want some verification) |
|
haven't had coffee yet but I'm not sure what I'm looking at in that diff :) |
28b9f58 to
f45721f
Compare
|
Lit test example: Before my patch: After: Looking at the after, we can see that the update didn't get fused |
|
yeah that's not good as nothing should prevent that from happening |
|
I suspect this, which you shouldn't need: (the result of the update will never be usable for the dispatch, as the update always happens after the dispatch) if (!IREE::Util::isValueUsableForOp(updateOp.getResult(), dispatchOp))
break; |
Added some checks to avoid insertion point errors. This is a bit of a quick fix, as ideally we would find a way to move entire trees up when possible, but I'll file an issue for that
f45721f to
4a99e8e
Compare
|
facepalm |
|
Based on the discussion in mai-tai today, should I assume these benchmark changes are spurious? |
|
They can be noisy so I think so? This might be hard to tell because my guess would be that typically the gains from this pass are relatively small compared to kernels. When you need it it's really important, but those benchmarks are quite noisy. I think if it's passing the lit tests it's fine (+ the change makes sense). |
|
If really concerned, try running locally before and after a few runs (would be less noisy). These seem within noise level though. And also without this we get some weird numerical failures, so I'd rather than a hit and not have to chase down numerics and then improve performance. |
re: the numerical error, might be good to re-check. The initial version of this patch essentially made it so that the pattern never applied, and with this patch, if the pattern successfully applied before I think it should still apply. |
|
Ah good to know, let me check |
|
Biggest detectable changes would be memory consumption at runtime - did we ever get tracking of that? |
And yeah you are correct, now it fails again with wrong result. |
|
Any reason not to land this though? Seems like it's required for some Turbine/LLM work. |
|
I think it's good to land but we should make sure we aren't regressing too much on memory consumption without knowing it - this pass not running can lead to 2-10x peak memory consumption and on 7-70B models can be ... real bad :) |
|
@benvanik I don't see an issue for tracking memory consumption at runtime. I'll add it and bring it up on the next mai-tai. Seems pretty critical. |
Added some checks to avoid insertion point errors. This is a bit of a quick fix, as ideally we would find a way to move entire trees up when possible, but I'll file an issue for that.
#15261 was aggressive in disabling the pass for any offset/size SSA values computed as part of updates. In most programs the offset arith ops would end up after the dispatches we would want to emplace and this pass wouldn't touch them. Now we try to move the arith ops up before the dispatch so we can do the placement.
#15261 was aggressive in disabling the pass for any offset/size SSA values computed as part of updates. In most programs the offset arith ops would end up after the dispatches we would want to emplace and this pass wouldn't touch them. Now we try to move the arith ops up before the dispatch so we can do the placement. Progress on #16647. This allows us to emplace llama2 variable updates with dynamic offsets.
Added some checks to avoid insertion point errors. This is a bit of a quick fix, as ideally we would find a way to move entire trees up when possible, but I'll file an issue for that.
TODO add a test for this case