Jittor / jittor

Jittor is a high-performance deep learning framework based on JIT compiling and meta-operators.

Home Page:https://cg.cs.tsinghua.edu.cn/jittor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash with error happend during compilatio in `jt.nn.conv/conv2d/conv3d`

x0w3n opened this issue · comments

Describe the bug

A crash is triggered when setting a negative value for the groups parameter of jt.nn.conv/conv2d/conv3d, resulting in error happend during compilation.

Full Log

conv:

[i 0509 00:31:19.315342 96 compiler.py:956] Jittor(1.3.9.6) src: /jittor/python/jittor
[i 0509 00:31:19.318377 96 compiler.py:957] g++ at /usr/bin/g++(8.3.0)
[i 0509 00:31:19.318449 96 compiler.py:958] cache_path: /root/.cache/jittor/jt1.3.9/g++8.3.0/py3.7.4/Linux-5.15.153x56/13thGenIntelRCx56/8c5a/master
[i 0509 00:31:19.322152 96 __init__.py:412] Found addr2line(2.31.1) at /usr/bin/addr2line.
[i 0509 00:31:19.547922 96 __init__.py:227] Total mem: 15.43GB, using 5 procs for compiling.
[i 0509 00:31:19.619237 96 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
root@ee88acc6b368:/home/jt# python test.py
[i 0509 01:00:44.317638 20 compiler.py:956] Jittor(1.3.9.6) src: /jittor/python/jittor
[i 0509 01:00:44.321452 20 compiler.py:957] g++ at /usr/bin/g++(8.3.0)
[i 0509 01:00:44.321527 20 compiler.py:958] cache_path: /root/.cache/jittor/jt1.3.9/g++8.3.0/py3.7.4/Linux-5.15.153x56/13thGenIntelRCx56/8c5a/master
[i 0509 01:00:44.326444 20 __init__.py:412] Found addr2line(2.31.1) at /usr/bin/addr2line.
[i 0509 01:00:44.558281 20 __init__.py:227] Total mem: 15.43GB, using 5 procs for compiling.
[i 0509 01:00:44.635133 20 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
Traceback (most recent call last):
  File "test.py", line 43, in <module>
    jt.nn.conv(jt.ones([1,1,1,1]), weight=jt.ones([1,1,1,1]), groups=-9223372036854775808)
  File "/jittor/python/jittor/nn.py", line 1222, in conv2d
    f'i5*{stride[1]}-{padding[1]}+i7*{dilation[1]}', # Wid+KWid
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.reindex)).

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

The function declarations are:
 VarHolder* reindex(VarHolder* x,  NanoVector shape,  vector<string>&& indexes,  float64 overflow_value=0,  vector<string>&& overflow_conditions={}, vector<VarHolder*>&& extras={})
 VarHolder* reindex_(VarHolder* x, vector<VarHolder*>&& indexes,  float64 overflow_value=0,  vector<string>&& overflow_conditions={})

Failed reason:[f 0509 01:00:44.777963 20 nano_vector.h:107] Check failed: s<10 && next_offset<=64  Something wrong... Could you please report this issue?

conv2d:

[i 0509 01:01:06.980406 12 compiler.py:956] Jittor(1.3.9.6) src: /jittor/python/jittor
[i 0509 01:01:06.983048 12 compiler.py:957] g++ at /usr/bin/g++(8.3.0)
[i 0509 01:01:06.983126 12 compiler.py:958] cache_path: /root/.cache/jittor/jt1.3.9/g++8.3.0/py3.7.4/Linux-5.15.153x56/13thGenIntelRCx56/8c5a/master
[i 0509 01:01:06.987377 12 __init__.py:412] Found addr2line(2.31.1) at /usr/bin/addr2line.
[i 0509 01:01:07.218000 12 __init__.py:227] Total mem: 15.43GB, using 5 procs for compiling.
[i 0509 01:01:07.289112 12 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
Traceback (most recent call last):
  File "test.py", line 41, in <module>
    jt.nn.conv2d(jt.ones([1,1,1,1]), weight=jt.ones([1,1,1,1]), groups=-9223372036854775808) # crash
  File "/jittor/python/jittor/nn.py", line 1222, in conv2d
    f'i5*{stride[1]}-{padding[1]}+i7*{dilation[1]}', # Wid+KWid
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.reindex)).

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

The function declarations are:
 VarHolder* reindex(VarHolder* x,  NanoVector shape,  vector<string>&& indexes,  float64 overflow_value=0,  vector<string>&& overflow_conditions={}, vector<VarHolder*>&& extras={})
 VarHolder* reindex_(VarHolder* x, vector<VarHolder*>&& indexes,  float64 overflow_value=0,  vector<string>&& overflow_conditions={})

Failed reason:[f 0509 01:01:07.419113 12 nano_vector.h:107] Check failed: s<10 && next_offset<=64  Something wrong... Could you please report this issue?

conv3d:

[i 0509 01:01:32.925782 08 compiler.py:956] Jittor(1.3.9.6) src: /jittor/python/jittor
[i 0509 01:01:32.929414 08 compiler.py:957] g++ at /usr/bin/g++(8.3.0)
[i 0509 01:01:32.929489 08 compiler.py:958] cache_path: /root/.cache/jittor/jt1.3.9/g++8.3.0/py3.7.4/Linux-5.15.153x56/13thGenIntelRCx56/8c5a/master
[i 0509 01:01:32.935465 08 __init__.py:412] Found addr2line(2.31.1) at /usr/bin/addr2line.
[i 0509 01:01:33.169536 08 __init__.py:227] Total mem: 15.43GB, using 5 procs for compiling.
[i 0509 01:01:33.241612 08 jit_compiler.cc:28] Load cc_path: /usr/bin/g++
Traceback (most recent call last):
  File "test.py", line 42, in <module>
    jt.nn.conv3d(jt.ones([1,1,1,1,1]), weight=jt.ones([1,1,1,1]), groups=-9223372036854775808)
  File "/jittor/python/jittor/nn.py", line 1312, in conv3d
    f'i6*{stride[2]}-{padding[2]}+i9*{dilation[2]}', # Did+KDid
RuntimeError: Wrong inputs arguments, Please refer to examples(help(jt.reindex)).

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

The function declarations are:
 VarHolder* reindex(VarHolder* x,  NanoVector shape,  vector<string>&& indexes,  float64 overflow_value=0,  vector<string>&& overflow_conditions={}, vector<VarHolder*>&& extras={})
 VarHolder* reindex_(VarHolder* x, vector<VarHolder*>&& indexes,  float64 overflow_value=0,  vector<string>&& overflow_conditions={})

Failed reason:[f 0509 01:01:33.373230 08 nano_vector.h:107] Check failed: s<10 && next_offset<=64  Something wrong... Could you please report this issue?

Minimal Reproduce

conv:

import jittor as jt
from jittor import *
jt.nn.conv(jt.ones([1,1,1,1]), weight=jt.ones([1,1,1,1]), groups=-9223372036854775808)

conv2d:

import jittor as jt
from jittor import *
jt.nn.conv2d(jt.ones([1,1,1,1]), weight=jt.ones([1,1,1,1]), groups=-9223372036854775808)

conv3d:

import jittor as jt
from jittor import *
jt.nn.conv3d(jt.ones([1,1,1,1,1]), weight=jt.ones([1,1,1,1]), groups=-9223372036854775808)

Expected behavior

the crash occurs because there is no check on the groups parameter, and boundary value checking should be added to the underlying counterpart function,and should be replaced with runtime error instead of direct crash.