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

Pragmas in ableC #138

Open
counc009 opened this issue Feb 28, 2019 · 1 comment
Open

Pragmas in ableC #138

counc009 opened this issue Feb 28, 2019 · 1 comment
Labels

Comments

@counc009
Copy link
Contributor

I was looking into whether ableC supports pragma directives, since as it's defined they are designed to be used to communicate with the compiler/pre-processor, and I noticed that they aren't defined in ableC at all. I was wondering whether there was a reason for this, since it seems like we could use pragma directives to allow programmers to communicate with extensions.
For instance, the tensor algebra extension can generate parallel code, and I'd like to have this controlled by the programmer using the extension. My current solution is using define's, with an ifdef in the tensor header file, so if the programmer specified the define to enable parallelism there is a global variable with a fully qualified name that we can lookup. If we supported pragma's (and had a way of accessing them from extensions) we could make this easier. I'm thinking this could also be useful for my current work on a parallel back-end, since it could allow the programmer to define behaviors for the parallel back-end or even the allocator. I'd guess there might be other applications as well.
I don't want to put this on someone else's plate, if this seems like something reasonable to add, I'd be willing to work on it, just wanted to bring it up as a question.

@krame505
Copy link
Member

My answer to this is twofold.

First, the reason that pragmas were originally introduced was as a way of extending the C/C++ language, with the requirement of backwards-compatibility with all existing programs. We have much better ways of introducing language extensions with nicer syntax, so IMO trying to reuse pragmas for our own purposes is not a good idea. Is there any reason why you couldn't introduce some custom declaration that controls this?

On the other hand, we should at least support pragmas that already exist, if only by passing them through unchanged. Currently there is no way of using OpenMP in an ableC program, as the pragmas aren't parsed correctly. Also forwarding to code that uses OpenMP requires some awful hacks involving txtStmt since we don't represent these in abstract syntax at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants