-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Description
🐛 Describe the bug
Let's say you have some code where you need the inputs to not 0/1 specialize. Today, we tell you to do torch._dynamo.mark_unbacked to avoid 0/1 specialization. But doing this actually triggers two orthogonal mechanisms:
- You opt into the alternate size oblivious semantics, which allows you to avoid doing specializations on 0/1 in many situations
- You say no guards allowed on this value at all
But the second is not at all necessary! For example, if I have:
def f(x):
if x.size(0) >= 10:
return x + x
else:
return x * 3
If I didn't want x to 0/1 specialize, I might still be perfectly happy to install a guard u0 >= 10. Now, if I'm using mark_unbacked to avoid situations where I'd have to compile exponentially many kernels, I'd have to make sure that I don't actually trigger too many of these guards, but this is something I'd like be more than happy to solve for at some later point in time.
Sort of related to hybrid unbacked SymInts.
Versions
main
cc @gchanan @zou3519 @kadeng @msaroufim @chauhang @penguinwu @bobrenjc93