-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Idea: UDAs to automatically do inlining with LDC #90
Comments
Can |
|
When it was introduced I'd prefer |
I don't get this. |
If the function is not a template and is called from another module, the compiler will not do semantic analysis of the function body and will not see the pragma(inline) inside; so in general I recommend putting it outside the function (very often it is wrongly applied inside and has no effect). The problem with the pragma is that you cannot make it default to nothing. It is either a forced inline, or a forced not-inline. Perhaps all intrinsics should be templates, but due to template culling I'm not sure if codegen will happen. But at least semantic analysis is probably always happening, i.e. the compiler will see the pragma(inline) inside. (I'm not 100% sure) |
In general my feeling about intel-intrinsics (vs vanilla code) currently is, from worst problem to least problem:
If forced inlining makes (2) better it should also not make (1) worse. If you have ideas to make intrinsics code builds faster they are welcome (thought inlining, templating, or else). |
It is cumbersome / problematic to have to pass
--enable-cross-module-inlining
to LDC to get good performance; this may not be an option in a larger project.Perhaps adding a UDA to each function can be used to force inlining of functions that are known to optimize to single (or a few) instructions?
Something like:
In case this does not help with cross module inlining, then perhaps it will if every function is turned into a template (with zero arguments)
The text was updated successfully, but these errors were encountered: