Refine XIC v1 to Symbolic Extension Only (No GPU Code)

Removed GPU-related code per specification:
- Deleted xic_extensions/gpu_runtime.py
- Removed GPU logic from op_RUN_PROMPT and op_STREAM
- Removed demo_gpu.gx.json

Kept pure symbolic extension:
- 5 new instructions: STREAM, CHAIN, CALL_GLYPH, SET_CONTEXT, LOG
- Symbolic execution mode via SET_MODE "symbolic"
- run_symbolic_prompt() integration with LAIN cognition layer
- demo_symbolic.gx.json for testing

Implementation now focuses exclusively on:
- Extending instruction set (9 total ops)
- Adding symbolic routing to cognition layer
- Preserving backward compatibility (zero breaking changes)
- No external GPU dependencies

All validation tests pass:
 OP_TABLE coverage (9 operations)
 XICContext.symbolic_mode field
 run_symbolic_prompt() callable
 Backward compatibility (demo_chat unchanged)
 Symbolic mode execution (LAIN pipeline)
 SET_CONTEXT, CHAIN, RUN_PROMPT routing

Constraints met:
 No breaking changes
 No XIC v2 binary format
 No GPU-related code
 Strict v1 JSON + .gx architecture
This commit is contained in:
GlyphRunner System
2026-05-21 01:23:48 -04:00
parent 69c97e125a
commit b4ba84c1d2
5 changed files with 268 additions and 116 deletions
-57
View File
@@ -1,57 +0,0 @@
"""GPU-accelerated compressed execution path for XIC.
has_gpu() probes for CUDA via torch. If torch is absent or no CUDA
device is detected, returns False and run_on_gpu() falls back to CPU
via execute_gx() with a clear log line.
"""
from typing import Any
def has_gpu() -> bool:
"""Check if CUDA GPU is available via torch.
Returns:
True if torch is installed and CUDA device is detected, False otherwise
"""
try:
import torch
return torch.cuda.is_available()
except ImportError:
return False
def run_on_gpu(model_path: str, params: dict) -> Any:
"""Execute a .gx model with optional GPU acceleration.
If GPU is available (torch + CUDA), logs device info and runs on GPU.
If GPU is not available, logs fallback and runs on CPU via execute_gx().
Args:
model_path: Path to .gx model file
params: Execution parameters dict (trace, profile, etc.)
Returns:
ExecutionContext from execute_gx()
"""
from runtime_executor.runner import execute_gx
if has_gpu():
try:
import torch
device_name = torch.cuda.get_device_name(0)
print(f"[XIC-GPU] Device: {device_name}")
except Exception as e:
print(f"[XIC-GPU] Warning: Could not get device name: {e}")
return execute_gx(
model_path,
trace=params.get("trace", False),
profile=params.get("profile", False),
)
else:
print("[XIC-GPU] No CUDA device — executing on CPU")
return execute_gx(
model_path,
trace=params.get("trace", False),
profile=params.get("profile", False),
)