Skip to content

Latest commit

 

History

History
96 lines (77 loc) · 2.96 KB

File metadata and controls

96 lines (77 loc) · 2.96 KB

Contributing to Apeinx

Philosophy

Apeinx follows the Linux kernel philosophy:

  1. Define core abstractions first, then implement
  2. Small, reviewable patches — one logical change per commit
  3. Pure C (C11) — no C++ in the kernel
  4. No external dependencies — kernel links only against libc and pthread

Getting Started

# Clone and build
git clone https://github.com/your/apeinx
cd apeinx
make

# Run daemon
./build/apeinxd --demo

# In another terminal
./build/apeinxctl status
./build/apeinxctl submit my-task 1000 5

Project Structure

apeinx/
├── include/apeinx/     # Headers (one per subsystem)
├── kernel/             # Kernel source
│   ├── init/           # Boot + daemon entry
│   ├── core/           # Kernel state, config, panic
│   ├── syscall/        # AI syscall stubs
│   ├── process/        # AI Task lifecycle
│   ├── sched/          # Token Fair Scheduler
│   ├── mm/             # KV Memory Manager
│   ├── resource/       # GPU, budget, quota, pressure, lease
│   ├── fs/             # VFS, TraceFS, ReplayFS stubs
│   ├── drivers/        # Runtime drivers (mock, vllm, llama, trtllm)
│   ├── net/            # RPC, cluster, heartbeat, state sync
│   ├── security/       # Tenant, policy, capability, namespace
│   └── trace/          # Trace, replay, audit
├── user/               # User-space tools
│   ├── apeinxctl/      # CLI (status, submit, kill, top, replay, billing)
│   └── libapeinx/      # Client library stubs
├── tests/              # Unit tests
├── examples/           # Config and CSV task files
├── docs/               # Architecture and design docs
└── scripts/            # Python venv setup

Code Style

  • C11 standard (-std=c11)
  • 4-space indentation, no tabs
  • typedef for all structs and enums
  • Prefix: ax_ for functions, AX_ for constants
  • Error handling: return int, negative = error code from errno.h
  • Global state: single g_kernel struct, no other globals

Adding a New Subsystem

  1. Create include/apeinx/your_subsystem.h — data structures + API
  2. Create kernel/your_subsystem/file.c — implementation
  3. Add #include "your_subsystem.h" to kernel.h if needed
  4. Add ax_your_subsystem_init() to kernel.c ax_kernel_init()
  5. Add .c files to Makefile
  6. If it has user-facing commands, add to apeinxctl/main.c

Testing

# Run daemon with 100-task stress test
./build/apeinxd --csv examples/tasks.csv --limit 100

# Check status
./build/apeinxctl top

# Verify trace
./build/apeinxctl replay

Phase Map

Phase Content Loc
0 Spec + Architecture docs ~2k
1 v0.01 alpha kernel ~10k
2 Local multi-GPU AIOS ~30k
3 Real Runtime drivers ~10k
4 Distributed cluster ~15k
5 Enterprise control plane ~12k
6 v1.0 stable docs + polish