forked from ysdede/parakeet.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_webgpu_fix.js
More file actions
42 lines (34 loc) · 1.23 KB
/
Copy pathtest_webgpu_fix.js
File metadata and controls
42 lines (34 loc) · 1.23 KB
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
// Test WebGPU initialization fix
import { initOrt } from './src/backend.js';
async function testWebGPU() {
console.log('Testing WebGPU initialization...');
try {
// Test WebGPU backend
const ort = await initOrt({ backend: 'webgpu' });
console.log('✅ WebGPU backend initialized successfully');
console.log('Backend selected:', ort._selectedBackend);
// Test creating a simple session to verify WebGPU works
console.log('Testing WebGPU session creation...');
// Create a minimal test model (identity operation)
const modelBuffer = new Uint8Array([
0x08, 0x01, 0x12, 0x0c, 0x08, 0x01, 0x12, 0x08, 0x08, 0x01, 0x12, 0x04, 0x08, 0x01, 0x10, 0x01
]);
const sessionOptions = {
executionProviders: [
{
name: 'webgpu',
deviceType: 'gpu',
powerPreference: 'high-performance'
},
'wasm'
],
};
console.log('Creating test session...');
// This would normally create a session, but we'll just test the options
console.log('Session options:', sessionOptions);
console.log('✅ WebGPU configuration looks good');
} catch (error) {
console.error('❌ WebGPU test failed:', error);
}
}
testWebGPU();