File size: 21,443 Bytes
85ec86a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WASM U-Performance Record Sandbox</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@400;700;900&display=swap" rel="stylesheet">
<style>
:root {
--bg-color: #090D16;
--primary: #63B3ED;
--primary-navy: #0F2D59;
--secondary: #1D4ED8;
--text-main: #E2E8F0;
--text-muted: #A0AEC0;
--accent: #FEB2B2;
--success: #48BB78;
--glass-bg: rgba(15, 23, 42, 0.65);
--glass-border: rgba(99, 179, 237, 0.15);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Inter', sans-serif;
background-color: var(--bg-color);
color: var(--text-main);
min-height: 100vh;
display: flex;
flex-direction: column;
overflow-x: hidden;
}
header {
padding: 2rem 4rem;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--glass-border);
background: rgba(9, 13, 22, 0.8);
backdrop-filter: blur(10px);
z-index: 10;
}
.logo-block {
display: flex;
align-items: center;
gap: 1rem;
}
.logo-title {
font-family: 'Outfit', sans-serif;
font-size: 1.8rem;
font-weight: 900;
letter-spacing: -0.05em;
background: linear-gradient(135deg, #63B3ED 0%, #D6BCFA 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.badge {
font-size: 0.75rem;
font-weight: 800;
padding: 0.25rem 0.75rem;
border-radius: 9999px;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.badge.loading {
background-color: rgba(236, 201, 75, 0.2);
color: #ECC94B;
border: 1px solid rgba(236, 201, 75, 0.3);
}
.badge.ready {
background-color: rgba(72, 187, 120, 0.2);
color: var(--success);
border: 1px solid rgba(72, 187, 120, 0.3);
box-shadow: 0 0 15px rgba(72, 187, 120, 0.3);
}
main {
flex: 1;
padding: 3rem 4rem;
max-width: 1400px;
width: 100%;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 3rem;
}
@media (max-width: 1024px) {
main {
grid-template-columns: 1fr;
}
}
.panel {
background: var(--glass-bg);
border: 1px solid var(--glass-border);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(12px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
display: flex;
flex-direction: column;
gap: 1.5rem;
}
h2 {
font-family: 'Outfit', sans-serif;
font-size: 1.4rem;
font-weight: 700;
color: var(--primary);
border-left: 4px solid var(--primary);
padding-left: 0.75rem;
}
textarea {
width: 100%;
height: 150px;
background: rgba(9, 13, 22, 0.6);
border: 1px solid var(--glass-border);
border-radius: 8px;
color: var(--text-main);
font-family: 'Courier New', Courier, monospace;
font-size: 0.9rem;
padding: 1rem;
resize: none;
outline: none;
}
textarea:focus {
border-color: var(--primary);
box-shadow: 0 0 10px rgba(99, 179, 237, 0.2);
}
.button-group {
display: flex;
gap: 1rem;
}
button {
flex: 1;
background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-navy) 100%);
border: 1px solid rgba(99, 179, 237, 0.3);
border-radius: 8px;
color: white;
font-weight: 600;
padding: 0.75rem 1.5rem;
cursor: pointer;
transition: all 0.2s ease;
outline: none;
}
button:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(99, 179, 237, 0.3);
border-color: var(--primary);
}
button:active {
transform: translateY(0);
}
button.btn-accent {
background: linear-gradient(135deg, var(--success) 0%, #2F855A 100%);
border-color: rgba(72, 187, 120, 0.3);
}
button.btn-accent:hover {
box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
}
.results-block {
background: rgba(9, 13, 22, 0.4);
border: 1px solid rgba(255, 255, 255, 0.05);
border-radius: 8px;
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.result-row {
display: flex;
justify-content: space-between;
font-size: 0.9rem;
}
.result-val {
font-weight: 600;
color: var(--primary);
}
.result-val.highlight {
color: var(--success);
font-weight: 800;
}
.visualizer-container {
position: relative;
width: 100%;
height: 300px;
background: rgba(5, 8, 16, 0.7);
border: 1px solid var(--glass-border);
border-radius: 8px;
overflow: hidden;
}
canvas {
width: 100%;
height: 100%;
display: block;
}
.logs-container {
flex: 1;
background: rgba(5, 8, 16, 0.7);
border: 1px solid var(--glass-border);
border-radius: 8px;
padding: 1rem;
font-family: 'Courier New', Courier, monospace;
font-size: 0.8rem;
overflow-y: auto;
max-height: 250px;
color: #48BB78;
}
footer {
padding: 2rem 4rem;
text-align: center;
font-size: 0.8rem;
color: var(--text-muted);
border-top: 1px solid var(--glass-border);
margin-top: 3rem;
background: rgba(9, 13, 22, 0.8);
}
</style>
</head>
<body>
<header>
<div class="logo-block">
<span class="logo-title">WASM_U Performance Record</span>
<div id="status-badge" class="badge loading">WASM INITIALIZING</div>
</div>
<div>
<span style="font-size: 0.85rem; color: var(--text-muted);">Isomorphic Parity Test Sandbox</span>
</div>
</header>
<main>
<!-- Left Panel: Input & Telemetry -->
<div class="panel">
<h2>1. Mapped Intent Coordinates (Cuneiform-U)</h2>
<p style="font-size: 0.85rem; color: var(--text-muted);">
Paste or modify the 6D concept coordinate mapping array below. Each concept maps to a radical tuple (domain, subdomain, operation, modality, depth, polarity).
</p>
<textarea id="coords-input">[
{"domain": 1, "subdomain": 2, "operation": 3, "modality": 4, "depth": 5, "polarity": 6},
{"domain": 8, "subdomain": 0, "operation": 15, "modality": 1, "depth": 0, "polarity": 15},
{"domain": 0, "subdomain": 0, "operation": 0, "modality": 0, "depth": 0, "polarity": 0},
{"domain": 15, "subdomain": 15, "operation": 15, "modality": 15, "depth": 15, "polarity": 15},
{"domain": 4, "subdomain": 5, "operation": 6, "modality": 7, "depth": 8, "polarity": 9}
]</textarea>
<div class="button-group">
<button id="btn-validate">Run Parity check</button>
<button id="btn-bench" class="btn-accent">Run 10,000x loops benchmark</button>
</div>
<div class="results-block">
<div class="result-row">
<span>Verification Status:</span>
<span id="verif-status" class="result-val">Not Run</span>
</div>
<div class="result-row">
<span>Compressed Payload:</span>
<span id="compressed-size" class="result-val">-</span>
</div>
<div class="result-row">
<span>Warm Execution Latency (1 Iteration):</span>
<span id="single-latency" class="result-val">-</span>
</div>
<div class="result-row">
<span>Average Benchmark Latency:</span>
<span id="avg-latency" class="result-val highlight">-</span>
</div>
</div>
</div>
<!-- Right Panel: Visualizations & Logs -->
<div class="panel">
<h2>2. 6D Semantic Hypercube Coordinate Cloud</h2>
<div class="visualizer-container">
<canvas id="cube-canvas"></canvas>
</div>
<h2>3. Log Console output</h2>
<div id="logs" class="logs-container">
<div>[SYSTEM] Waiting for WASM compile initialization...</div>
</div>
</div>
</main>
<footer>
<p>© 2026 Zymatica.space • astronautshe.com • The AI Collective ART. Freestanding Zig target compiled natively inside VRAM/Cache.</p>
</footer>
<script>
let wasmExports = null;
let memoryBuffer = null;
// Log handler
function logMsg(msg, color = "#48BB78") {
const consoleDiv = document.getElementById('logs');
const newLog = document.createElement('div');
newLog.style.color = color;
newLog.innerText = msg;
consoleDiv.appendChild(newLog);
consoleDiv.scrollTop = consoleDiv.scrollHeight;
}
// WebAssembly instantiation
async function loadWasm() {
try {
const response = await fetch('proof_wasm.wasm');
if (!response.ok) {
throw new Error("Could not fetch proof_wasm.wasm");
}
const buffer = await response.arrayBuffer();
const wasmObj = await WebAssembly.instantiate(buffer);
wasmExports = wasmObj.instance.exports;
memoryBuffer = wasmExports.memory;
logMsg("[+] proof_wasm.wasm loaded and instanced successfully!");
document.getElementById('status-badge').innerText = "WASM READY";
document.getElementById('status-badge').className = "badge ready";
// Trigger verification check
const verifResult = wasmExports.run_verification();
if (verifResult === 1) {
logMsg("[+] Core freestanding verification test returned: 1 (SUCCESS)", "#48BB78");
} else {
logMsg("[-] Core freestanding verification test returned: 0 (FAILURE)", "#F56565");
}
} catch (e) {
logMsg("[-] Error compiling WASM: " + e.message, "#F56565");
document.getElementById('status-badge').innerText = "WASM ERROR";
document.getElementById('status-badge').className = "badge loading";
}
}
// Run verification parity loop
document.getElementById('btn-validate').addEventListener('click', () => {
if (!wasmExports) {
logMsg("[-] WebAssembly is not initialized yet.", "#F56565");
return;
}
try {
const inputJson = JSON.parse(document.getElementById('coords-input').value);
const count = inputJson.length;
logMsg(`[+] Triggering coordinate validation check on ${count} elements...`);
const structSize = 6;
const inputOffset = 102400; // Offset in WASM memory
const memView = new Uint8Array(memoryBuffer.buffer);
// Write coordinates to WASM memory
for (let i = 0; i < count; i++) {
const idx = inputOffset + i * structSize;
const c = inputJson[i];
memView[idx] = c.domain;
memView[idx + 1] = c.subdomain;
memView[idx + 2] = c.operation;
memView[idx + 3] = c.modality;
memView[idx + 4] = c.depth;
memView[idx + 5] = c.polarity;
}
const t0 = performance.now();
const encodedBufferPtr = wasmExports.wasm_encode(inputOffset, count);
const bitsCount = wasmExports.wasm_get_encoded_bits();
const bytesCount = Math.floor((bitsCount + 7) / 8);
const t1 = performance.now();
logMsg(` - Encoded size: ${bitsCount} bits (${bytesCount} bytes)`);
document.getElementById('compressed-size').innerText = `${bytesCount} Bytes (${bitsCount} bits)`;
// Decode
const decodedBufferPtr = wasmExports.wasm_decode(encodedBufferPtr, bytesCount, count);
const decodedView = new Uint8Array(memoryBuffer.buffer, decodedBufferPtr, count * structSize);
let matches = true;
for (let i = 0; i < count; i++) {
const idx = i * structSize;
const orig = inputJson[i];
const dec = {
domain: decodedView[idx],
subdomain: decodedView[idx + 1],
operation: decodedView[idx + 2],
modality: decodedView[idx + 3],
depth: decodedView[idx + 4],
polarity: decodedView[idx + 5]
};
if (orig.domain !== dec.domain || orig.subdomain !== dec.subdomain ||
orig.operation !== dec.operation || orig.modality !== dec.modality ||
orig.depth !== dec.depth || orig.polarity !== dec.polarity) {
matches = false;
logMsg(` [-] Parity mismatch at coordinate index ${i}!`, "#F56565");
break;
}
}
if (matches) {
logMsg(`[+] Lossless Parity Status: 1 (SUCCESS). Decoded elements match input perfectly.`, "#48BB78");
document.getElementById('verif-status').innerText = "PASSED (100% PARITY)";
document.getElementById('verif-status').style.color = "#48BB78";
} else {
document.getElementById('verif-status').innerText = "FAILED";
document.getElementById('verif-status').style.color = "#F56565";
}
const singleLat = t1 - t0;
document.getElementById('single-latency').innerText = `${singleLat.toFixed(5)} ms (${(singleLat * 1000).toFixed(2)} us)`;
} catch (err) {
logMsg("[-] Execution Error: " + err.message, "#F56565");
}
});
// Run warm JIT benchmark loops
document.getElementById('btn-bench').addEventListener('click', () => {
if (!wasmExports) {
logMsg("[-] WebAssembly is not initialized yet.", "#F56565");
return;
}
logMsg("[+] Starting Warm CPU Cache JIT benchmark loop (10,000 runs)...");
const loops = 10000;
const t0 = performance.now();
for (let i = 0; i < loops; i++) {
wasmExports.run_verification();
}
const t1 = performance.now();
const durationMs = t1 - t0;
const avgMs = durationMs / loops;
const avgUs = avgMs * 1000;
logMsg(`[+] Warm benchmark finished: Total = ${durationMs.toFixed(3)} ms, Avg = ${avgUs.toFixed(4)} microseconds per loop.`, "#48BB78");
document.getElementById('avg-latency').innerText = `${avgUs.toFixed(4)} Microseconds`;
document.getElementById('avg-latency').style.color = "#48BB78";
// Adjust visualizer rotation speed based on speed
rotSpeed = 0.05;
});
// --- Canvas Rotating Cloud Visualizer ---
const canvas = document.getElementById('cube-canvas');
const ctx = canvas.getContext('2d');
let rotX = 0;
let rotY = 0;
let rotSpeed = 0.005;
// Resize handler
function resizeCanvas() {
canvas.width = canvas.parentElement.clientWidth;
canvas.height = canvas.parentElement.clientHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
// 3D coordinate projection
function project3D(x, y, z, width, height) {
const fov = 350;
const distance = 400;
const scale = fov / (distance + z);
const x2d = width / 2 + x * scale;
const y2d = height / 2 + y * scale;
return { x: x2d, y: y2d, scale: scale };
}
// Generate points on hypercube coordinates
const points = [];
for (let i = 0; i < 64; i++) {
points.push({
x: ((i & 1) ? 100 : -100) + (Math.random() - 0.5) * 20,
y: ((i & 2) ? 100 : -100) + (Math.random() - 0.5) * 20,
z: ((i & 4) ? 100 : -100) + (Math.random() - 0.5) * 20,
col: (i % 2 === 0) ? '#63B3ED' : '#D6BCFA'
});
}
function drawVisualizer() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
rotX += rotSpeed;
rotY += rotSpeed * 0.7;
const cosX = Math.cos(rotX);
const sinX = Math.sin(rotX);
const cosY = Math.cos(rotY);
const sinY = Math.sin(rotY);
// Draw bounding circular grid
ctx.strokeStyle = 'rgba(99, 179, 237, 0.05)';
ctx.lineWidth = 1;
ctx.beginPath();
ctx.arc(canvas.width / 2, canvas.height / 2, 120, 0, Math.PI * 2);
ctx.stroke();
// Draw coordinate axis lines
ctx.beginPath();
ctx.moveTo(canvas.width / 2 - 140, canvas.height / 2);
ctx.lineTo(canvas.width / 2 + 140, canvas.height / 2);
ctx.moveTo(canvas.width / 2, canvas.height / 2 - 140);
ctx.lineTo(canvas.width / 2, canvas.height / 2 + 140);
ctx.stroke();
// Render projected coordinates points
const projected = points.map(p => {
// Rotation X
let y1 = p.y * cosX - p.z * sinX;
let z1 = p.z * cosX + p.y * sinX;
// Rotation Y
let x2 = p.x * cosY - z1 * sinY;
let z2 = z1 * cosY + p.x * sinY;
const proj = project3D(x2, y1, z2, canvas.width, canvas.height);
return { ...proj, col: p.col };
});
// Draw connecting web lines (simulating neural prior connection matrix)
ctx.lineWidth = 0.5;
for (let i = 0; i < projected.length; i++) {
for (let j = i + 1; j < projected.length; j++) {
const dx = projected[i].x - projected[j].x;
const dy = projected[i].y - projected[j].y;
const dist = Math.sqrt(dx*dx + dy*dy);
if (dist < 45) {
ctx.strokeStyle = `rgba(99, 179, 237, ${0.15 * (1 - dist/45)})`;
ctx.beginPath();
ctx.moveTo(projected[i].x, projected[i].y);
ctx.lineTo(projected[j].x, projected[j].y);
ctx.stroke();
}
}
}
// Draw coordinate node spheres
projected.forEach(p => {
ctx.fillStyle = p.col;
ctx.beginPath();
ctx.arc(p.x, p.y, Math.max(1, p.scale * 2.5), 0, Math.PI * 2);
ctx.fill();
});
if (rotSpeed > 0.005) {
rotSpeed -= 0.001; // Decay speed boost back to base rotation rate
}
requestAnimationFrame(drawVisualizer);
}
// Initialize Page
window.addEventListener('load', () => {
loadWasm();
drawVisualizer();
});
</script>
</body>
</html>
|