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

[GSoC] Fix forVersusWhilePerf.chpl #6833

Merged
merged 2 commits into from
Jul 28, 2017
Merged

[GSoC] Fix forVersusWhilePerf.chpl #6833

merged 2 commits into from
Jul 28, 2017

Conversation

coodie
Copy link
Contributor

@coodie coodie commented Jul 26, 2017

Looking at current performance graphs one can notice that in case of LLVM chapel's version of this test there is slight performance degradation, after some investigation I realized that this test is not written well due to few factors:

  • Chapel's default size for integer is 64-bits while in case of C it is usually 32-bits, so the tests had different performance due to usage of different types of integers, in this case there was better performance for C version.
  • Chapel's version cannot perform constant propagation due to marking variables as "config const". C's version uses "static const" what enables to do constant propagation which reduces register pressure, that in this case made some difference.

After changing all "int" to "int64_t" and "static const int64_t" to "int64_t" the Chapel's version performance closely matches the C version performance.

I guess @lydia-duncan is the best person to review this PR since she wrote those tests in first place.

@lydia-duncan
Copy link
Member

Sorry, didn't get a notification from the edit. Looking at this now!

@lydia-duncan lydia-duncan self-assigned this Jul 27, 2017
Copy link
Member

@lydia-duncan lydia-duncan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I'd like to see the whitespace comments I made resolved, but otherwise have no complaints.

I verified that a correctness and performance run for this test worked after the changes.

@@ -29,9 +32,19 @@ proc main() {
else
res2 = res2 / 2;
j += 1;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line adds some trailing whitespace

@@ -43,7 +56,7 @@ proc main() {
writeln("For loop underwent ", numIterations, " iterations ", numTrials,
" times in ", t1.elapsed(TimeUnits.milliseconds)/1000, " seconds");
writeln("While loop underwent ", numIterations, " iterations ", numTrials,
" times in ", t2.elapsed(TimeUnits.milliseconds)/1000, " seconds");
" times in ", t2.elapsed(TimeUnits.milliseconds)/1000, " seconds");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the whitespace for the worse

@lydia-duncan
Copy link
Member

Awesome, thanks!

@lydia-duncan lydia-duncan merged commit a773b14 into chapel-lang:master Jul 28, 2017
ronawho added a commit to ronawho/chapel that referenced this pull request Jul 29, 2017
PR chapel-lang#6833 changed forVersusWhilePerf.c to be more comparable to the Chapel
version. It changed some int's to int64_t's, but used the wrong printf
formatter and didn't include stdint.h.

Here I include stdint.h and cast the results in printf to long ints. I could
have used the PRId64 formatter, but I never remember how portable that is, and
we don't use it in any other tests, so I opted to just cast in order to quiet
the regression for now.
ronawho added a commit that referenced this pull request Jul 29, 2017
Quiet forVersusWhilePerf regressions

PR #6833 changed forVersusWhilePerf.c to be more comparable to the Chapel
version. It changed some int's to int64_t's, but used the wrong printf
formatter and didn't include stdint.h.

This just includes stdint.h and cast the results in printf to long ints. I could
have used the PRId64 formatter, but I never remember how portable that is, and
we don't use it in any other tests, so I opted to just cast in order to quiet
the regression for now.
@coodie coodie changed the title Fix forVersusWhilePerf.chpl [GSoC] Fix forVersusWhilePerf.chpl Aug 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants