Spaces:
Sleeping
Sleeping
Warm WebGPU boost clocks before speed gate and raise step threshold to 250ms
Browse files- web/src/bonsai-webgpu.js +5 -3
web/src/bonsai-webgpu.js
CHANGED
|
@@ -152,7 +152,7 @@ function sharedPrefixLength(left, right) {
|
|
| 152 |
}
|
| 153 |
|
| 154 |
const SOFTWARE_ADAPTER_RE = /swiftshader|basic render|llvmpipe|lavapipe|warp|software/i;
|
| 155 |
-
const MAX_STEP_MS =
|
| 156 |
|
| 157 |
function isUsableHardwareAdapter(adapter) {
|
| 158 |
if (!adapter || adapter.info?.isFallbackAdapter) return false;
|
|
@@ -296,10 +296,12 @@ export class BonsaiWebGpuEngine {
|
|
| 296 |
}
|
| 297 |
|
| 298 |
async verifyRealtimeThroughput() {
|
| 299 |
-
this.encodeForwardStep([151644], 0, { computeLogits: true });
|
|
|
|
|
|
|
| 300 |
await this.readNextToken(0.0, 1.0);
|
| 301 |
const t0 = performance.now();
|
| 302 |
-
this.encodeForwardStep([
|
| 303 |
await this.readNextToken(0.0, 1.0);
|
| 304 |
const stepMs = performance.now() - t0;
|
| 305 |
this.cachedTokens = [];
|
|
|
|
| 152 |
}
|
| 153 |
|
| 154 |
const SOFTWARE_ADAPTER_RE = /swiftshader|basic render|llvmpipe|lavapipe|warp|software/i;
|
| 155 |
+
const MAX_STEP_MS = 250;
|
| 156 |
|
| 157 |
function isUsableHardwareAdapter(adapter) {
|
| 158 |
if (!adapter || adapter.info?.isFallbackAdapter) return false;
|
|
|
|
| 296 |
}
|
| 297 |
|
| 298 |
async verifyRealtimeThroughput() {
|
| 299 |
+
this.encodeForwardStep([151644, 8948], 0, { computeLogits: true });
|
| 300 |
+
await this.readNextToken(0.0, 1.0);
|
| 301 |
+
this.encodeForwardStep([198], 2, { computeLogits: true });
|
| 302 |
await this.readNextToken(0.0, 1.0);
|
| 303 |
const t0 = performance.now();
|
| 304 |
+
this.encodeForwardStep([151644], 3, { computeLogits: true });
|
| 305 |
await this.readNextToken(0.0, 1.0);
|
| 306 |
const stepMs = performance.now() - t0;
|
| 307 |
this.cachedTokens = [];
|