Spaces:
Running
Running
Upload qvac-gpu.js with huggingface_hub
Browse files- qvac-gpu.js +5 -13
qvac-gpu.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
| 12 |
// 32-weight block (GGUF-native precision). One workgroup per output row, 64
|
| 13 |
// threads reduce over K. `add` fuses a residual: o = x·dequant(qw,sc) [+ r].
|
| 14 |
import { requant2bit, signsFor } from "./qvac-2bit.mjs";
|
|
|
|
| 15 |
|
| 16 |
const mmKernel = (bits, add, q3f = false) => `
|
| 17 |
@group(0) @binding(0) var<storage,read> x: array<f32>;
|
|
@@ -938,19 +939,10 @@ export async function createQvacGPU(manifest, fetchTensor, cap = 64, eos = 2, st
|
|
| 938 |
const qlenOf = (t) => bits === 3 ? (t.N * (t.K / 32)) * 12 : bits === 4 ? (t.N * t.K) / 2 : t.N * t.K; // Q3 = 3 u32 (12 bytes) per 32-block
|
| 939 |
const slenOf = (t) => t.N * (t.K / 32) * 4;
|
| 940 |
|
| 941 |
-
|
| 942 |
-
//
|
| 943 |
-
//
|
| 944 |
-
const
|
| 945 |
-
const canTs = adapter.features.has("timestamp-query"); // per-pass GPU profiling (dev: window.__profile)
|
| 946 |
-
const dev = await adapter.requestDevice({
|
| 947 |
-
requiredFeatures: canTs ? ["timestamp-query"] : [],
|
| 948 |
-
requiredLimits: {
|
| 949 |
-
maxStorageBufferBindingSize: L.maxStorageBufferBindingSize,
|
| 950 |
-
maxBufferSize: L.maxBufferSize,
|
| 951 |
-
maxComputeWorkgroupsPerDimension: L.maxComputeWorkgroupsPerDimension,
|
| 952 |
-
},
|
| 953 |
-
});
|
| 954 |
// track total GPU memory allocated (weights + KV cache + scratch) so the system
|
| 955 |
// monitor can show — and free — exactly what this model holds on the GPU.
|
| 956 |
let gpuBytes = 0;
|
|
|
|
| 12 |
// 32-weight block (GGUF-native precision). One workgroup per output row, 64
|
| 13 |
// threads reduce over K. `add` fuses a residual: o = x·dequant(qw,sc) [+ r].
|
| 14 |
import { requant2bit, signsFor } from "./qvac-2bit.mjs";
|
| 15 |
+
import { getDevice } from "./holo-gpu-device.mjs"; // ONE shared WebGPU device (engine + BLAKE3 verify + Bao)
|
| 16 |
|
| 17 |
const mmKernel = (bits, add, q3f = false) => `
|
| 18 |
@group(0) @binding(0) var<storage,read> x: array<f32>;
|
|
|
|
| 939 |
const qlenOf = (t) => bits === 3 ? (t.N * (t.K / 32)) * 12 : bits === 4 ? (t.N * t.K) / 2 : t.N * t.K; // Q3 = 3 u32 (12 bytes) per 32-block
|
| 940 |
const slenOf = (t) => t.N * (t.K / 32) * 4;
|
| 941 |
|
| 942 |
+
// ONE shared device (holo-gpu-device) — the engine, BLAKE3 verify, and Bao all use it, with the adapter's
|
| 943 |
+
// MAX limits so a 145 MB block binds, and timestamp-query when available. Sharing one device is what stops the
|
| 944 |
+
// two-device clash that silently corrupted GPU verify (a default-limits second device mis-hashed the embed).
|
| 945 |
+
const { dev, canTs } = await getDevice();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 946 |
// track total GPU memory allocated (weights + KV cache + scratch) so the system
|
| 947 |
// monitor can show — and free — exactly what this model holds on the GPU.
|
| 948 |
let gpuBytes = 0;
|