You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "wuyii8941 (via GitHub)" <gi...@apache.org> on 2026/04/27 03:58:26 UTC

[I] [Bug] `R.isnan`, `R.isinf`, `R.isfinite` crash at build time — CodeGenVM intrinsic not implemented [tvm]

wuyii8941 opened a new issue, #19452:
URL: https://github.com/apache/tvm/issues/19452

   
   ### Expected behavior
   
   `R.isnan()`, `R.isinf()`, and `R.isfinite()` should compile and produce correct boolean tensor outputs on both CPU and CUDA targets.
   
   ### Actual behavior
   
   All three ops crash during `relax.build()` with:
   
   ```
   InternalError: CodeGenVM cannot handle this intrinsic now:
   Op(relax.isnan)
   ```
   
   This occurs on **both** CPU (llvm) and CUDA targets.
   
   ### Environment
   
   - **TVM**: main branch @ commit `0b0afd8dd` (2026-04-25)
   - **OS**: Ubuntu 20.04
   
   ### Steps to reproduce
   
   ```python
   import numpy as np
   import tvm
   from tvm import relax
   import tvm.relax.op as R
   
   bb = relax.BlockBuilder()
   x = relax.Var("x", relax.TensorStructInfo((4, 8), "float32"))
   with bb.function("main", [x]):
       with bb.dataflow():
           out = bb.emit(R.isnan(x))
           gv = bb.emit_output(out)
       bb.emit_func_output(gv)
   mod = bb.get()
   
   pipeline = tvm.ir.transform.Sequential([relax.transform.LegalizeOps()])
   mod_l = pipeline(mod)
   exe = relax.build(mod_l, target="llvm")  # CRASH
   ```
   
   Same crash for `R.isinf(x)` and `R.isfinite(x)`.
   
   ### Notes
   
   - These ops are registered in the Relax op registry and can be used to construct valid IR modules.
   - The PyTorch FX frontend already supports importing `isnan`/`isinf`/`isfinite` (PR #17659), but the backend code generation was not updated to handle them — so models using these ops can be imported but not compiled.
   - Similar CodeGenVM gaps have been reported and fixed before for other ops (e.g., #14437, #17867).
   


-- 
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: discuss-archive-unsubscribe@tvm.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [I] [Bug] `R.isnan`, `R.isinf`, `R.isfinite` crash at build time — CodeGenVM intrinsic not implemented [tvm]

Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex closed issue #19452: [Bug] `R.isnan`, `R.isinf`, `R.isfinite` crash at build time — CodeGenVM intrinsic not implemented
URL: https://github.com/apache/tvm/issues/19452


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org


Re: [I] [Bug] `R.isnan`, `R.isinf`, `R.isfinite` crash at build time — CodeGenVM intrinsic not implemented [tvm]

Posted by "tlopex (via GitHub)" <gi...@apache.org>.
tlopex commented on issue #19452:
URL: https://github.com/apache/tvm/issues/19452#issuecomment-4363543233

   Closed as fixed by #19492 


-- 
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: discuss-archive-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org