-
Notifications
You must be signed in to change notification settings - Fork 48
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
Primitive operator functions are not inlined #198
Comments
This means that those functions can always be linked statically, which in turn means that they are inlined regardless of optimisation settings.
Thanks for this: I had noticed some of these problems when working on |
There was an additional problem with those basic functions being retained |
Hi, I have just tried to help testing the fixes. Dale now works beautifully with that example. Thanks! I noticed two minor issues.
The above two files are compiled as:
|
Thanks for the extra comments. 2 is now fixed, but I don't think there's any way to fix 1, since the slowness appears to be due to compilation of the macro. |
I thought the slowness of 1 was mainly caused by that, JIT compilation is another code path, and inline is not properly handled in that code path. But I am not sure. I am closing this issue for now, since it is not important anyway. |
I forgot to say.. Thank you! |
Compile the following program with
dalec a.dt -s ir -O4 --no-dale-stdlib
(Dale is compiled with LLVM 6.0.1),I get:
Note those
_Z1$2bii
calls, the primitive operator functions are not inlined, despite being marked asalwaysinline
. This leads to very bad performance, and on my machine it's 10x slower than an equivalent C program compiled with gcc.After some investigation, I think this is caused by inefficient use of LLVM. As indicated by LLVM command line tools, LLVM can easily optimize the whole thing into printing a constant. With the following commands,
A file
O1.ll
is produced:I also think
--no-dale-stdlib
should always be enabled. Those Dale run-time functions are very small, and without them being properly inlined, performance of both compiled programs and compilation time (to run the macros) is largely degraded.The text was updated successfully, but these errors were encountered: