-
Notifications
You must be signed in to change notification settings - Fork 165
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
Improve performance of the Julia GC integration #3516
Improve performance of the Julia GC integration #3516
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3516 +/- ##
=========================================
Coverage ? 84.48%
=========================================
Files ? 698
Lines ? 345258
Branches ? 0
=========================================
Hits ? 291695
Misses ? 53563
Partials ? 0
|
src/julia_gc.cc
Outdated
if (!FullGC) { | ||
// This is a temp hack to work around a problem with the | ||
// generational GC. Basically, task stacks are being scanned | ||
// regardless of whether they are old or new. In order to avoid |
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.
Is this a bug in Julia, resp. something there we don't understand? If so, can you please provide a link to the relevant Julia issue report, resp. the relevant discussion on the Julia discourse?
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'm not sure if its a bug or an inefficiency. Basically, as I understand it, the task stacks can be roots themselves without being referenced from elsewhere. So, in parts, this is most likely intentional and simply hasn't created any performance issues, as task stacks tend to be short.
47324a9
to
3688ac0
Compare
@rbehrends this version doesn't compile cleanly, at least on Travis. |
@fingolfin Yeah, I saw it, for some reason clang incorrectly accepted a |
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.
In principle I am fine with this now.
#define FN(sym) JOIN(Array, sym) | ||
|
||
#define JOIN(s1, s2) JOIN2(s1, s2) | ||
#define JOIN2(s1, s2) s1##s2 |
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.
These two macros also appear in sortbase.h
. And in debug.h
, we have them under a different name:
#define _intern_CONCAT_(X, Y) X ## Y
#define _intern_CONCAT(X, Y) _intern_CONCAT_(X,Y)
Perhaps we should just give in and move this to, say, src/gaputils.h
and document it properly (this is not a change request for this PR, just a general thought. @ChrisJefferson ?)
I've factored out the tests and made |
4cc0bac
to
a31119c
Compare
This introduces a new make target, testkernel.
a31119c
to
7431c7c
Compare
This is both a performance fix and an attempt to refactor part of the Julia GC integration.
On the performance side, this avoids rescanning unused task stacks unnecessarily. See this related GAP.jl issue.
I've also attempted a migration of the GC integration to C++. The motivation for that was the need to have clean data types, which were messy to handle in C (especially the generics). This probably requires some testing.
Also, while GAP currently already uses some C++ code, it is not linked against the C++ stdlib, which means that things such as
new
anddelete
won't properly work. Therefore, the C++ is written to work without any such features and is primarily used for abstraction. Care was also taken to only require C++98 features (build withCXXFLAGS="-g -O2 -std=c++98"
to verify).There's currently a short test, build with
CXXFLAGS=-DTEST_JULIA_GC_INTERNALS
to run it instead of GAP. This is only temporary and meant to be removed before this PR is being merged.Note that the C++ stdlib issues could be resolved by using
CXX
instead ofCC
for theLINK
command inMakefile.rules
, but I am not sure if that is desirable.