Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple stream and instruction #7607
Decouple stream and instruction #7607
Changes from 216 commits
15bba80
4295084
d66a817
57ad706
d045042
18ace6b
4f3b0d5
7667d56
c3c5f45
d74b0bf
b3bfce5
9a75670
e10beda
621f22e
c330616
3291f55
237a021
5c49246
0580a4c
4d9864f
95be1bf
922a2c2
8ad467d
0c9e994
9115507
0c3aba6
93dfb45
81d6f85
a8acb1e
eac91e8
73ba93a
5d59e8d
d10a094
e5b1fa0
576d67f
6007c97
7014747
c8ad8e4
8c87e68
54fde85
1a31aa7
d851519
09e2fce
0c01d93
0399bd5
1cbf0b0
342a52d
c546ca7
d4de901
4a85eba
7e0be5a
9d20f5d
e419c2c
941e5db
9c55a2d
3accc13
338baf7
9ac96ab
bae01a5
29ccd30
8509484
434b7af
86296cb
454f5e7
d1d9ad7
a58348d
89bf2dc
8bb83a1
8616b0a
fe64379
2b84e87
0220055
9ca83c6
9b5cecc
72426fc
da8b44d
cf14a1e
e3297f4
6f5d7c6
5d0c648
97cf982
a119bf0
d2b36a4
d8862b9
6e22eb4
e58bee9
df91894
93191d7
da35647
a3d45e3
1ec6dc3
3d6c7cd
f7e2241
c1afee6
7c4cb89
7daab5a
07bb2a2
47738f7
87c748f
9d5ab85
80a4542
57fff70
ce55514
c679884
3d930d6
53d088a
2270f72
4c557ff
1e601cf
42d6595
c6ecc12
204aa54
10f42ed
3124ecf
8c6c03e
f105b15
72c30fd
5d6212f
19c18d4
002bacf
668f2e9
5cfcadd
aef2edc
b2d87f2
ecb3250
52af8ae
b9d462a
dece422
ea4da25
7096505
f00f991
ae9d601
89f3ce2
ad18575
b67a60e
fb8b9fa
ec2c402
45fd613
629961b
9656c57
b730ef0
fbd921c
838719f
367e0ce
41c90aa
ab81601
04c4038
ceb0e48
1f5a3df
2a07509
2da0d8d
4b77a70
8b6b3c7
d83f2b8
9ae6be7
3720558
8610775
8fa3938
2d85f7b
cc58bc2
529f879
6e8e9c9
08e9178
f59d17d
3eb809a
55c163c
ac4b9ca
996d748
2144ea1
deb20cf
d5578dc
347c43b
5200d19
8aa2e8f
c9ecc46
aa0aa1c
232d968
858a58c
cd66b57
bf091b6
7f9ebd4
16bf442
59aeb2d
7612597
5bce98e
83b1add
de5f971
0561081
e695052
8e86949
e941081
0efa99b
94a70a4
63d2715
0e09292
7845ebe
f020749
4775c72
6fafb4b
8e56ed3
e505030
cf90b47
a16fbb6
859e0fb
e265ca4
4965e35
3f3f4e0
aed678d
566ea61
95e0169
a061c50
1b0df76
d6f39eb
aa28ca7
15316cf
17cf5eb
2706def
b483efc
56c8a03
81b8449
3bf92e4
4f3b775
e7ae284
b2a808b
94e1075
f448b0b
c7c300c
1cf5a0d
6544826
08b1723
3a7cf44
0e5392b
d4d345f
ccd9961
3d834f0
cbef051
a87e37b
2ca0707
8537b7e
c04ee65
01e0615
fcd06ae
8f6a7ba
66b59bb
e93e9d7
cdebc4c
ef83aae
dc32ebc
32890ec
cf4220c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注释为 lock free 貌似不准确,lock free 有自己特殊的含义,是不是应该写 thread unsafe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里准确的意思就是 thread safe。这个函数允许不同的线程同时访问而不至于出错。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理:d6f39eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里又把前面的数据给复制一遍了?似乎不大有必要,直接resize就好了,而且这里有必要做一些优化么,因为1+2+4+...+2^N最后只存了2^N的数据,但却额外多占了接近一倍的内存
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resize 会要求有默认构造函数,也不是很好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看这个PR里只用它存了一个指针,目前没什么问题,现在拷贝的话一样也会有拷贝构造函数的要求,最好的办法就是直接从0开始push back,避免了上述问题,还能节省内存
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
确实,index 的计算也不会特别复杂,差不多就是直接减 2^granularity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
处理了: 6fafb4b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里前几个vector的大小分别是 1, 2, 4, 8,如果T类型是指针,这里会导致前7个元素占用了3个cache line,如果vector大小是,8, 16, 32 那么就没有这个问题了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里push_back的性能不是优化目的,operator[]才是。而且这个优化会让索引换算变复杂,暂时不做了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个不是为了优化 push_back,而是为了优化访问的性能,有机会提高缓存的命中率,而且索引变换并不复杂,用2的次方其实就是多了几个移位操作
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这里也没有必要用
vector<T>
,直接用指针就好了吧There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理:e7ae284
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以改回 vec[index] 了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理:3d834f0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的改动是为了什么 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里建议给 AddAndReadVector 加一个 operator[],有些情况是比较明确不需要做边界检查的,比如
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已处理:1b0df76