Create LICENSE file#4
Merged
Merged
Conversation
Collaborator
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
peder1981
added a commit
to peder1981/BitNet
that referenced
this pull request
Jun 6, 2026
…nel unit test
Suite mínima de validação para hrr_cleanup_iter + kernels básicos.
Cada teste printa seu delta numérico e marca PASS/FAIL; total runtime
~1ms com -O3.
Testes:
[1] FFT roundtrip identity (d=128)
max|RFFT(IRFFT(x)) - x| = 2.24e-07 (PASS, limite FP)
[2] hrr_bind vs circular_conv (d=64)
max|bind(a,b) - circular_conv(a,b)| = 2.09e-07 (PASS)
[3] hrr_pseudoinverse: phasor exact inverse (d=128)
max|p⊛p_inv - δ| = 2.26e-06 (PASS; só funciona com phasor de
magnitude unitária em todo o espectro)
[4] hrr_cleanup_iter RESIDUAL (d=1024, N=32)
raw cos_sim 0.166 → chosen=idx 0, NAIVE projection cos_sim 1.00
(PASS; algoritmo identifica V_0 como sinal dominante)
[5] hrr_cleanup_iter NAIVE (d=256, N=16)
cos_sim(cleaned, V_0) = 1.00 (PASS, idx=0)
Bug fixes capturados pelos testes:
- random_phasor_vector original forçava |DC|=cos, |Nyq|=sin,
quebrando magnitude unitária. Corrigido para ±1.
- hrr_cleanup_step com memcpy(out, codebook[idx], ...) substituía
acumulado a cada iter do RESIDUAL. Corrigido para acumular.
- hrr_pseudoinverse + hrr_bind no mesmo scratch de tamanho
2*(d+2) crashava com heap corruption (hrr_bind precisa 3*(d+2)).
Alocação consertada nos testes.
Build:
clang++ -O0 -g -mavx2 -mfma -std=c++17 \
-I/usr/include/c++/13 -I/usr/include/x86_64-linux-gnu/c++/13 \
-Iinclude -L/usr/lib/gcc/x86_64-linux-gnu/13 \
src/ggml-bitnet-hrr.cpp test_hrr_cleanup.cpp -o build/test_hrr_cleanup
Gap fechado: 'Testes mínimos — suíte fraca' (scout microsoft#4).
Refs: .reversa/scout/inventory.md microsoft#4, principle-code-map.json
P2_L5_hrr_refinement.test_results.
peder1981
added a commit
to peder1981/BitNet
that referenced
this pull request
Jun 6, 2026
…into cmake Fechando gap microsoft#1 do scout ('CI/CD mínimo') e microsoft#4 ('Testes mínimos'). Mudanças: - tests/CMakeLists.txt: novo target test_hrr_cleanup que compila src/ggml-bitnet-hrr.cpp + test_hrr_cleanup.cpp (L5 only, sem bitnet_math inteiro para evitar deps de ggml fora do llama.cpp). Replica flags SIMD por arquitetura e linka libm em UNIX/!APPLE. Output em build/tests/, registrado em ctest via add_test(). - CMakeLists.txt (root): nova option BITNET_BUILD_TESTS=ON; quando ativa, enable_testing() + add_subdirectory(tests). - .github/workflows/ci.yml: pipeline mínimo em ubuntu-24.04 + clang-18 + libstdc++-14-dev + ninja. Steps: 1. checkout com submodules: recursive 2. apt-get clang-18, cmake, ninja, libstdc++-14-dev 3. cmake -B build com L2-L5 + tests=ON 4. cmake --build (compila ggml/llama + L1 + L2-L5 + dispatch) 5. cmake --build --target test_hrr_cleanup 6. ./build/tests/test_hrr_cleanup (5/5 expected) 7. ctest --output-on-failure Trigger: push em main, PR, manual dispatch. Validação local (build limpo, 2.1s config, 0.03s test): ctest --output-on-failure Start 1: test_hrr_cleanup 1/1 Test microsoft#1: test_hrr_cleanup ......... Passed 0.03 sec 100% tests passed, 0 tests failed Não inclui llama-cli no artifact upload (LLAMA_BUILD_EXAMPLES=OFF por default; o build compila libggml que é o que importa para validar kernels L1-L5). Refs: .reversa/scout/gap-analysis.md gaps microsoft#1 e microsoft#4, scout principle-code-map.json P2_L5_hrr_refinement.test_results.
peder1981
added a commit
to peder1981/BitNet
that referenced
this pull request
Jun 6, 2026
tests/CMakeLists.txt now registers 4 ctest targets, one per math kernel level (L2-L5). Each compiles ONLY the kernel source it needs (plus the test file) to keep tests self-contained and avoid pulling in ggml-bitnet-dispatch.cpp which references ggml symbols not available outside the llama.cpp build. The bitnet_test_set_simd_flags() helper centralizes the per-arch SIMD flag logic (-mavx2 -mfma on x86_64, -march=armv8-a+simd on aarch64) and the libm link on UNIX/!APPLE. .github/workflows/ci.yml updated to build and run all 4 tests in a single cmake --build + ctest step (was only test_hrr_cleanup). .gitignore: add build_tests/ to skip the local quick-iteration build directory (the actual build/ remains for the full cmake build). ctest output locally: 1/4 Test microsoft#1: test_wht ........... Passed 0.00 sec 2/4 Test microsoft#2: test_acdc .......... Passed 0.00 sec 3/4 Test microsoft#3: test_tropical ...... Passed 0.00 sec 4/4 Test microsoft#4: test_hrr_cleanup ... Passed 0.03 sec 100% tests passed, 0 tests failed out of 4
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.
No description provided.