blufissure opened a new issue, #14729: URL: https://github.com/apache/tvm/issues/14729
Hello, I’m studying TVM and its low-level operators recently. I tried to construct some test files but I was puzzled by the results of some of the files. When I built different statements, different execution results have occurred. The reason that TVM throws the exception is that TVM checks the uint’s value and finds the uint expression is negative. But I still have two questions: 1. Why using different Attribute type key can lead to different execution results?(see Primfunc with body1 and body2) 2. Why using `IfThenElse` statement and using different statements as body can lead to different execution results? The attribute statement with `pragma_auto_unroll_max_step` will execute normally (see PrimFunc with body4). But the `LetStmt` statement throws the exception(see PrimFunc with body6). I don't know what causes this difference in execution and whether TVM checks the branch’s expression if the branch is not executed. I have noticed that this problem maybe occurs in the specific version. I’d be appreciated if anyone can help me. ### Actual behavior The PrimFunc with body1,body3 and body6 will throw the exception and the PrimFunc with body2,body4 and body5 will execute normally. The error messages are:  ### Environment TVM version 0.10.dev0, git commit ee319d9d23c80091da9c4fb764b1e6d49d462714 ### Steps to reproduce ```python import tvm from tvm import tir var1=tir.Var('v1','int32') var2=tir.Var('v2','uint32') a=tir.IntImm('uint32',73829502) b=tir.IntImm('uint32',1726448906) uint=tir.Sub(a,b) itevars=tir.IterVar([-16, 0], var1, 4, 'vthread.z') body1=tir.AttrStmt(itevars,'pragma_auto_unroll_max_step',uint,tir.Evaluate(1.6)) body2=tir.AttrStmt(itevars,'thread_extent',uint,tir.Evaluate(1.6)) body3=tir.LetStmt(var2,uint,tir.Evaluate(2.1)) body4 = tir.IfThenElse(tir.LT(3,1),body1,tir.Evaluate(0)) body5= tir.IfThenElse(tir.LT(3,1),body2,tir.Evaluate(0)) body6= tir.IfThenElse(tir.LT(3,1),body3,tir.Evaluate(0)) func1=tir.PrimFunc([],body=body1) func2=tir.PrimFunc([],body=body2) func3=tir.PrimFunc([],body=body3) func4=tir.PrimFunc([],body=body4) func5=tir.PrimFunc([],body=body5) func6=tir.PrimFunc([],body=body6) tvm.build(func4) ``` ### Triage * tir:op -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
