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

Refactor TL2 codegen #84

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

JCGoran
Copy link
Contributor

@JCGoran JCGoran commented Oct 25, 2024

The codegen for TL2 was a bit difficult to reason about since the C++ code was directly embedded as a Python string. With this PR, I've added a simple Jinja2 template which contains the whole file, making it much easier to follow as well as make changes.

Other notable changes:

  • added jinja2 to requirements
  • don't use defines but constexpr auto instead
  • some of the pragma unroll loops have been made portable (notably to GCC) using the UNROLL_LOOP macro (see also Fix building on GCC toolchain #83)

The generated bitnet-lut-kernels.h is more or less identical (with some slight whitespace differences).

Note that I didn't do the same for TL1 codegen since I'd first like to get feedback on whether this is a step in the right direction.

@JCGoran JCGoran mentioned this pull request Nov 21, 2024
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

Successfully merging this pull request may close these issues.

1 participant