You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am forced to add the inline keyword to the public Squint compiler due to a botched 'git stash' and merge on my part.
This was work in progress for the HPC version of MC, and was not supposed to be here.
Now that the cat is out of the bag, I have to let it ride here on the public branch of the compiler.
Note that what I have committed so far only has partial functionality, since it was in mid development.
It only works for a limited subset of void functions at the moment.
Of note: the inline keyword in the MC compiler can be applied in two ways -- either to the function or the call site.
This allows for optimized specializations of functions. For example:
void dot(float *result, float *a, float *b, int len)
{
float sum = 0.0;
for (int i=0; i<len; ++i)
sum += a[i]*b[i];
*result = sum;
}
void ddot(float *out, float *x, int n)
{
inline dot(out, x, x, n); // note speicialization here -- MC optimizer cuts number of mem reads in half
}
Inlining can be nested up to 16 levels. Error messages follow the context through all inline levels.
The text was updated successfully, but these errors were encountered:
HPCguy
changed the title
Add inline keyword
Finish inline keyword implementation
Dec 15, 2022
I am forced to add the inline keyword to the public Squint compiler due to a botched 'git stash' and merge on my part.
This was work in progress for the HPC version of MC, and was not supposed to be here.
Now that the cat is out of the bag, I have to let it ride here on the public branch of the compiler.
Note that what I have committed so far only has partial functionality, since it was in mid development.
It only works for a limited subset of void functions at the moment.
Of note: the inline keyword in the MC compiler can be applied in two ways -- either to the function or the call site.
This allows for optimized specializations of functions. For example:
void dot(float *result, float *a, float *b, int len)
{
float sum = 0.0;
for (int i=0; i<len; ++i)
sum += a[i]*b[i];
*result = sum;
}
void ddot(float *out, float *x, int n)
{
inline dot(out, x, x, n); // note speicialization here -- MC optimizer cuts number of mem reads in half
}
Inlining can be nested up to 16 levels. Error messages follow the context through all inline levels.
The text was updated successfully, but these errors were encountered: