Skip to content
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

Optimize spin loops and fix regression #298

Merged
merged 13 commits into from
Apr 5, 2024
Merged

Optimize spin loops and fix regression #298

merged 13 commits into from
Apr 5, 2024

Conversation

eupp
Copy link
Collaborator

@eupp eupp commented Mar 28, 2024

This PR implements optimizes and simplified spin loops:

  1. make the counter local variable;
  2. count only the number if spin calls.

It also fixes the regression problem on machines with small number of CPUs by changing the nThreads parameter of resultSpinner to also count for the main thread. If the number of scenario threads + main thread is greater than the number of available CPUs, the main thread does not spin and parks immediately.

@eupp eupp requested a review from ndkoval March 28, 2024 22:53
@eupp
Copy link
Collaborator Author

eupp commented Mar 28, 2024

BTW, @ndkoval can we consider running single-CPU CI configuration for each PR automatically, so that in future we can spot the regressions related to #280 earlier?

@ndkoval
Copy link
Collaborator

ndkoval commented Mar 29, 2024

BTW, @ndkoval can we consider running single-CPU CI configuration for each PR automatically, so that in future we can spot the regressions related to #280 earlier?

We already have "Build (Linux) on Java 17 - Model checking tests on a single CPU (Lincheck)"

@eupp
Copy link
Collaborator Author

eupp commented Mar 29, 2024

Is it run on each PR automatically, or do we have to launch it manually?

@ndkoval
Copy link
Collaborator

ndkoval commented Apr 1, 2024

@eupp yes

@ndkoval
Copy link
Collaborator

ndkoval commented Apr 1, 2024

On my laptop, the change slows down the build by x1.5

eupp added 7 commits April 3, 2024 14:08
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
* remove exponential back-off strategy
* make `counter` local variable to avoid shared-memory accesses inside the spin-loop
* do not yield in case of thread parking

Signed-off-by: Evgeniy Moiseenko <[email protected]>
@eupp eupp changed the title Exponential back-off strategy for spin loops Optimize spin loops and fix regression Apr 5, 2024
eupp and others added 5 commits April 5, 2024 15:01
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
Signed-off-by: Evgeniy Moiseenko <[email protected]>
@ndkoval ndkoval merged commit c2617aa into develop Apr 5, 2024
13 checks passed
@ndkoval ndkoval deleted the dynamic-spin-loops branch April 5, 2024 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants