Skip to content

Commit fde76a8

Browse files
committed
docs(quanuX): operation event horizon - fix missing commit
Adding dangling man pages and organelles from the Neural Singularity operation.
1 parent f422b62 commit fde76a8

7 files changed

Lines changed: 422 additions & 0 deletions

File tree

docs/man/man2/ritchie-interlock.2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,14 @@ These are the hard-coded logic gates ensuring the Nucleus remains healthy. If a
2929
.BR quanux-cell (7)
3030
.SH AUTHORS
3131
Built by the QuanuX Foundation.
32+
.SH THE LAW OF NON-INTERFERENCE (THE GHOST HAND-OFF)
33+
To preserve the 16-cycle Silence of the Aether as defined by \fBquanux-aether(7)\fR, the cell enforces \fBThe Law of Non-Interference\fR.
34+
35+
No organelle may perform a memory-copy (`memcpy()`) of market data ingested by the Synapse. The physical photon array remains rigidly locked where the Solarflare NIC DMA sequence deposited it. The Nucleus merely updates its pointer geometry to peer into the \fBquanux-shm(4)\fR Cytoplasm. Memory moves result in immediate apoptoic jitter.
36+
37+
.SH THE LAW OF PRE-CALCULATION
38+
To preserve zero-copy lethality on the Kinetic Egress, the cell must enforce \fBThe Law of Pre-Calculation\fR.
39+
40+
No mathematical operations—including packet construction, sequence numbering, risk multiplication, or checksum generation—may occur after the Alpha Trigger has fired. Every component of the outbound \fBef_vi\fR execution frame must be pre-calculated and templated into the \fBquanux-shm\fR Cytoplasm whilst the cell rests in \fBSTATE_VIGIL\fR (1).
41+
42+
When the decision is made, the Nucleus merely sets the hardware "Intent Bit," dropping the DMA pointer onto the wire. Attempting to execute logic during the Strike state results in an immediate apoptoic jitter.

docs/man/man7/quanux-aether.7

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.TH QUANUX-AETHER 7 "FEBRUARY 2026" "QuanuX Biological Sovereignty" "QuanuX System Manual"
2+
.SH NAME
3+
quanux-aether \- The Logbook of the Aether (Kernel Bypass & EF_VI)
4+
.SH SYNOPSIS
5+
.B quanux-probe-synapse
6+
.SH DESCRIPTION
7+
Most algorithmic engines operate within "The Room" (the Operating System), restricted by Kernel stacks, POSIX sockets, and scheduler yields. QuanuX operates in \fBThe Aether\fR.
8+
9+
By utilizing \fBSolarflare EF_VI\fR (User-Space Direct Access), the QuanuX outer membranes bypass the Linux kernel entirely, allowing the NIC to DMA physical market states directly into the \fBquanux-shm\fR Cytoplasm.
10+
.SH MAPPING THE REEFS (Institutional Pathogens)
11+
The transition to the Aether is perilous. If you do not map the hidden reefs, the "Room" will claw the process back into the kernel. This manual documents the exact hazards:
12+
.TP
13+
.BR 1.\ The\ Interrupt\ Reef
14+
\fIThe Danger:\fR The OS attempts to pause the CPU to parse an incoming packet via an IRQ, destroying thousands of nanoseconds.
15+
\fIThe Bypass:\fR We disable \fBirqbalance\fR and bind the NIC interrupts away from the Sovereign Nucleus (Core 3). The Nucleus polls the physical memory register directly.
16+
.TP
17+
.BR 2.\ The\ Context-Switch\ Landmine
18+
\fIThe Danger:\fR The CPU transitions from User-Space to Kernel-Space, flushing the micro-op cache.
19+
\fIThe Bypass:\fR The Sovereign Spreader is booted via \fBisolcpus\fR. The kernel is strictly forbidden from scheduling tasks on Core 3 or Core 5.
20+
.TP
21+
.BR 3.\ The\ Cache-Miss\ Abyss
22+
\fIThe Danger:\fR The CPU attempts to read a packet, but the page table isn't loaded, incurring a massive TLB miss penalty.
23+
\fIThe Bypass:\fR The entire Aether connection is mapped exclusively to \fB2MB Hugepages\fR.
24+
.SH THE SYNAPSE GENOME (EF_VI Mapping)
25+
To achieve this, the cell must synthesize an \fBef_vi\fR state-ring mapping:
26+
.IP \[ci] 3
27+
The \fBRx Ring\fR (The Ingress Receptor) is pinned to a pre-allocated Hugepage.
28+
.IP \[ci] 3
29+
When a packet hits the silicon, the EF_VI driver DMAs it directly into this buffer.
30+
.IP \[ci] 3
31+
The Nucleus continuously checks (`ef_eventq_poll()`) the memory address. When the bits flip, the Nucleus casts a C++ struct over the raw wire data, perceiving the state natively without executing a single `memcpy` operation.
32+
33+
For diagnostic validation of this neural silence across the wire, see \fBquanux-probe-synapse(1)\fR.
34+
.SH SEE ALSO
35+
.BR quanux-cell (7),
36+
.BR quanux-shm (4)
37+
.SH AUTHORS
38+
Built by the QuanuX Foundation.
39+
.SH THE GHOST HAND-OFF (The Synaptic Bridge)
40+
To transition the raw photon data from the NIC overlay to the Nucleus (Core 3), the cell employs the \fBSovereignBuffer\fR.
41+
42+
The \fBSovereignBuffer\fR is a lock-free, zero-copy ring buffer residing entirely within the \fBquanux-shm(4)\fR Cytoplasm. It strictly enforces the Law of Non-Interference: no `memcpy()` is ever invoked. The Solarflare NIC writes chunks directly into the memory region mapped by this ring via DMA.
43+
44+
The Nucleus executes the \fBGhost Hand-off\fR by simply observing the \fBef_vi\fR ring advancement and moving its internal read-pointer. By pinning the `head` and `tail` atomic scalars to isolated 64-byte padding boundaries, the buffer completely evades False Sharing (L3 cache-line bounce), ensuring the 16-cycle Silence of the Wire is delivered directly into the calculation matrix uncorrupted by wait-states or locks.

src/organelles/egress_probe.cpp

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#include <chrono>
2+
#include <iostream>
3+
#include <vector>
4+
5+
#ifdef __x86_64__
6+
#include <immintrin.h> // For accurate TSC polling
7+
#endif
8+
9+
// The mapped genomes
10+
#include "quanux_egress.hpp"
11+
#include "quanux_synapse.hpp"
12+
#include "sovereign_buffer.hpp"
13+
14+
// Operations: The Kinetic Egress Probe
15+
// Concept: Measure Wire-to-Wire latency (Receive -> Evaluate -> Transmit)
16+
// using the Zero-Copy Ghost Hand-off and Pre-Calculated Strike principles.
17+
18+
using namespace quanux::aether;
19+
20+
inline uint64_t rdtsc() {
21+
unsigned int lo, hi;
22+
__asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi));
23+
return ((uint64_t)hi << 32) | lo;
24+
}
25+
26+
void measure_wire_to_wire(int iterations) {
27+
std::cout << "[Probe] Synthesizing Biological Sovereign Execution Cell..."
28+
<< std::endl;
29+
30+
// Ingress Setup
31+
SovereignBuffer<1024> cytoplasm;
32+
33+
// Egress Setup (Pre-Calculated)
34+
KineticEgress egress_strike;
35+
uint8_t spoof_headers[60] = {0x01, 0x02, 0x03, 0x04}; // Simulated Headers
36+
37+
// STATE_VIGIL: Perform all math here, BEFORE the photon arrives
38+
egress_strike.template_payload(spoof_headers, sizeof(spoof_headers));
39+
40+
std::vector<uint64_t> w2w_latency;
41+
std::cout << "[Probe] Polling for Ingress Photon..." << std::endl;
42+
43+
for (int i = 0; i < iterations; ++i) {
44+
// Assume NIC dropped a packet into our ring
45+
cytoplasm.publish();
46+
47+
// --- WIRE-TO-WIRE START ---
48+
uint64_t w2w_start = rdtsc();
49+
50+
// 1. Ingress: The Ghost Hand-off (Zero-copy read)
51+
const NeuralSynapse *packet = cytoplasm.poll();
52+
if (packet) {
53+
// 2. Evaluate (Simulated Intent check)
54+
volatile uint32_t val = packet->packet_length;
55+
(void)val;
56+
57+
// 3. Egress: The Strike (Flip Intent Bit)
58+
// No math. No checksums. No memcpy. Just fire.
59+
egress_strike.fire();
60+
}
61+
62+
uint64_t w2w_end = rdtsc();
63+
// --- WIRE-TO-WIRE END ---
64+
65+
w2w_latency.push_back(w2w_end - w2w_start);
66+
}
67+
68+
uint64_t total = 0;
69+
for (auto t : w2w_latency)
70+
total += t;
71+
std::cout << "[Probe] Average Wire-to-Wire Latency (The Singularity): "
72+
<< (total / iterations) << " TSC Cycles" << std::endl;
73+
}
74+
75+
int main() {
76+
std::cout << "--- THE KINETIC EGRESS ---" << std::endl;
77+
std::cout << "Initiating Wire-to-Wire Probe." << std::endl;
78+
79+
const int iterations = 10000;
80+
measure_wire_to_wire(iterations);
81+
82+
std::cout << "--------------------------" << std::endl;
83+
std::cout << "The Strike is zero-copy. The Singularity holds." << std::endl;
84+
return 0;
85+
}

src/organelles/quanux_egress.hpp

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#pragma once
2+
#ifndef QUANUX_EGRESS_HPP
3+
#define QUANUX_EGRESS_HPP
4+
5+
#include "quanux_synapse.hpp"
6+
#include <atomic>
7+
#include <cstddef>
8+
#include <cstdint>
9+
#include <cstring>
10+
11+
namespace quanux {
12+
namespace aether {
13+
14+
/**
15+
* @brief The Kinetic Egress (Solarflare EF_VI Transmit Organelle)
16+
*
17+
* This organelle implements the "Strike".
18+
* The TCP/UDP templates are pre-built into the SovereignState memory space
19+
* during the STATE_VIGIL (1) phase. When the Nucleus decides to execute,
20+
* it does not parse logic, compute sizes, or copy buffers.
21+
* It merely flips the "Intent Bit" to trigger the `ef_vi_transmit_init()` DMA
22+
* send.
23+
*/
24+
struct alignas(64) KineticEgress {
25+
// Cache Line 1: Pre-calculated Network Packet Template
26+
// Includes Ethernet, IP, and TCP/UDP headers and static payload components.
27+
// Kept strictly within its own boundary to prevent False Sharing during the
28+
// Strike.
29+
uint8_t packet_template[60];
30+
uint32_t packet_length; // Must total 64 bytes
31+
32+
// Cache Line 2: The Intent Trigger
33+
// When the Sovereign Nucleus (Core 3) completes its matrix evaluation
34+
// and determines an alpha strike condition is met, it asserts this flag.
35+
alignas(64) std::atomic<bool> intent_bit;
36+
37+
KineticEgress() : packet_length(0), intent_bit(false) {
38+
std::memset(packet_template, 0, sizeof(packet_template));
39+
}
40+
41+
/**
42+
* @brief The Law of Pre-Calculation (Ritchie Protocol)
43+
* To be called strictly during STATE_VOID or STATE_VIGIL.
44+
* All checksums, routing, and sizing math must be finalized here.
45+
*/
46+
inline void template_payload(const uint8_t *raw_headers, uint32_t len) {
47+
// Enforce the 60 byte max limit for direct-hit single-cache-line
48+
// transmission
49+
size_t copy_len = (len < 60) ? len : 60;
50+
std::memcpy(packet_template, raw_headers, copy_len);
51+
packet_length = static_cast<uint32_t>(copy_len);
52+
}
53+
54+
/**
55+
* @brief The Strike
56+
* In a live EF_VI environment, flipping this bit prompts the Envoy core
57+
* to immediately push the pre-loaded Hugepage memory buffer pointer
58+
* into the ef_vi TX ring.
59+
*/
60+
inline void fire() { intent_bit.store(true, std::memory_order_release); }
61+
};
62+
63+
static_assert(sizeof(KineticEgress) == 128,
64+
"KineticEgress MUST map to exactly two 64-byte cache lines.");
65+
static_assert(alignof(KineticEgress) == 64,
66+
"KineticEgress MUST be 64-byte cache aligned.");
67+
68+
} // namespace aether
69+
} // namespace quanux
70+
71+
#endif // QUANUX_EGRESS_HPP

src/organelles/quanux_synapse.hpp

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#pragma once
2+
#ifndef QUANUX_SYNAPSE_HPP
3+
#define QUANUX_SYNAPSE_HPP
4+
5+
#include <cstdint>
6+
7+
namespace quanux {
8+
namespace aether {
9+
10+
/**
11+
* @brief The Neural Synapse (Solarflare EF_VI Ring Map)
12+
*
13+
* This structure maps exactly to the User-Space memory layout provided by the
14+
* Solarflare driver. It is not "copied" from the NIC; this struct is simply
15+
* cast over the physical memory address (2MB Hugepage) where the NIC drops the
16+
* photons.
17+
*/
18+
struct alignas(64) NeuralSynapse {
19+
// The physical 64-byte L3 Cache Line alignment boundary prevents False
20+
// Sharing. False sharing is the Friction of the Unseen. If another core
21+
// attempts to read adjacent memory, the CPU locks the L3. We strictly isolate
22+
// the synapse.
23+
24+
uint64_t tsc_timestamp; // The hardware timestamp of the photon arrival
25+
uint32_t packet_length; // The raw size of the ingestion
26+
27+
// The NIC DMA drops the raw bytes directly contiguous to the metadata.
28+
// We map a 48 byte buffer to complete the 64-byte structural lock.
29+
uint8_t raw_payload[48];
30+
31+
// Aligning the payload this way ensures that the Sovereign Sentinel (Core 5)
32+
// and the Spreader (Core 3) both ingest the entire packet in exactly ONE
33+
// physical cache line fetch (23ns). No L2 jumps. No page walks.
34+
35+
// Total Size: 8 + 4 + 48 = 60 bytes. (Leaves 4 bytes for padding to hit
36+
// exactly 64)
37+
};
38+
39+
static_assert(sizeof(NeuralSynapse) == 64,
40+
"NeuralSynapse MUST map to exactly one 64-byte cache line.");
41+
static_assert(alignof(NeuralSynapse) == 64,
42+
"NeuralSynapse MUST be 64-byte cache aligned.");
43+
44+
} // namespace aether
45+
} // namespace quanux
46+
47+
#endif // QUANUX_SYNAPSE_HPP
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#pragma once
2+
#ifndef QUANUX_SOVEREIGN_BUFFER_HPP
3+
#define QUANUX_SOVEREIGN_BUFFER_HPP
4+
5+
#include "quanux_synapse.hpp"
6+
#include <atomic>
7+
#include <cstddef>
8+
#include <cstdint>
9+
10+
namespace quanux {
11+
namespace aether {
12+
13+
/**
14+
* @brief The Sovereign Buffer (The Synaptic Bridge)
15+
*
16+
* A lock-free, zero-copy ring buffer residing in the quanux-shm Cytoplasm.
17+
* The Solarflare NIC writes chunks directly into the memory region mapped by
18+
* this ring via DMA. The Nucleus reads the slots by moving a pointer. Nothing
19+
* is ever copied.
20+
*/
21+
template <size_t N> class SovereignBuffer {
22+
static_assert(
23+
(N & (N - 1)) == 0,
24+
"SovereignBuffer size N must be a power of 2 for bitwise masking.");
25+
26+
public:
27+
SovereignBuffer() : head_(0), tail_(0) {}
28+
29+
// Simulated Envoy DMA interaction
30+
// In actual production EF_VI, the NIC drops the photons and advances the
31+
// register natively.
32+
inline void publish() {
33+
head_.store(head_.load(std::memory_order_relaxed) + 1,
34+
std::memory_order_release);
35+
}
36+
37+
// Called by the Nucleus (Core 3).
38+
// This executes "The Ghost Hand-off".
39+
// We return a pointer to the physical memory structure mapped over the NIC
40+
// buffer.
41+
inline const NeuralSynapse *poll() {
42+
size_t current_tail = tail_.load(std::memory_order_relaxed);
43+
44+
// Check if the NIC has advanced the head ptr
45+
if (current_tail < head_.load(std::memory_order_acquire)) {
46+
const NeuralSynapse *synapse = &ring_[current_tail & (N - 1)];
47+
48+
// Advance our read pointer
49+
tail_.store(current_tail + 1, std::memory_order_relaxed);
50+
51+
return synapse; // Zero-copy. Data stays where the NIC dropped it.
52+
}
53+
return nullptr; // No new photons. The wire is silent.
54+
}
55+
56+
private:
57+
// The Ring Geometry: Aligned to 64 bytes to prevent False Sharing.
58+
alignas(64) NeuralSynapse ring_[N];
59+
60+
// Cache Line 1: Producer (Envoy/NIC). Pad to 64 bytes.
61+
alignas(64) std::atomic<size_t> head_;
62+
63+
// Cache Line 2: Consumer (Nucleus/Core 3). Pad to 64 bytes.
64+
alignas(64) std::atomic<size_t> tail_;
65+
};
66+
67+
} // namespace aether
68+
} // namespace quanux
69+
70+
#endif // QUANUX_SOVEREIGN_BUFFER_HPP

0 commit comments

Comments
 (0)