Jittor / jittor

Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.
https://cg.cs.tsinghua.edu.cn/jittor/
Apache License 2.0
3.07k stars 308 forks source link

Error happend during compilatio in `jt.init.eye` #515

Open x0w3n opened 4 months ago

x0w3n commented 4 months ago

Describe the bug

When a very large value is given to the parameter jt.init.eye, a Compilation failure occurs, causing the code to not run. This should be replaced with runtime error instead of direct Compilation failure.

Full Log

[i 0507 20:18:37.634195 32 compiler.py:956] Jittor(1.3.8.5) src: /root/anaconda3/envs/jt/lib/python3.7/site-packages/jittor
[i 0507 20:18:37.637027 32 compiler.py:957] g++ at /usr/bin/g++(11.4.0)
[i 0507 20:18:37.637092 32 compiler.py:958] cache_path: /root/.cache/jittor/jt1.3.8/g++11.4.0/py3.7.0/Linux-6.5.0-27xd2/IntelRXeonRGolx8d/default
[i 0507 20:18:37.640747 32 __init__.py:411] Found nvcc(12.1.105) at /usr/local/cuda/bin/nvcc.
[i 0507 20:18:37.692159 32 __init__.py:411] Found gdb(12.1) at /usr/bin/gdb.
[i 0507 20:18:37.695348 32 __init__.py:411] Found addr2line(2.38) at /usr/bin/addr2line.
[i 0507 20:18:37.776720 32 compiler.py:1011] cuda key:cu12.1.105_sm_86
[i 0507 20:18:38.109537 32 __init__.py:227] Total mem: 219.97GB, using 16 procs for compiling.
[i 0507 20:18:38.181912 32 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
[i 0507 20:18:38.253350 32 init.cc:62] Found cuda archs: [86,]
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    jt.init.eye(1000000,3948000418890973690)  #crash
  File "/root/anaconda3/envs/jt/lib/python3.7/site-packages/jittor/init.py", line 41, in eye
    return (index[0]==index[1]).unary(dtype)
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.unary)).

Types of your inputs are:
 self   = Var,
 args   = (int, ),

The function declarations are:
 VarHolder* unary(VarHolder* x,  NanoString op)

Failed reason:[f 0507 20:18:38.560844 32 pyjt_jit_op_maker.cc:1809] Not a valid call.

Minimal Reproduce

import jittor as jt
from jittor import *
jt.init.eye(1000000,3948000418890973690)

Expected behavior

This should be replaced by a runtime error instead of a direct Compilation failure, i.e. it need to add the corresponding check function