-
Notifications
You must be signed in to change notification settings - Fork 14
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
Multi sched read #55
base: main
Are you sure you want to change the base?
Multi sched read #55
Conversation
faac920
to
c74300f
Compare
c74300f
to
f8ae235
Compare
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.
This is looks good. Here are some minor comments as I tried to understand the code.
@@ -39,6 +39,99 @@ void test_body() | |||
}); | |||
} | |||
|
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.
I wonder if we should have some more racy tests. Where there are concurrent attempts to schedule, and hence concurrent potential wake and schedule, and sleep. We don't seem to cover those cases here.
cown, | ||
first_body_index, | ||
first_slot, | ||
last_slot, | ||
transfer_count, | ||
false, | ||
0, | ||
0, | ||
all_reads, | ||
first_consecutive_readers_count}; |
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.
Update the comment
auto last_slot = std::get<1>(cown_to_behaviour_slot_map[i]); | ||
size_t first_body_index = std::get<0>(cown_to_behaviour_slot_map[i]); | ||
auto first_slot = last_slot; | ||
|
||
// The number of RCs provided for the current cown by the when. | ||
// I.e. how many moves of cown_refs there were. | ||
size_t transfer_count = last_slot->is_move(); | ||
|
||
auto all_reads = last_slot->is_read_only(); | ||
|
||
Logging::cout() << "Processing " << cown << " " << body << " " | ||
<< last_slot << " Index " << i << Logging::endl; | ||
|
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.
I wonder if this would be a little clearer:
auto last_slot = std::get<1>(cown_to_behaviour_slot_map[i]); | |
size_t first_body_index = std::get<0>(cown_to_behaviour_slot_map[i]); | |
auto first_slot = last_slot; | |
// The number of RCs provided for the current cown by the when. | |
// I.e. how many moves of cown_refs there were. | |
size_t transfer_count = last_slot->is_move(); | |
auto all_reads = last_slot->is_read_only(); | |
Logging::cout() << "Processing " << cown << " " << body << " " | |
<< last_slot << " Index " << i << Logging::endl; | |
auto first_slot = std::get<1>(cown_to_behaviour_slot_map[i]); | |
size_t first_body_index = std::get<0>(cown_to_behaviour_slot_map[i]); | |
// The number of RCs provided for the current cown by the when. | |
// I.e. how many moves of cown_refs there were. | |
size_t transfer_count = first_slot->is_move(); | |
auto all_reads = first_slot->is_read_only(); | |
Logging::cout() << "Processing " << cown << " " << body << " " | |
<< first_slot << " Index " << i << Logging::endl; | |
auto last_slot = first_slot; | |
I also wonder if we should rename last_slot
to curr_slot
? That makes it clear it is varying during the loop.
Logging::cout() << "Processing " << cown << " " << body << " " | ||
<< last_slot << " Index " << i << Logging::endl; | ||
|
||
size_t first_consecutive_readers_count = all_reads; |
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.
I wonder if this would be slightly clearer?
size_t first_consecutive_readers_count = all_reads; | |
size_t first_consecutive_readers_count = all_reads? 1 : 0; |
{ | ||
Logging::cout() << " Previous slot is a writer or blocked reader cown " | ||
<< *new_slot << Logging::endl; | ||
<< *chain_first_slot << Logging::endl; | ||
yield(); | ||
goto fn_out; |
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.
I wonder if direct returns in this code would be clearer.
goto fn_out; | |
return {0, 0}; |
I'm also not sure I get the usage of ex_count
here. This is that all the reads in this chain have seen a READ_AVAILABLE
, so they can all decrease there execution count by 1?
yield(); | ||
cown->next_writer = first_body; | ||
} | ||
} | ||
|
||
// Process execution count | ||
ec[first_body_index] += ex_count; | ||
|
||
for (int i = 1; i < first_consecutive_readers_count; i++) | ||
ec[first_body_index + i] += 1; |
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.
Why is ex_count
not used here? It feels like the whole chain should get to go if the read available was seen during scheduling, but otherwise it shouldn't? Doesn't this increase the count on the chain apart from the first entry, if read available wasn't seen?
{ | ||
Logging::cout() << " Writer at head of queue and got the cown " | ||
<< *curr_slot << Logging::endl; | ||
<< *chain_first_slot << Logging::endl; | ||
ex_count++; | ||
yield(); | ||
} |
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.
Can ex_count
be anything other than 0 in this branch?
{ | |
Logging::cout() << " Writer at head of queue and got the cown " | |
<< *curr_slot << Logging::endl; | |
<< *chain_first_slot << Logging::endl; | |
ex_count++; | |
yield(); | |
} | |
{ | |
Logging::cout() << " Writer at head of queue and got the cown " | |
<< *chain_first_slot << Logging::endl; | |
ec[first_body_index] += 1; | |
yield(); | |
continue; | |
} |
|
||
// Process execution count | ||
ec[first_body_index] += ex_count; | ||
|
||
for (int i = 1; i < first_consecutive_readers_count; i++) | ||
ec[first_body_index + i] += 1; | ||
} | ||
|
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.
If we can treat ex_count
as a read chain that observed the read was available. Could we do this? Perhaps with a rename of ex_count
?
// Process execution count | |
ec[first_body_index] += ex_count; | |
for (int i = 1; i < first_consecutive_readers_count; i++) | |
ec[first_body_index + i] += 1; | |
} | |
// Process execution count | |
if (ex_count != 0) | |
{ | |
for (int i = 0; i < first_consecutive_readers_count; i++) | |
ec[first_body_index + i] += 1; | |
} | |
} | |
No description provided.