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

Finish inline keyword implementation #88

Open
HPCguy opened this issue Dec 15, 2022 · 0 comments
Open

Finish inline keyword implementation #88

HPCguy opened this issue Dec 15, 2022 · 0 comments

Comments

@HPCguy
Copy link
Owner

HPCguy commented 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.

@HPCguy HPCguy changed the title Add inline keyword Finish inline keyword implementation Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant