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
+32 -44
View File
@@ -45,7 +45,7 @@ def op_RUN_PROMPT(ctx: XICContext, *args):
"""RUN_PROMPT <prompt>: Execute prompt against loaded model or symbolic cognition.
If ctx.symbolic_mode is True, routes through glyphos/cognitive_kernel.py.
Otherwise, routes to execute_gx() with optional GPU acceleration.
Otherwise, routes to execute_gx() for compressed execution.
"""
if not args:
raise ValueError("RUN_PROMPT requires a prompt argument")
@@ -63,24 +63,11 @@ def op_RUN_PROMPT(ctx: XICContext, *args):
raise ValueError("No model loaded. Use LOAD_MODEL first.")
try:
if ctx.params.get("use_gpu"):
from xic_extensions.gpu_runtime import has_gpu, run_on_gpu
if has_gpu():
print(f"[XIC-GPU] Running on GPU: {ctx.model_path}")
execution_context = run_on_gpu(ctx.model_path, ctx.params)
else:
print(f"[XIC-GPU] No GPU detected, falling back to CPU")
execution_context = execute_gx(
ctx.model_path,
trace=ctx.params.get("trace", False),
profile=ctx.params.get("profile", False)
)
else:
execution_context = execute_gx(
ctx.model_path,
trace=ctx.params.get("trace", False),
profile=ctx.params.get("profile", False)
)
execution_context = execute_gx(
ctx.model_path,
trace=ctx.params.get("trace", False),
profile=ctx.params.get("profile", False)
)
print(f"[XIC] Execution complete")
print(f"[XIC] Result: {getattr(execution_context, 'result', 'OK')}")
@@ -95,7 +82,10 @@ def op_RUN_PROMPT(ctx: XICContext, *args):
def op_STREAM(ctx: XICContext, *args):
"""STREAM <prompt>: Execute and stream output line by line."""
"""STREAM <prompt>: Execute and stream output line by line.
In symbolic mode, stream symbolic result. In compressed mode, stream compressed output.
"""
if not args:
raise ValueError("STREAM requires a prompt argument")
prompt = str(args[0])
@@ -103,7 +93,7 @@ def op_STREAM(ctx: XICContext, *args):
if ctx.symbolic_mode:
from glyphos.cognitive_kernel import run_symbolic_prompt
result = run_symbolic_prompt(prompt, context=ctx.params.get("context"))
for chunk in result.split("\n"):
for chunk in str(result).split("\n"):
if chunk.strip():
print(f"[XIC-STREAM] {chunk}")
ctx._state["last_symbolic_result"] = result
@@ -112,27 +102,23 @@ def op_STREAM(ctx: XICContext, *args):
if not ctx.model_path:
raise ValueError("No model loaded. Use LOAD_MODEL first.")
use_gpu = ctx.params.get("use_gpu")
if use_gpu:
from xic_extensions.gpu_runtime import has_gpu, run_on_gpu
if has_gpu():
print(f"[XIC-GPU] Streaming on GPU: {ctx.model_path}")
exec_ctx = run_on_gpu(ctx.model_path, ctx.params)
else:
print(f"[XIC-GPU] No GPU detected, falling back to CPU")
exec_ctx = execute_gx(ctx.model_path,
trace=ctx.params.get("trace", False),
profile=ctx.params.get("profile", False))
else:
exec_ctx = execute_gx(ctx.model_path,
trace=ctx.params.get("trace", False),
profile=ctx.params.get("profile", False))
result_text = str(getattr(exec_ctx, "result", "OK"))
for chunk in result_text.split("\n"):
if chunk.strip():
print(f"[XIC-STREAM] {chunk}")
ctx._state["last_result"] = exec_ctx
try:
exec_ctx = execute_gx(
ctx.model_path,
trace=ctx.params.get("trace", False),
profile=ctx.params.get("profile", False),
)
result_text = str(getattr(exec_ctx, "result", "OK"))
for chunk in result_text.split("\n"):
if chunk.strip():
print(f"[XIC-STREAM] {chunk}")
ctx._state["last_result"] = exec_ctx
except ExecutionError as e:
print(f"[XIC] Execution error: {e}")
raise
except Exception as e:
print(f"[XIC] Unexpected error: {e}")
raise
def op_CHAIN(ctx: XICContext, *args):
@@ -165,8 +151,10 @@ def op_SET_CONTEXT(ctx: XICContext, *args):
raise ValueError("SET_CONTEXT requires key and value")
if "context" not in ctx.params:
ctx.params["context"] = {}
ctx.params["context"][str(args[0])] = args[1]
print(f"[XIC] Context {args[0]} = {args[1]}")
key = str(args[0])
value = args[1]
ctx.params["context"][key] = value
print(f"[XIC] Context {key} = {value}")
def op_LOG(ctx: XICContext, *args):