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

[ESI][Runtime] Generate C++ header files for constants #7517

Merged
merged 3 commits into from
Aug 20, 2024

Conversation

teqdruid
Copy link
Contributor

Start of static C++ header file generation. Just integer constants for now. Can work off of any manifest and will even connect to a live accelerator and read the manifest from there.

Generates a types.h file and one per module listed in the manifest. Inside the module header file, generates one class per module and adds the constants to that class. Puts everything in a namespace specified by the user as system_name.

Copy link
Contributor

@mortbopet mortbopet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a test/check on the generated .h file. Would also make this PR a bit easier to review if there was something that one could inspect to see the output of the generator.

lib/Dialect/ESI/runtime/python/esiaccel/cppgen.py Outdated Show resolved Hide resolved
lib/Dialect/ESI/runtime/python/esiaccel/cppgen.py Outdated Show resolved Hide resolved
s = f"""
/// Generated header for {system_name} module {module_info.name}.
#pragma once
#include "types.h"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Way too generic, and alias-prone. ESITypes.h at a minimum. Ideally, there'd be some include path here (#include "ESI/types.h").

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is that users could choose the name of the folder in which to output the files. (e.g. ESI/ or <system-specific-name>/) so the output file would be something like ESI/types.h.

Comment on lines 143 to 145
"--platform",
type=str,
help="Name of backend for live accelerator connection.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

platform or backend? Seems like it's referring to backends, but maybe im misunderstanding the scope of backends/(platforms?).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backend ~= platform. Technically, a backend is a particular runtime implementation of an FPGA platform. I do expect a 1:1 mapping in most cases. I tend to refer to platform for anything user facing.

@teqdruid teqdruid merged commit 29b1c1c into main Aug 20, 2024
4 checks passed
@teqdruid teqdruid deleted the teqdruid/esirt/cppgen branch August 20, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants