Skip to content

Commit 5ce1a1d

Browse files
committed
fix executor multioutput liveness
1 parent fb890eb commit 5ce1a1d

3 files changed

Lines changed: 77 additions & 1 deletion

File tree

python/jittor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# This file is subject to the terms and conditions defined in
88
# file 'LICENSE.txt', which is part of this source code package.
99
# ***************************************************************
10-
__version__ = '1.1.7.10'
10+
__version__ = '1.1.7.11'
1111
from . import lock
1212
with lock.lock_scope():
1313
from . import compiler
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# how to run:
2+
# 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"
3+
# python /home/jittor/Documents/jittor-blog/local_doc_builder.py
4+
5+
import os
6+
7+
os.chdir("/home/jittor/Documents/site")
8+
9+
def check(dirname, fname):
10+
with open(os.path.join(dirname, fname), 'r') as f:
11+
src = f.read()
12+
ac = "JITTOR_BASEURL"
13+
rep = (
14+
("href=\"//", "href=\"http://"),
15+
("src=\"//", "src=\"http://"),
16+
('https://cg.cs.tsinghua.edu.cn/jittor', ac)
17+
)
18+
found = False
19+
for a,b in rep:
20+
if a in src:
21+
src = src.replace(a, b)
22+
found = True
23+
if ac not in src and not found: return
24+
n = len(dirname.split('/'))-1
25+
s = '.' + '/..' * n
26+
new_src = ""
27+
i = -1
28+
print("="*20)
29+
print(dirname, fname)
30+
while True:
31+
i += 1
32+
if i >= len(src):
33+
break
34+
if src[i] != 'J':
35+
new_src += src[i]
36+
continue
37+
if src[i:i+len(ac)] != ac:
38+
new_src += src[i]
39+
continue
40+
j = i
41+
while j<len(src) and src[j] != ' ' and src[j] != '"' and src[j] != "'":
42+
j += 1
43+
x = src[i:j]
44+
y = x.replace(ac, s)
45+
if '#' in y:
46+
y, l = y.split('#')
47+
l = '#'+l
48+
else:
49+
l = ""
50+
# replace xx/xx/ --> xx/xx/index.html
51+
if y.endswith('/'):
52+
y += 'index.html'
53+
else:
54+
z = y.split('/')[-1]
55+
# replace xx/xx --> xx/xx/index.html
56+
if '.' not in z:
57+
y += '/index.html'
58+
y += l
59+
print("found", x, '-->', y)
60+
new_src += y
61+
i = j-1
62+
with open(os.path.join(dirname, fname), 'w') as f:
63+
f.write(new_src)
64+
65+
for r, _, f in os.walk('.'):
66+
for fname in f:
67+
ext = fname.split('.')[-1]
68+
if ext not in ['html', 'css', 'js']:
69+
continue
70+
# print(r, fname)
71+
check(r, fname)
72+

src/executor.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ void Executor::run_sync(vector<Var*> vars, bool device_sync) {
420420
*/
421421
if (!var->need_free())
422422
outputs_bk.push_back(var);
423+
else {
424+
// TODO: will this cause bug?
425+
var->flags.set(NodeFlags::_finished);
426+
}
423427
}
424428
op->finish_pending_liveness();
425429
for (Var* var : outputs_bk)

0 commit comments

Comments
 (0)