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

preliminary s-quark support #1154

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

Conversation

calad0i
Copy link
Contributor

@calad0i calad0i commented Dec 17, 2024

Description

Preliminary support for the s-quark (HGQ v2) package. Adds corresponding handlers, bit-exact optimizer, and layer implementations.

Includes the following:

  • Keras v3 support ✅
    • Object based parser (and supports reused layers) ✅
    • Layer handlers for incompatible layers ⚠️
    • Make QKeras optional ✅
      • Lazy converter import ✅
  • MultiHeadAttention (✅ parallel, stream ❌)
    • EinsumDense (parallel ✅, stream ❌)
      • General transpose (parallel ✅ stream ⚠️)
    • Einsum ✅
    • Bit-exact softmax ✅
    • Multi-dimentional softmax (parallel ✅ stream ❌)
    • (?) cossim based attn
  • Automatic precision config
    • accum_t precision inference ✅
      • Symbolic precision converter (fixed ✅ minifloat ❌)
        • const_arr/precision_arr +-*@ precision_arr -> precision_arr
      • Support for specific layers (everything in HGQ v1 + alpha) ✅
    • Fuse RND into bias and cast to TRN when possible
  • minifloat support ❌
    • minifloat * minifloat -> fixed_point cpp template
      • Check if the compiler is smart enough
      • Precision conversion rules

Type of change

  • New frontend and features

Tests

N/A at the moment, not possible w/o test env update.
Bit-exact logic supersedes HGQ proxy embedding configs, thus those tests are reused w/o need of modification.

Checklist

  • I have read the guidelines for contributing.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have installed and run pre-commit on the files I edited or added.
  • I have added tests that prove my fix is effective or that my feature works.

@calad0i calad0i changed the title [DRAFT] s-quaark support [DRAFT] s-quark support Dec 17, 2024
@calad0i calad0i changed the title [DRAFT] s-quark support s-quark support Jan 23, 2025
@calad0i calad0i changed the title s-quark support preliminary s-quark support Jan 23, 2025
@calad0i calad0i added please test Trigger testing by creating local PR branch and removed please test Trigger testing by creating local PR branch labels Jan 23, 2025
@calad0i calad0i added the please test Trigger testing by creating local PR branch label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please test Trigger testing by creating local PR branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant