fix executor multioutput liveness

This commit is contained in:
Dun Liang 2020-08-27 22:34:33 +08:00
parent fb890eba8c
commit 5ce1a1d6e8
3 changed files with 77 additions and 1 deletions

View File

@ -7,7 +7,7 @@
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.1.7.10'
__version__ = '1.1.7.11'
from . import lock
with lock.lock_scope():
from . import compiler

View File

@ -0,0 +1,72 @@
# how to run:
# docker run -v "${HOME}/Documents/jittor-blog":/srv/jittor-blog -v /home/jittor/Documents/site:/mnt/jittor-blog -e LC_ALL=C.UTF-8 --rm jittor-blog-compiler bash -c "jekyll build --baseurl=JITTOR_BASEURL -d /mnt/jittor-blog/ && chmod -R 777 /mnt/jittor-blog"
# python /home/jittor/Documents/jittor-blog/local_doc_builder.py
import os
os.chdir("/home/jittor/Documents/site")
def check(dirname, fname):
with open(os.path.join(dirname, fname), 'r') as f:
src = f.read()
ac = "JITTOR_BASEURL"
rep = (
("href=\"//", "href=\"http://"),
("src=\"//", "src=\"http://"),
('https://cg.cs.tsinghua.edu.cn/jittor', ac)
)
found = False
for a,b in rep:
if a in src:
src = src.replace(a, b)
found = True
if ac not in src and not found: return
n = len(dirname.split('/'))-1
s = '.' + '/..' * n
new_src = ""
i = -1
print("="*20)
print(dirname, fname)
while True:
i += 1
if i >= len(src):
break
if src[i] != 'J':
new_src += src[i]
continue
if src[i:i+len(ac)] != ac:
new_src += src[i]
continue
j = i
while j<len(src) and src[j] != ' ' and src[j] != '"' and src[j] != "'":
j += 1
x = src[i:j]
y = x.replace(ac, s)
if '#' in y:
y, l = y.split('#')
l = '#'+l
else:
l = ""
# replace xx/xx/ --> xx/xx/index.html
if y.endswith('/'):
y += 'index.html'
else:
z = y.split('/')[-1]
# replace xx/xx --> xx/xx/index.html
if '.' not in z:
y += '/index.html'
y += l
print("found", x, '-->', y)
new_src += y
i = j-1
with open(os.path.join(dirname, fname), 'w') as f:
f.write(new_src)
for r, _, f in os.walk('.'):
for fname in f:
ext = fname.split('.')[-1]
if ext not in ['html', 'css', 'js']:
continue
# print(r, fname)
check(r, fname)

View File

@ -420,6 +420,10 @@ void Executor::run_sync(vector<Var*> vars, bool device_sync) {
*/
if (!var->need_free())
outputs_bk.push_back(var);
else {
// TODO: will this cause bug?
var->flags.set(NodeFlags::_finished);
}
}
op->finish_pending_liveness();
for (Var* var : outputs_bk)