-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[RFC] Lower Bound for Shape Variables #4487
Comments
I am not sure if we want to introduce this specialized assertion as a special Expr. It might be a better idea to have it as an intrinsic |
I am also thinking about pushing a parallel change to allow IterVar as a sub-class of Var. Note that it won't solve the problem of shape var bounds, but might also help some of the situations. |
Yes, I agree we should have a general |
Thanks @tqchen @icemelon9 I'll change to use intrinsic and make it more general. |
Motivation
As we have replaced
truncdiv
/truncmod
byfloordiv
/floormod
in most places, there's a large demand for simplification to know the sign of the expression. For example, knowing the tensor shape bound can help reduce the if/else conditions significantly.Here's an example of generated cuda code for the tvm program posted in this troubleshooting
tindex >= 0
: https://gist.github.com/yzhliu/f1aa7c1f25cfd8788cda75a350c4b274tindex >= 0
: https://gist.github.com/yzhliu/217e997157efcfc2a34e5c27b357fcaaApproach
AssertLowerBound
,tvm.placeholder
andtvm.compute
insertsassert_lower_bound(i, 0)
automatically.ConstIntBoundAnalyzer
will recognizeAssertLowerBound
and generate the Bound accordingly for the variables.CodeGenC
andCodeGenLLVM
to supportAssertLowerBound
- simply replace with its value. (Should we insert extra assertion instructions?)Here is a draft of the implement: #4486
@tqchen @icemelon9 @reminisce
The text was updated successfully, but these errors were encountered: