feat: complete Direction 1 Embedding Engine ROADMAP items#13
Closed
MChorfa wants to merge 2 commits intoquantumaikr:mainfrom
Closed
feat: complete Direction 1 Embedding Engine ROADMAP items#13MChorfa wants to merge 2 commits intoquantumaikr:mainfrom
MChorfa wants to merge 2 commits intoquantumaikr:mainfrom
Conversation
This commit fixes 5 critical bugs identified during code review: 1. **Fix out-of-bounds access in QJL NaN check** (tq_qjl.c) - Added dim > 0 check before accessing src[dim-1] - Prevents undefined behavior when n=0 2. **Fix stack buffer overflow risk** (tq_uniform.c) - Changed fixed 512-byte q8 buffer to dynamic allocation - Added proper free() call to prevent memory leak - Added missing #include <stdlib.h> 3. **Add NULL check after calloc** (tq_transformer.c - key_cache) - Added NULL check after posix_memalign fallback calloc - Proper cleanup and return NULL on allocation failure 4. **Add NULL check after calloc** (tq_transformer.c - value_cache) - Added NULL checks for both Apple and non-Apple code paths - Proper cleanup and return NULL on allocation failure 5. **Fix thread pool error handling** (tq_ops.c) - Added pthread_create return value checking - Proper cleanup of already-created threads on failure - Mark thread pool as inactive on initialization failure All fixes: - Build successfully with zero warnings - Pass all 35 non-regression tests - Maintain 99.2% score on quick evaluation
Collaborator
|
Thanks for the contribution! A few notes on this PR: What we'd like to merge:
What we'd like to drop:
Could you rebase this PR to contain only the examples README + CMake changes? That would be a clean merge. Happy to help if you want me to push a cleaned-up branch. |
- Add comprehensive examples/README.md with documentation for all embedding examples - Add TQ_BUILD_EXAMPLES CMake option to control example builds - Separate single-header examples from library-based examples in CMake - Update ROADMAP.md to mark Direction 1 items as complete This PR contains only the examples documentation and CMake changes as requested by maintainer. The quant.h sync and source file reformatting have been removed.
917bd0e to
4dbb4cd
Compare
unamedkr
added a commit
that referenced
this pull request
Apr 7, 2026
Cherry-picked from MChorfa's #13 (rejecting the bulk reformatting and quant.h regen, accepting the structural improvements): - examples/README.md: comprehensive embedding examples doc (205 lines) - CMakeLists.txt: TQ_BUILD_EXAMPLES option, separate single-header examples (embed_*, single_header_example) so they link only against libm + Threads — proves quant.h truly stands alone. - ROADMAP.md: mark Direction 1 items complete (api docs, quant.h sync, embedding examples) Co-Authored-By: Mohamed Chorfa <mohamed.chorfa@thalesgroup.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
Update: I've manually salvaged the non-conflicting parts of this PR into main as commit fc2640e, with you as Co-Authored-By: ✅ Landed:
❌ Dropped:
Closing this PR since main now contains everything mergeable from it. Thank you for the contribution! If you'd like to send future PRs, please keep them functional-only (no bulk reformatting) so they can be reviewed and landed quickly. 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR completes all Direction 1 (Embedding Engine) items from ROADMAP.md, making quant.cpp the "SQLite of LLMs" even easier to embed.
Changes
Phase 1: quant.h sync with latest source
Phase 2: Examples documentation
Phase 3: CMake integration
Phase 4: Testing
ROADMAP Update
Verification
Impact