@litert-lm/core 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/conversation.d.ts +5 -0
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +19 -0
- package/dist/conversation.js.map +1 -1
- package/dist/litertlm_web.js +1 -1
- package/dist/session.d.ts +5 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +19 -0
- package/dist/session.js.map +1 -1
- package/dist/testing/fakes.d.ts +2 -0
- package/dist/testing/fakes.d.ts.map +1 -1
- package/dist/testing/fakes.js +10 -0
- package/dist/testing/fakes.js.map +1 -1
- package/dist/wasm_binding_types.d.ts +4 -1
- package/dist/wasm_binding_types.d.ts.map +1 -1
- package/dist/wasm_binding_types.js.map +1 -1
- package/package.json +1 -1
- package/wasm/litertlm_wasm_asyncify_internal.js +242 -238
- package/wasm/litertlm_wasm_asyncify_internal.wasm +0 -0
- package/wasm/litertlm_wasm_compat_asyncify_internal.js +242 -238
- package/wasm/litertlm_wasm_compat_asyncify_internal.wasm +0 -0
- package/wasm/litertlm_wasm_compat_internal.js +72 -68
- package/wasm/litertlm_wasm_compat_internal.wasm +0 -0
- package/wasm/litertlm_wasm_internal.js +72 -68
- package/wasm/litertlm_wasm_internal.wasm +0 -0
|
Binary file
|
|
@@ -9,8 +9,7 @@ var ModuleFactory = (() => {
|
|
|
9
9
|
// In EXPORT_ES6 mode we can just use 'import.meta.url'.
|
|
10
10
|
var _scriptName = globalThis.document?.currentScript?.src;
|
|
11
11
|
return async function(moduleArg = {}) {
|
|
12
|
-
var
|
|
13
|
-
|
|
12
|
+
var Module = moduleArg;
|
|
14
13
|
// include: shell.js
|
|
15
14
|
// include: minimum_runtime_check.js
|
|
16
15
|
// end include: minimum_runtime_check.js
|
|
@@ -27,8 +26,6 @@ var ModuleFactory = (() => {
|
|
|
27
26
|
// after the generated code, you will need to define var Module = {};
|
|
28
27
|
// before the code. Then that object will be used in the code, and you
|
|
29
28
|
// can continue to use Module afterwards as well.
|
|
30
|
-
var Module = moduleArg;
|
|
31
|
-
|
|
32
29
|
// Determine the runtime environment we are in. You can customize this by
|
|
33
30
|
// setting the ENVIRONMENT setting at compile time (see settings.js).
|
|
34
31
|
// Attempt to auto-detect the environment
|
|
@@ -207,8 +204,6 @@ class EmscriptenSjLj extends EmscriptenEH {}
|
|
|
207
204
|
// end include: runtime_exceptions.js
|
|
208
205
|
// include: runtime_debug.js
|
|
209
206
|
// end include: runtime_debug.js
|
|
210
|
-
var readyPromiseResolve, readyPromiseReject;
|
|
211
|
-
|
|
212
207
|
// Memory management
|
|
213
208
|
var runtimeInitialized = false;
|
|
214
209
|
|
|
@@ -286,7 +281,6 @@ function postRun() {
|
|
|
286
281
|
// though it can.
|
|
287
282
|
// TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
|
|
288
283
|
/** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
|
|
289
|
-
readyPromiseReject?.(e);
|
|
290
284
|
// Throw the error whether or not MODULARIZE is set because abort is used
|
|
291
285
|
// in code paths apart from instantiation where an exception is expected
|
|
292
286
|
// to be thrown when abort is called.
|
|
@@ -7018,7 +7012,7 @@ var WebGPU = {
|
|
|
7018
7012
|
TextureSampleType: [ , , "float", "unfilterable-float", "depth", "sint", "uint" ],
|
|
7019
7013
|
TextureViewDimension: [ , "1d", "2d", "2d-array", "cube", "cube-array", "3d" ],
|
|
7020
7014
|
ToneMappingMode: [ , "standard", "extended" ],
|
|
7021
|
-
VertexFormat: [ , "uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra" ],
|
|
7015
|
+
VertexFormat: [ , "uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra", "snorm10-10-10-2" ],
|
|
7022
7016
|
VertexStepMode: [ , "vertex", "instance" ],
|
|
7023
7017
|
WGSLLanguageFeatureName: [ , "readonly_and_readwrite_storage_textures", "packed_4x8_integer_dot_product", "unrestricted_pointer_parameters", "pointer_composite_access", "uniform_buffer_standard_layout", "subgroup_id", "texture_and_sampler_let", "subgroup_uniformity", "texture_formats_tier1", "linear_indexing", "immediate_address_space" ]
|
|
7024
7018
|
};
|
|
@@ -7990,11 +7984,11 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
|
|
|
7990
7984
|
// End JS library exports
|
|
7991
7985
|
// end include: postlibrary.js
|
|
7992
7986
|
var ASM_CONSTS = {
|
|
7993
|
-
|
|
7987
|
+
2207593: () => !!Module["preinitializedWebGPUDevice"],
|
|
7988
|
+
2207644: $0 => {
|
|
7994
7989
|
const device = WebGPU.getJsObject($0);
|
|
7995
7990
|
return device.features.has("subgroups");
|
|
7996
|
-
}
|
|
7997
|
-
2163408: () => !!Module["preinitializedWebGPUDevice"]
|
|
7991
|
+
}
|
|
7998
7992
|
};
|
|
7999
7993
|
|
|
8000
7994
|
function custom_emscripten_dbgn(str, len) {
|
|
@@ -8025,33 +8019,6 @@ function ThrowError(val_handle) {
|
|
|
8025
8019
|
|
|
8026
8020
|
ThrowError.sig = "vi";
|
|
8027
8021
|
|
|
8028
|
-
function JsGetDeviceMinSubgroupSize(deviceId) {
|
|
8029
|
-
const device = WebGPU.getJsObject(deviceId);
|
|
8030
|
-
return device.adapterInfo.subgroupMinSize || device.limits.minSubgroupSize;
|
|
8031
|
-
}
|
|
8032
|
-
|
|
8033
|
-
JsGetDeviceMinSubgroupSize.sig = "ii";
|
|
8034
|
-
|
|
8035
|
-
function JsGetDeviceMaxSubgroupSize(deviceId) {
|
|
8036
|
-
const device = WebGPU.getJsObject(deviceId);
|
|
8037
|
-
return device.adapterInfo.subgroupMaxSize || device.limits.maxSubgroupSize;
|
|
8038
|
-
}
|
|
8039
|
-
|
|
8040
|
-
JsGetDeviceMaxSubgroupSize.sig = "ii";
|
|
8041
|
-
|
|
8042
|
-
function __asyncjs__ReadBufferDataJs(buffer_handle, data_ptr) {
|
|
8043
|
-
return Asyncify.handleAsync(async () => {
|
|
8044
|
-
const gpuReadBuffer = WebGPU.getJsObject(buffer_handle);
|
|
8045
|
-
await gpuReadBuffer.mapAsync(GPUMapMode.READ);
|
|
8046
|
-
const arrayBuffer = gpuReadBuffer.getMappedRange();
|
|
8047
|
-
const u8view = new Uint8Array(arrayBuffer);
|
|
8048
|
-
HEAPU8.set(u8view, data_ptr >>> 0 >>> 0);
|
|
8049
|
-
gpuReadBuffer.unmap();
|
|
8050
|
-
});
|
|
8051
|
-
}
|
|
8052
|
-
|
|
8053
|
-
__asyncjs__ReadBufferDataJs.sig = "vii";
|
|
8054
|
-
|
|
8055
8022
|
function GetAdapterArchitecture() {
|
|
8056
8023
|
const device = Module["preinitializedWebGPUDevice"];
|
|
8057
8024
|
const architecture = device.adapterInfo ? device.adapterInfo.architecture : "Unknown";
|
|
@@ -8084,6 +8051,56 @@ function GetAdapterVendor() {
|
|
|
8084
8051
|
|
|
8085
8052
|
GetAdapterVendor.sig = "i";
|
|
8086
8053
|
|
|
8054
|
+
function JsGetDeviceMinSubgroupSize(deviceId) {
|
|
8055
|
+
const device = WebGPU.getJsObject(deviceId);
|
|
8056
|
+
return device.adapterInfo.subgroupMinSize || device.limits.minSubgroupSize;
|
|
8057
|
+
}
|
|
8058
|
+
|
|
8059
|
+
JsGetDeviceMinSubgroupSize.sig = "ii";
|
|
8060
|
+
|
|
8061
|
+
function JsGetDeviceMaxSubgroupSize(deviceId) {
|
|
8062
|
+
const device = WebGPU.getJsObject(deviceId);
|
|
8063
|
+
return device.adapterInfo.subgroupMaxSize || device.limits.maxSubgroupSize;
|
|
8064
|
+
}
|
|
8065
|
+
|
|
8066
|
+
JsGetDeviceMaxSubgroupSize.sig = "ii";
|
|
8067
|
+
|
|
8068
|
+
function __asyncjs__ReadBufferDataJs(buffer_handle, data_ptr) {
|
|
8069
|
+
return Asyncify.handleAsync(async () => {
|
|
8070
|
+
const gpuReadBuffer = WebGPU.getJsObject(buffer_handle);
|
|
8071
|
+
await gpuReadBuffer.mapAsync(GPUMapMode.READ);
|
|
8072
|
+
const arrayBuffer = gpuReadBuffer.getMappedRange();
|
|
8073
|
+
const u8view = new Uint8Array(arrayBuffer);
|
|
8074
|
+
HEAPU8.set(u8view, data_ptr >>> 0 >>> 0);
|
|
8075
|
+
gpuReadBuffer.unmap();
|
|
8076
|
+
});
|
|
8077
|
+
}
|
|
8078
|
+
|
|
8079
|
+
__asyncjs__ReadBufferDataJs.sig = "vii";
|
|
8080
|
+
|
|
8081
|
+
function __asyncjs__CallStreamWeightsOnWeb(tfl_ids, wgpu_buffers, offsets, lengths, count) {
|
|
8082
|
+
return Asyncify.handleAsync(async () => {
|
|
8083
|
+
const callback = Module.getStreamWeightsCallback();
|
|
8084
|
+
if (typeof callback !== "function") {
|
|
8085
|
+
console.error("Stream weights callback is not registered or is not a function");
|
|
8086
|
+
return 1;
|
|
8087
|
+
}
|
|
8088
|
+
const tflIdsArray = new Int32Array(Module.HEAP32.buffer, tfl_ids, count);
|
|
8089
|
+
const wgpuBuffersArray = new Uint32Array(Module.HEAPU32.buffer, wgpu_buffers, count);
|
|
8090
|
+
const offsetsArray = new Float64Array(Module.HEAPF64.buffer, offsets, count);
|
|
8091
|
+
const lengthsArray = new Float64Array(Module.HEAPF64.buffer, lengths, count);
|
|
8092
|
+
try {
|
|
8093
|
+
await callback(new Int32Array(tflIdsArray), new Uint32Array(wgpuBuffersArray), new Float64Array(offsetsArray), new Float64Array(lengthsArray));
|
|
8094
|
+
} catch (e) {
|
|
8095
|
+
console.error("Error in streamWeightsOnWeb:", e);
|
|
8096
|
+
return 1;
|
|
8097
|
+
}
|
|
8098
|
+
return 0;
|
|
8099
|
+
});
|
|
8100
|
+
}
|
|
8101
|
+
|
|
8102
|
+
__asyncjs__CallStreamWeightsOnWeb.sig = "iiiiii";
|
|
8103
|
+
|
|
8087
8104
|
function hardware_concurrency() {
|
|
8088
8105
|
var concurrency = 1;
|
|
8089
8106
|
try {
|
|
@@ -8188,6 +8205,7 @@ var wasmImports = {
|
|
|
8188
8205
|
/** @export */ JsGetDeviceMinSubgroupSize,
|
|
8189
8206
|
/** @export */ ThrowError,
|
|
8190
8207
|
/** @export */ _Unwind_RaiseException: __Unwind_RaiseException,
|
|
8208
|
+
/** @export */ __asyncjs__CallStreamWeightsOnWeb,
|
|
8191
8209
|
/** @export */ __asyncjs__ReadBufferDataJs,
|
|
8192
8210
|
/** @export */ __syscall_dup: ___syscall_dup,
|
|
8193
8211
|
/** @export */ __syscall_faccessat: ___syscall_faccessat,
|
|
@@ -8338,16 +8356,14 @@ function applySignatureConversions(wasmExports) {
|
|
|
8338
8356
|
|
|
8339
8357
|
// include: postamble.js
|
|
8340
8358
|
// === Auto-generated postamble setup entry stuff ===
|
|
8341
|
-
function run() {
|
|
8359
|
+
async function run() {
|
|
8342
8360
|
if (runDependencies > 0) {
|
|
8343
|
-
dependenciesFulfilled =
|
|
8344
|
-
return;
|
|
8361
|
+
await new Promise(resolve => dependenciesFulfilled = resolve);
|
|
8345
8362
|
}
|
|
8346
8363
|
preRun();
|
|
8347
8364
|
// a preRun added a dependency, run will be called later
|
|
8348
8365
|
if (runDependencies > 0) {
|
|
8349
|
-
dependenciesFulfilled =
|
|
8350
|
-
return;
|
|
8366
|
+
await new Promise(resolve => dependenciesFulfilled = resolve);
|
|
8351
8367
|
}
|
|
8352
8368
|
async function doRun() {
|
|
8353
8369
|
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
@@ -8355,16 +8371,20 @@ function run() {
|
|
|
8355
8371
|
Module["calledRun"] = true;
|
|
8356
8372
|
if (ABORT) return;
|
|
8357
8373
|
initRuntime();
|
|
8358
|
-
readyPromiseResolve?.(Module);
|
|
8359
8374
|
Module["onRuntimeInitialized"]?.();
|
|
8360
8375
|
postRun();
|
|
8361
8376
|
}
|
|
8362
8377
|
if (Module["setStatus"]) {
|
|
8363
8378
|
Module["setStatus"]("Running...");
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8379
|
+
// Yield the main thread to allow the browser to paint "Running...", then clear
|
|
8380
|
+
// the status text after the synchronous doRun() completes.
|
|
8381
|
+
await new Promise(resolve => {
|
|
8382
|
+
setTimeout(() => {
|
|
8383
|
+
setTimeout(() => Module["setStatus"](""), 1);
|
|
8384
|
+
doRun();
|
|
8385
|
+
resolve();
|
|
8386
|
+
}, 1);
|
|
8387
|
+
});
|
|
8368
8388
|
} else {
|
|
8369
8389
|
doRun();
|
|
8370
8390
|
}
|
|
@@ -8374,28 +8394,12 @@ var wasmExports;
|
|
|
8374
8394
|
|
|
8375
8395
|
// In modularize mode the generated code is within a factory function so we
|
|
8376
8396
|
// can use await here (since it's not top-level-await).
|
|
8377
|
-
wasmExports = await
|
|
8378
|
-
|
|
8379
|
-
run();
|
|
8380
|
-
|
|
8381
|
-
// end include: postamble.js
|
|
8382
|
-
// include: postamble_modularize.js
|
|
8383
|
-
// In MODULARIZE mode we wrap the generated code in a factory function
|
|
8384
|
-
// and return either the Module itself, or a promise of the module.
|
|
8385
|
-
// We assign to the `moduleRtn` global here and configure closure to see
|
|
8386
|
-
// this as an extern so it won't get minified.
|
|
8387
|
-
if (runtimeInitialized) {
|
|
8388
|
-
moduleRtn = Module;
|
|
8389
|
-
} else {
|
|
8390
|
-
// Set up the promise that indicates the Module is initialized
|
|
8391
|
-
moduleRtn = new Promise((resolve, reject) => {
|
|
8392
|
-
readyPromiseResolve = resolve;
|
|
8393
|
-
readyPromiseReject = reject;
|
|
8394
|
-
});
|
|
8395
|
-
}
|
|
8397
|
+
wasmExports = await createWasm();
|
|
8398
|
+
|
|
8399
|
+
await run();
|
|
8396
8400
|
|
|
8397
8401
|
|
|
8398
|
-
return
|
|
8402
|
+
return Module;
|
|
8399
8403
|
};
|
|
8400
8404
|
})();
|
|
8401
8405
|
|
|
Binary file
|
|
@@ -9,8 +9,7 @@ var ModuleFactory = (() => {
|
|
|
9
9
|
// In EXPORT_ES6 mode we can just use 'import.meta.url'.
|
|
10
10
|
var _scriptName = globalThis.document?.currentScript?.src;
|
|
11
11
|
return async function(moduleArg = {}) {
|
|
12
|
-
var
|
|
13
|
-
|
|
12
|
+
var Module = moduleArg;
|
|
14
13
|
// include: shell.js
|
|
15
14
|
// include: minimum_runtime_check.js
|
|
16
15
|
// end include: minimum_runtime_check.js
|
|
@@ -27,8 +26,6 @@ var ModuleFactory = (() => {
|
|
|
27
26
|
// after the generated code, you will need to define var Module = {};
|
|
28
27
|
// before the code. Then that object will be used in the code, and you
|
|
29
28
|
// can continue to use Module afterwards as well.
|
|
30
|
-
var Module = moduleArg;
|
|
31
|
-
|
|
32
29
|
// Determine the runtime environment we are in. You can customize this by
|
|
33
30
|
// setting the ENVIRONMENT setting at compile time (see settings.js).
|
|
34
31
|
// Attempt to auto-detect the environment
|
|
@@ -207,8 +204,6 @@ class EmscriptenSjLj extends EmscriptenEH {}
|
|
|
207
204
|
// end include: runtime_exceptions.js
|
|
208
205
|
// include: runtime_debug.js
|
|
209
206
|
// end include: runtime_debug.js
|
|
210
|
-
var readyPromiseResolve, readyPromiseReject;
|
|
211
|
-
|
|
212
207
|
// Memory management
|
|
213
208
|
var runtimeInitialized = false;
|
|
214
209
|
|
|
@@ -286,7 +281,6 @@ function postRun() {
|
|
|
286
281
|
// though it can.
|
|
287
282
|
// TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
|
|
288
283
|
/** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
|
|
289
|
-
readyPromiseReject?.(e);
|
|
290
284
|
// Throw the error whether or not MODULARIZE is set because abort is used
|
|
291
285
|
// in code paths apart from instantiation where an exception is expected
|
|
292
286
|
// to be thrown when abort is called.
|
|
@@ -7018,7 +7012,7 @@ var WebGPU = {
|
|
|
7018
7012
|
TextureSampleType: [ , , "float", "unfilterable-float", "depth", "sint", "uint" ],
|
|
7019
7013
|
TextureViewDimension: [ , "1d", "2d", "2d-array", "cube", "cube-array", "3d" ],
|
|
7020
7014
|
ToneMappingMode: [ , "standard", "extended" ],
|
|
7021
|
-
VertexFormat: [ , "uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra" ],
|
|
7015
|
+
VertexFormat: [ , "uint8", "uint8x2", "uint8x4", "sint8", "sint8x2", "sint8x4", "unorm8", "unorm8x2", "unorm8x4", "snorm8", "snorm8x2", "snorm8x4", "uint16", "uint16x2", "uint16x4", "sint16", "sint16x2", "sint16x4", "unorm16", "unorm16x2", "unorm16x4", "snorm16", "snorm16x2", "snorm16x4", "float16", "float16x2", "float16x4", "float32", "float32x2", "float32x3", "float32x4", "uint32", "uint32x2", "uint32x3", "uint32x4", "sint32", "sint32x2", "sint32x3", "sint32x4", "unorm10-10-10-2", "unorm8x4-bgra", "snorm10-10-10-2" ],
|
|
7022
7016
|
VertexStepMode: [ , "vertex", "instance" ],
|
|
7023
7017
|
WGSLLanguageFeatureName: [ , "readonly_and_readwrite_storage_textures", "packed_4x8_integer_dot_product", "unrestricted_pointer_parameters", "pointer_composite_access", "uniform_buffer_standard_layout", "subgroup_id", "texture_and_sampler_let", "subgroup_uniformity", "texture_formats_tier1", "linear_indexing", "immediate_address_space" ]
|
|
7024
7018
|
};
|
|
@@ -7990,11 +7984,11 @@ Module["FS_createLazyFile"] = FS_createLazyFile;
|
|
|
7990
7984
|
// End JS library exports
|
|
7991
7985
|
// end include: postlibrary.js
|
|
7992
7986
|
var ASM_CONSTS = {
|
|
7993
|
-
|
|
7987
|
+
2207465: () => !!Module["preinitializedWebGPUDevice"],
|
|
7988
|
+
2207516: $0 => {
|
|
7994
7989
|
const device = WebGPU.getJsObject($0);
|
|
7995
7990
|
return device.features.has("subgroups");
|
|
7996
|
-
}
|
|
7997
|
-
2163280: () => !!Module["preinitializedWebGPUDevice"]
|
|
7991
|
+
}
|
|
7998
7992
|
};
|
|
7999
7993
|
|
|
8000
7994
|
function custom_emscripten_dbgn(str, len) {
|
|
@@ -8025,33 +8019,6 @@ function ThrowError(val_handle) {
|
|
|
8025
8019
|
|
|
8026
8020
|
ThrowError.sig = "vi";
|
|
8027
8021
|
|
|
8028
|
-
function JsGetDeviceMinSubgroupSize(deviceId) {
|
|
8029
|
-
const device = WebGPU.getJsObject(deviceId);
|
|
8030
|
-
return device.adapterInfo.subgroupMinSize || device.limits.minSubgroupSize;
|
|
8031
|
-
}
|
|
8032
|
-
|
|
8033
|
-
JsGetDeviceMinSubgroupSize.sig = "ii";
|
|
8034
|
-
|
|
8035
|
-
function JsGetDeviceMaxSubgroupSize(deviceId) {
|
|
8036
|
-
const device = WebGPU.getJsObject(deviceId);
|
|
8037
|
-
return device.adapterInfo.subgroupMaxSize || device.limits.maxSubgroupSize;
|
|
8038
|
-
}
|
|
8039
|
-
|
|
8040
|
-
JsGetDeviceMaxSubgroupSize.sig = "ii";
|
|
8041
|
-
|
|
8042
|
-
function __asyncjs__ReadBufferDataJs(buffer_handle, data_ptr) {
|
|
8043
|
-
return Asyncify.handleAsync(async () => {
|
|
8044
|
-
const gpuReadBuffer = WebGPU.getJsObject(buffer_handle);
|
|
8045
|
-
await gpuReadBuffer.mapAsync(GPUMapMode.READ);
|
|
8046
|
-
const arrayBuffer = gpuReadBuffer.getMappedRange();
|
|
8047
|
-
const u8view = new Uint8Array(arrayBuffer);
|
|
8048
|
-
HEAPU8.set(u8view, data_ptr >>> 0 >>> 0);
|
|
8049
|
-
gpuReadBuffer.unmap();
|
|
8050
|
-
});
|
|
8051
|
-
}
|
|
8052
|
-
|
|
8053
|
-
__asyncjs__ReadBufferDataJs.sig = "vii";
|
|
8054
|
-
|
|
8055
8022
|
function GetAdapterArchitecture() {
|
|
8056
8023
|
const device = Module["preinitializedWebGPUDevice"];
|
|
8057
8024
|
const architecture = device.adapterInfo ? device.adapterInfo.architecture : "Unknown";
|
|
@@ -8084,6 +8051,56 @@ function GetAdapterVendor() {
|
|
|
8084
8051
|
|
|
8085
8052
|
GetAdapterVendor.sig = "i";
|
|
8086
8053
|
|
|
8054
|
+
function JsGetDeviceMinSubgroupSize(deviceId) {
|
|
8055
|
+
const device = WebGPU.getJsObject(deviceId);
|
|
8056
|
+
return device.adapterInfo.subgroupMinSize || device.limits.minSubgroupSize;
|
|
8057
|
+
}
|
|
8058
|
+
|
|
8059
|
+
JsGetDeviceMinSubgroupSize.sig = "ii";
|
|
8060
|
+
|
|
8061
|
+
function JsGetDeviceMaxSubgroupSize(deviceId) {
|
|
8062
|
+
const device = WebGPU.getJsObject(deviceId);
|
|
8063
|
+
return device.adapterInfo.subgroupMaxSize || device.limits.maxSubgroupSize;
|
|
8064
|
+
}
|
|
8065
|
+
|
|
8066
|
+
JsGetDeviceMaxSubgroupSize.sig = "ii";
|
|
8067
|
+
|
|
8068
|
+
function __asyncjs__ReadBufferDataJs(buffer_handle, data_ptr) {
|
|
8069
|
+
return Asyncify.handleAsync(async () => {
|
|
8070
|
+
const gpuReadBuffer = WebGPU.getJsObject(buffer_handle);
|
|
8071
|
+
await gpuReadBuffer.mapAsync(GPUMapMode.READ);
|
|
8072
|
+
const arrayBuffer = gpuReadBuffer.getMappedRange();
|
|
8073
|
+
const u8view = new Uint8Array(arrayBuffer);
|
|
8074
|
+
HEAPU8.set(u8view, data_ptr >>> 0 >>> 0);
|
|
8075
|
+
gpuReadBuffer.unmap();
|
|
8076
|
+
});
|
|
8077
|
+
}
|
|
8078
|
+
|
|
8079
|
+
__asyncjs__ReadBufferDataJs.sig = "vii";
|
|
8080
|
+
|
|
8081
|
+
function __asyncjs__CallStreamWeightsOnWeb(tfl_ids, wgpu_buffers, offsets, lengths, count) {
|
|
8082
|
+
return Asyncify.handleAsync(async () => {
|
|
8083
|
+
const callback = Module.getStreamWeightsCallback();
|
|
8084
|
+
if (typeof callback !== "function") {
|
|
8085
|
+
console.error("Stream weights callback is not registered or is not a function");
|
|
8086
|
+
return 1;
|
|
8087
|
+
}
|
|
8088
|
+
const tflIdsArray = new Int32Array(Module.HEAP32.buffer, tfl_ids, count);
|
|
8089
|
+
const wgpuBuffersArray = new Uint32Array(Module.HEAPU32.buffer, wgpu_buffers, count);
|
|
8090
|
+
const offsetsArray = new Float64Array(Module.HEAPF64.buffer, offsets, count);
|
|
8091
|
+
const lengthsArray = new Float64Array(Module.HEAPF64.buffer, lengths, count);
|
|
8092
|
+
try {
|
|
8093
|
+
await callback(new Int32Array(tflIdsArray), new Uint32Array(wgpuBuffersArray), new Float64Array(offsetsArray), new Float64Array(lengthsArray));
|
|
8094
|
+
} catch (e) {
|
|
8095
|
+
console.error("Error in streamWeightsOnWeb:", e);
|
|
8096
|
+
return 1;
|
|
8097
|
+
}
|
|
8098
|
+
return 0;
|
|
8099
|
+
});
|
|
8100
|
+
}
|
|
8101
|
+
|
|
8102
|
+
__asyncjs__CallStreamWeightsOnWeb.sig = "iiiiii";
|
|
8103
|
+
|
|
8087
8104
|
// Imports from the Wasm binary.
|
|
8088
8105
|
var _malloc, _free, _ma_device__on_notification_unlocked, _ma_malloc_emscripten, _ma_free_emscripten, _ma_device_process_pcm_frames_capture__webaudio, _ma_device_process_pcm_frames_playback__webaudio, _wgpuDeviceAddRef, _emwgpuCreateBindGroup, _emwgpuCreateBindGroupLayout, _emwgpuCreateCommandBuffer, _emwgpuCreateCommandEncoder, _emwgpuCreateComputePassEncoder, _emwgpuCreateComputePipeline, _emwgpuCreateExternalTexture, _emwgpuCreatePipelineLayout, _emwgpuCreateQuerySet, _emwgpuCreateRenderBundle, _emwgpuCreateRenderBundleEncoder, _emwgpuCreateRenderPassEncoder, _emwgpuCreateRenderPipeline, _emwgpuCreateSampler, _emwgpuCreateSurface, _emwgpuCreateTexture, _emwgpuCreateTextureView, _emwgpuCreateAdapter, _emwgpuImportBuffer, _emwgpuCreateDevice, _emwgpuCreateQueue, _emwgpuCreateShaderModule, _emwgpuOnCreateComputePipelineCompleted, _emwgpuOnMapAsyncCompleted, _emwgpuOnWorkDoneCompleted, ___getTypeName, _emscripten_builtin_memalign, _memalign, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, memory, _kVersionStampBuildChangelistStr, _kVersionStampCitcSnapshotStr, _kVersionStampCitcWorkspaceIdStr, _kVersionStampSourceUriStr, _kVersionStampBuildClientStr, _kVersionStampBuildClientMintStatusStr, _kVersionStampBuildCompilerStr, _kVersionStampBuildDateTimePstStr, _kVersionStampBuildDepotPathStr, _kVersionStampBuildIdStr, _kVersionStampBuildInfoStr, _kVersionStampBuildLabelStr, _kVersionStampBuildTargetStr, _kVersionStampBuildTimestampStr, _kVersionStampBuildToolStr, _kVersionStampG3BuildTargetStr, _kVersionStampVerifiableStr, _kVersionStampBuildFdoTypeStr, _kVersionStampBuildBaselineChangelistStr, _kVersionStampBuildLtoTypeStr, _kVersionStampBuildPropellerTypeStr, _kVersionStampBuildPghoTypeStr, _kVersionStampBuildFdoProfileChangelistStr, _kVersionStampBuildMemprofProfileChangelistStr, _kVersionStampBuildUsernameStr, _kVersionStampBuildHostnameStr, _kVersionStampBuildDirectoryStr, _kVersionStampBuildChangelistInt, _kVersionStampCitcSnapshotInt, _kVersionStampBuildClientMintStatusInt, _kVersionStampBuildTimestampInt, _kVersionStampVerifiableInt, _kVersionStampBuildCoverageEnabledInt, _kVersionStampBuildBaselineChangelistInt, _kVersionStampPrecookedTimestampStr, _kVersionStampPrecookedClientInfoStr, __indirect_function_table, _kVersionStampBuildHasHardeningProtobuf, wasmMemory, wasmTable;
|
|
8089
8106
|
|
|
@@ -8178,6 +8195,7 @@ var wasmImports = {
|
|
|
8178
8195
|
/** @export */ JsGetDeviceMinSubgroupSize,
|
|
8179
8196
|
/** @export */ ThrowError,
|
|
8180
8197
|
/** @export */ _Unwind_RaiseException: __Unwind_RaiseException,
|
|
8198
|
+
/** @export */ __asyncjs__CallStreamWeightsOnWeb,
|
|
8181
8199
|
/** @export */ __asyncjs__ReadBufferDataJs,
|
|
8182
8200
|
/** @export */ __syscall_dup: ___syscall_dup,
|
|
8183
8201
|
/** @export */ __syscall_faccessat: ___syscall_faccessat,
|
|
@@ -8327,16 +8345,14 @@ function applySignatureConversions(wasmExports) {
|
|
|
8327
8345
|
|
|
8328
8346
|
// include: postamble.js
|
|
8329
8347
|
// === Auto-generated postamble setup entry stuff ===
|
|
8330
|
-
function run() {
|
|
8348
|
+
async function run() {
|
|
8331
8349
|
if (runDependencies > 0) {
|
|
8332
|
-
dependenciesFulfilled =
|
|
8333
|
-
return;
|
|
8350
|
+
await new Promise(resolve => dependenciesFulfilled = resolve);
|
|
8334
8351
|
}
|
|
8335
8352
|
preRun();
|
|
8336
8353
|
// a preRun added a dependency, run will be called later
|
|
8337
8354
|
if (runDependencies > 0) {
|
|
8338
|
-
dependenciesFulfilled =
|
|
8339
|
-
return;
|
|
8355
|
+
await new Promise(resolve => dependenciesFulfilled = resolve);
|
|
8340
8356
|
}
|
|
8341
8357
|
async function doRun() {
|
|
8342
8358
|
// run may have just been called through dependencies being fulfilled just in this very frame,
|
|
@@ -8344,16 +8360,20 @@ function run() {
|
|
|
8344
8360
|
Module["calledRun"] = true;
|
|
8345
8361
|
if (ABORT) return;
|
|
8346
8362
|
initRuntime();
|
|
8347
|
-
readyPromiseResolve?.(Module);
|
|
8348
8363
|
Module["onRuntimeInitialized"]?.();
|
|
8349
8364
|
postRun();
|
|
8350
8365
|
}
|
|
8351
8366
|
if (Module["setStatus"]) {
|
|
8352
8367
|
Module["setStatus"]("Running...");
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8368
|
+
// Yield the main thread to allow the browser to paint "Running...", then clear
|
|
8369
|
+
// the status text after the synchronous doRun() completes.
|
|
8370
|
+
await new Promise(resolve => {
|
|
8371
|
+
setTimeout(() => {
|
|
8372
|
+
setTimeout(() => Module["setStatus"](""), 1);
|
|
8373
|
+
doRun();
|
|
8374
|
+
resolve();
|
|
8375
|
+
}, 1);
|
|
8376
|
+
});
|
|
8357
8377
|
} else {
|
|
8358
8378
|
doRun();
|
|
8359
8379
|
}
|
|
@@ -8363,28 +8383,12 @@ var wasmExports;
|
|
|
8363
8383
|
|
|
8364
8384
|
// In modularize mode the generated code is within a factory function so we
|
|
8365
8385
|
// can use await here (since it's not top-level-await).
|
|
8366
|
-
wasmExports = await
|
|
8367
|
-
|
|
8368
|
-
run();
|
|
8369
|
-
|
|
8370
|
-
// end include: postamble.js
|
|
8371
|
-
// include: postamble_modularize.js
|
|
8372
|
-
// In MODULARIZE mode we wrap the generated code in a factory function
|
|
8373
|
-
// and return either the Module itself, or a promise of the module.
|
|
8374
|
-
// We assign to the `moduleRtn` global here and configure closure to see
|
|
8375
|
-
// this as an extern so it won't get minified.
|
|
8376
|
-
if (runtimeInitialized) {
|
|
8377
|
-
moduleRtn = Module;
|
|
8378
|
-
} else {
|
|
8379
|
-
// Set up the promise that indicates the Module is initialized
|
|
8380
|
-
moduleRtn = new Promise((resolve, reject) => {
|
|
8381
|
-
readyPromiseResolve = resolve;
|
|
8382
|
-
readyPromiseReject = reject;
|
|
8383
|
-
});
|
|
8384
|
-
}
|
|
8386
|
+
wasmExports = await createWasm();
|
|
8387
|
+
|
|
8388
|
+
await run();
|
|
8385
8389
|
|
|
8386
8390
|
|
|
8387
|
-
return
|
|
8391
|
+
return Module;
|
|
8388
8392
|
};
|
|
8389
8393
|
})();
|
|
8390
8394
|
|
|
Binary file
|