Skip to content

Improvement: Backend-independent code generation #3

@EduardoGRocha

Description

@EduardoGRocha

Hello,

First of all I'd like to share a very positive feedback on the project. Last semester I completed this project where coat was used to compile code for ReGex matching. The results were really impressive as can be seen on the final report.

I'm currently working on a tiny query engine that uses coat for code generation. My impressions are that even though the framework is very easy to use, it has the following weak-spots:

  1. **Too much templated code pollutes the engine source: ** Every part of the engine which uses coat needs to be templated. This template-heavy code ends up propagating to the rest of the engine until eventually a great part of engine code becomes header-only.
  2. **Adaptive execution with coat is a bit cumbersome: ** When doing adaptive execution, one needs two different coat::Function objects, which go through the exact same code generation steps, but emit into different backends. Ideally, the user would want to do something like f1 = fn.finalize(backend_1); f2 = fn.finalize(backend_2); and only inject the back-end at the end.

One solution would be to create an analogous to UMBRA IR (described here) that first generates an intermediate representation, and then based on the back-end emits machine code.

This solves both problems because the code to generate the intermediate representation is template-free and one can inject different runtimes to translate the intermediate representation to machine code.

I want to implement this feature. Would that be integrated into coat? Do you have any thoughts to share about it? Should we discuss more on the exact design?

Looking forward for your feedback

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions