You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Offset Field Size Description
────── ───── ──── ────────────
0 buffer[1024] 48,992 Ring buffer of Command (48B each)
48,992 status 4 Queue status
48,996 head 4 Write index (Rust volatile write)
49,000 tail 4 Read index (GPU volatile write)
49,004 is_running 1 Kernel running flag
49,008 commands_sent 8 Total commands sent (stat)
49,016 commands_processed 8 Total commands processed (stat)
Command (48 bytes, #pragma pack(push, 4))
Offset Field Size
────── ───── ────
0 cmd_type 4 NOOP(0), EDIT_CELL(1), SYNC_CRDT(2), SHUTDOWN(3)
4 id 4 Command/cell identifier
8 timestamp 8 Lamport timestamp
16 data_a 4 Primary data value
20 data_b 4 Secondary data value
24 result 4 Result value
28 batch_data 8 Batch data pointer
36 batch_count 4 Batch count
40 _padding 4 Alignment padding
44 result_code 4 Result code
CRDTCell (32 bytes, __align__(32))
Offset Field Size
────── ───── ────
0 value 8 Primary cell value (double)
8 timestamp 8 Lamport timestamp
16 node_id 4 Origin node
20 state 4 CellState enum (ACTIVE/DELETED/CONFLICT/MERGED/PENDING/LOCKED)
24 padding[3] 12 Alignment to 32 bytes
PendingUpdate (32 bytes, __align__(32))
Offset Field Size
────── ───── ────
0 cell_idx 4 1D flat index into CRDT grid
4 new_value 8 Proposed value (double)
12 timestamp 8 Lamport timestamp
20 node_id 4 Origin node
24 valid 1 1 if lane has pending update
25 _pad[3] 3 Alignment padding
FormulaCell (128 bytes, __align__(32))
Offset Field Size
────── ───── ────
0 cell_idx 4 Flat index in grid
4 op 1 FormulaOp enum
8 num_deps 4 Number of dependencies (0-6)
12 deps[6] 24 Dependency cell indices
36 operands[6] 48 Cached operand values
84 result 8 Computed result
92 timestamp 8 Recalculation timestamp
100 node_id 4 Node performing recalc
104 dirty 1 Needs recalculation
105 computing 1 Currently being computed
108 _pad[2] 2 Padding to 128
ActiveWorkingSet (shared memory, ~37KB)
Offset Field Size
────── ───── ────
0 cells[1024] 32,768 CRDTCell copies (32KB)
32768 cell_indices[1024] 4,096 Local -> global index map
36864 num_cells 4 Current loaded cell count
36868 num_dirty 4 Originally dirty count
36872 dirty_flags[1024] 1,024 Which cells modified
37896 formula_flags[1024] 1,024 Which are formula cells
38920 _pad[2] 2 Alignment padding
Data Flow
Command Submission (Rust -> GPU)
Rust GPU
──── ───
1. Write Command to 4. __threadfence_system()
queue->buffer[head] (PCIe visibility)
2. queue->head = new_head 5. Read queue->head
(volatile write) 6. If head != tail:
3. __threadfence_system() a. Read queue->buffer[tail]
(optional but safe) b. Process command
c. queue->tail = new_tail
d. __threadfence_system()
e. __nanosleep(100) if empty