RFC-0001: PWE Architecture
Status: Draft | Version: 0.1.0
1. Scope
定义 Physical World Engine (PWE) 与 Physical World Runtime (PWR) 的总体架构、层次、依赖关系和不可违反的不变量。
2. Architecture
Application
-> World Model
-> World IR (WIR)
-> Domain IR
-> Execution IR (EIR)
-> AOT/JIT
-> Physical World Runtime
-> CPU/GPU/NPU/Edge/Cloud
World 是唯一逻辑真相源;Physics、Render、AI、Sensor 都通过 View 访问 World State。
3. Core layers
- Kernel: memory, scheduler, time, capability, task, synchronization.
- World: entity/component/state/spatial/resource.
- IR: WIR, Physics IR, Render IR, EIR.
- Compiler: validation, lowering, optimization, partitioning, code generation.
- Runtime: execution, memory, devices, distribution.
- Domains: physics, rendering, sensors, AI.
4. Invariants
- World is the single logical source of truth.
- World Model and World State are distinct.
- Entity contains identity, not business behavior.
- Component is data; System is behavior.
- WIR is runtime-independent.
- EIR is hardware-independent.
- Domain subsystems do not own independent worlds.
- AOT and JIT share EIR semantics.
- Cross-module access uses ABI/View/Capability.
- Production execution must be represented by validated IR.
5. Non-goals
PWE is not initially required to implement every physics model, every GPU API, neural rendering, VR, or city-scale simulation.
6. Dependency rule
Dependencies point downward only, except explicit interfaces:
Application -> World -> IR -> Compiler -> Runtime -> Platform.
7. Acceptance
A conforming implementation must be able to compile one WIR world into executable CPU code while rendering the same World State without duplicating authoritative state.