Download kernels/noesa24_avx2.cpp from deeprcurs/IKNN-Rl1-A1: direct link, hf CLI and curl.
- Browser
- Download file 2.44 kB
-
https://huggingface.co/deeprcurs/IKNN-Rl1-A1/resolve/main/kernels/noesa24_avx2.cpp
- Command line
-
hf download hf://deeprcurs/IKNN-Rl1-A1/kernels/noesa24_avx2.cpp
-
curl -L -o noesa24_avx2.cpp https://huggingface.co/deeprcurs/IKNN-Rl1-A1/resolve/main/kernels/noesa24_avx2.cpp
2.44 kB
| // noesa24_avx2.cpp β IKNN-Rl1-A1 β NoeSA-24 AVX2 Kernel (Ryzen5 5650U) | |
| // Version: v1.0 | |
| // Created: 2026-09-03T17:10:00+07:00 | |
| // Last Updated: 2026-09-03T17:10:00+07:00 | |
| // Status: PUBLISHABLE β EN ONLY β M1 Kernel Validation | |
| // Repo: IKNN-Rl1-A1 β Integrated Knowledge-phase Neural Network β Recursive Language Iteration 1 β Architecture 1 | |
| // Hardware: Ryzen5 5650U β 6C/12T Zen3, AVX2 (NO AVX-512), DDR4 35-45GB/s | |
| // Description: Same as AVX-512 but AVX2 version β LUT576 decode 12 cycles per 13 units | |
| namespace iknn { | |
| namespace noesa24 { | |
| namespace avx2 { | |
| // AVX2 version β processes 8 activations at once (256-bit / 32-bit = 8) | |
| inline __m256i compute_noesa24_block_avx2( | |
| __m256i activations, // 8x INT32 | |
| const uint8_t states[8], | |
| int32_t bias_0b = 1) | |
| { | |
| alignas(32) int32_t act_array[8]; | |
| _mm256_store_si256(reinterpret_cast<__m256i*>(act_array), activations); | |
| alignas(32) int32_t result[8]; | |
| for (int i = 0; i < 8; ++i) { | |
| result[i] = compute_noesa24_single(static_cast<int8_t>(act_array[i]), states[i], bias_0b); | |
| } | |
| return _mm256_load_si256(reinterpret_cast<const __m256i*>(result)); | |
| } | |
| inline void decode_60bit_avx2(uint64_t packed60, uint8_t out_digits[13]) { | |
| static LUT576 lut[576]; | |
| static bool lut_built = false; | |
| if (!lut_built) { | |
| build_lut576(lut); | |
| lut_built = true; | |
| } | |
| unpack_13x24_lut(packed60, out_digits, lut); | |
| } | |
| } // namespace avx2 | |
| } // namespace noesa24 | |
| } // namespace iknn | |
| int main() { | |
| using namespace iknn::noesa24; | |
| using namespace iknn::noesa24::avx2; | |
| std::cout << "[NoeSA-24 AVX2 Test] Ryzen5 5650U" << std::endl; | |
| std::mt19937 rng(42); | |
| uint8_t digits[13]; | |
| for (int i = 0; i < 13; ++i) digits[i] = rng() % 24; | |
| uint64_t packed = pack_13x24(digits); | |
| uint8_t unpacked[13]; | |
| unpack_13x24(packed, unpacked); | |
| bool ok = true; | |
| for (int i = 0; i < 13; ++i) if (digits[i] != unpacked[i]) ok = false; | |
| std::cout << "Pack/unpack: " << (ok ? "[PASS]" : "[FAIL]") << std::endl; | |
| int8_t act = 10; | |
| uint8_t state = encode_state(Operator::POS_A, Scale::S2); | |
| int32_t res = compute_noesa24_single(act, state); | |
| std::cout << "Compute +1a S2: " << res << " expected 40 " << (res==40 ? "[PASS]" : "[FAIL]") << std::endl; | |
| return 0; | |
| } | |