set webgpu optimized flags

pull/193/head 2.3.2
Vladimir Mandic 2021-10-11 09:22:39 -04:00
parent 3e7bbf2538
commit 93b5dfd3ee
14 changed files with 708 additions and 697 deletions

View File

@ -11,9 +11,8 @@
### **HEAD -> main** 2021/10/10 mandic00@live.com
### **origin/main** 2021/10/08 mandic00@live.com
- image processing fixes
- redesign body and hand caching and interpolation
- demo default config cleanup
- improve gaze and face angle visualizations in draw

View File

@ -1183,8 +1183,8 @@ function process2(input, config3, getTensor = true) {
pixels = tfjs_esm_exports.browser ? tfjs_esm_exports.browser.fromPixels(input) : null;
} else {
depth = input["data"].length / input["height"] / input["width"];
const arr = Uint8Array.from(input["data"]);
pixels = tfjs_esm_exports.tensor(arr, [input["height"], input["width"], depth], "float32");
const arr = new Uint8Array(input["data"]["buffer"]);
pixels = tfjs_esm_exports.tensor(arr, [input["height"], input["width"], depth], "int32");
}
} else {
if (!tmpCanvas || outCanvas.width !== tmpCanvas.width || (outCanvas == null ? void 0 : outCanvas.height) !== (tmpCanvas == null ? void 0 : tmpCanvas.height))
@ -10700,7 +10700,9 @@ async function check(instance, force = false) {
}
}
if (tfjs_esm_exports.getBackend() === "webgpu") {
tfjs_esm_exports.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 256);
tfjs_esm_exports.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 512);
tfjs_esm_exports.ENV.set("WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE", 0);
tfjs_esm_exports.ENV.set("WEBGPU_CPU_FORWARD", true);
}
tfjs_esm_exports.enableProdMode();
await tfjs_esm_exports.ready();

File diff suppressed because one or more lines are too long

8
dist/human.esm.js vendored
View File

@ -68672,8 +68672,8 @@ function process2(input2, config3, getTensor2 = true) {
pixels = browser_exports ? browser_exports.fromPixels(input2) : null;
} else {
depth = input2["data"].length / input2["height"] / input2["width"];
const arr = Uint8Array.from(input2["data"]);
pixels = tensor(arr, [input2["height"], input2["width"], depth], "float32");
const arr = new Uint8Array(input2["data"]["buffer"]);
pixels = tensor(arr, [input2["height"], input2["width"], depth], "int32");
}
} else {
if (!tmpCanvas || outCanvas.width !== tmpCanvas.width || (outCanvas == null ? void 0 : outCanvas.height) !== (tmpCanvas == null ? void 0 : tmpCanvas.height))
@ -78189,7 +78189,9 @@ async function check(instance, force = false) {
}
}
if (getBackend() === "webgpu") {
ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 256);
ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 512);
ENV.set("WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE", 0);
ENV.set("WEBGPU_CPU_FORWARD", true);
}
enableProdMode();
await ready();

File diff suppressed because one or more lines are too long

88
dist/human.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1204,8 +1204,8 @@ function process2(input, config3, getTensor = true) {
pixels = tf2.browser ? tf2.browser.fromPixels(input) : null;
} else {
depth = input["data"].length / input["height"] / input["width"];
const arr = Uint8Array.from(input["data"]);
pixels = tf2.tensor(arr, [input["height"], input["width"], depth], "float32");
const arr = new Uint8Array(input["data"]["buffer"]);
pixels = tf2.tensor(arr, [input["height"], input["width"], depth], "int32");
}
} else {
if (!tmpCanvas || outCanvas.width !== tmpCanvas.width || (outCanvas == null ? void 0 : outCanvas.height) !== (tmpCanvas == null ? void 0 : tmpCanvas.height))
@ -10763,7 +10763,9 @@ async function check(instance, force = false) {
}
}
if (tf23.getBackend() === "webgpu") {
tf23.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 256);
tf23.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 512);
tf23.ENV.set("WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE", 0);
tf23.ENV.set("WEBGPU_CPU_FORWARD", true);
}
tf23.enableProdMode();
await tf23.ready();

View File

@ -1205,8 +1205,8 @@ function process2(input, config3, getTensor = true) {
pixels = tf2.browser ? tf2.browser.fromPixels(input) : null;
} else {
depth = input["data"].length / input["height"] / input["width"];
const arr = Uint8Array.from(input["data"]);
pixels = tf2.tensor(arr, [input["height"], input["width"], depth], "float32");
const arr = new Uint8Array(input["data"]["buffer"]);
pixels = tf2.tensor(arr, [input["height"], input["width"], depth], "int32");
}
} else {
if (!tmpCanvas || outCanvas.width !== tmpCanvas.width || (outCanvas == null ? void 0 : outCanvas.height) !== (tmpCanvas == null ? void 0 : tmpCanvas.height))
@ -10764,7 +10764,9 @@ async function check(instance, force = false) {
}
}
if (tf23.getBackend() === "webgpu") {
tf23.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 256);
tf23.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 512);
tf23.ENV.set("WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE", 0);
tf23.ENV.set("WEBGPU_CPU_FORWARD", true);
}
tf23.enableProdMode();
await tf23.ready();

8
dist/human.node.js vendored
View File

@ -1204,8 +1204,8 @@ function process2(input, config3, getTensor = true) {
pixels = tf2.browser ? tf2.browser.fromPixels(input) : null;
} else {
depth = input["data"].length / input["height"] / input["width"];
const arr = Uint8Array.from(input["data"]);
pixels = tf2.tensor(arr, [input["height"], input["width"], depth], "float32");
const arr = new Uint8Array(input["data"]["buffer"]);
pixels = tf2.tensor(arr, [input["height"], input["width"], depth], "int32");
}
} else {
if (!tmpCanvas || outCanvas.width !== tmpCanvas.width || (outCanvas == null ? void 0 : outCanvas.height) !== (tmpCanvas == null ? void 0 : tmpCanvas.height))
@ -10763,7 +10763,9 @@ async function check(instance, force = false) {
}
}
if (tf23.getBackend() === "webgpu") {
tf23.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 256);
tf23.ENV.set("WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD", 512);
tf23.ENV.set("WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE", 0);
tf23.ENV.set("WEBGPU_CPU_FORWARD", true);
}
tf23.enableProdMode();
await tf23.ready();

View File

@ -165,9 +165,9 @@ export function process(input: Input, config: Config, getTensor: boolean = true)
pixels = tf.browser ? tf.browser.fromPixels(input) : null;
} else {
depth = input['data'].length / input['height'] / input['width'];
const arr = Uint8Array.from(input['data']);
// const arr = new Uint8Array(input['data']['buffer']);
pixels = tf.tensor(arr, [input['height'], input['width'], depth], 'float32');
// const arr = Uint8Array.from(input['data']);
const arr = new Uint8Array(input['data']['buffer']);
pixels = tf.tensor(arr, [input['height'], input['width'], depth], 'int32');
}
} else {
if (!tmpCanvas || (outCanvas.width !== tmpCanvas.width) || (outCanvas?.height !== tmpCanvas?.height)) tmpCanvas = canvas(outCanvas.width, outCanvas.height); // init output canvas

View File

@ -91,7 +91,9 @@ export async function check(instance, force = false) {
// customize webgpu
if (tf.getBackend() === 'webgpu') {
tf.ENV.set('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', 256);
tf.ENV.set('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', 512);
tf.ENV.set('WEBGPU_DEFERRED_SUBMIT_BATCH_SIZE', 0);
tf.ENV.set('WEBGPU_CPU_FORWARD', true);
}
// wait for ready

View File

@ -1,24 +1,24 @@
2021-10-10 22:23:11 INFO:  @vladmandic/human version 2.3.2
2021-10-10 22:23:11 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.10.0
2021-10-10 22:23:11 INFO:  Application: {"name":"@vladmandic/human","version":"2.3.2"}
2021-10-10 22:23:11 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-10-10 22:23:11 INFO:  Toolchain: {"build":"0.5.3","esbuild":"0.13.4","typescript":"4.4.3","typedoc":"0.22.5","eslint":"7.32.0"}
2021-10-10 22:23:11 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-10-10 22:23:11 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-10-10 22:23:11 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1275}
2021-10-10 22:23:11 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":52,"inputBytes":515699,"outputBytes":427792}
2021-10-10 22:23:11 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1283}
2021-10-10 22:23:11 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":52,"inputBytes":515707,"outputBytes":427796}
2021-10-10 22:23:11 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1350}
2021-10-10 22:23:11 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":52,"inputBytes":515774,"outputBytes":427868}
2021-10-10 22:23:11 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1631}
2021-10-10 22:23:11 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":3085,"outputBytes":856}
2021-10-10 22:23:11 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":52,"inputBytes":515280,"outputBytes":429377}
2021-10-10 22:23:12 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":3085,"outputBytes":2691961}
2021-10-10 22:23:12 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":52,"inputBytes":3206385,"outputBytes":1607409}
2021-10-10 22:23:13 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":52,"inputBytes":3206385,"outputBytes":2921305}
2021-10-10 22:23:29 STATE: Typings: {"input":"src/human.ts","output":"types","files":6}
2021-10-10 22:23:34 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":35,"generated":true}
2021-10-10 22:24:01 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":86,"errors":0,"warnings":0}
2021-10-10 22:24:02 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-10-10 22:24:02 INFO:  Done...
2021-10-11 09:17:21 INFO:  @vladmandic/human version 2.3.2
2021-10-11 09:17:21 INFO:  User: vlado Platform: linux Arch: x64 Node: v16.10.0
2021-10-11 09:17:21 INFO:  Application: {"name":"@vladmandic/human","version":"2.3.2"}
2021-10-11 09:17:21 INFO:  Environment: {"profile":"production","config":"build.json","tsconfig":true,"eslintrc":true,"git":true}
2021-10-11 09:17:21 INFO:  Toolchain: {"build":"0.5.3","esbuild":"0.13.4","typescript":"4.4.3","typedoc":"0.22.5","eslint":"7.32.0"}
2021-10-11 09:17:21 INFO:  Build: {"profile":"production","steps":["clean","compile","typings","typedoc","lint","changelog"]}
2021-10-11 09:17:21 STATE: Clean: {"locations":["dist/*","types/*","typedoc/*"]}
2021-10-11 09:17:21 STATE: Compile: {"name":"tfjs/nodejs/cpu","format":"cjs","platform":"node","input":"tfjs/tf-node.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":102,"outputBytes":1275}
2021-10-11 09:17:21 STATE: Compile: {"name":"human/nodejs/cpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node.js","files":52,"inputBytes":515801,"outputBytes":427907}
2021-10-11 09:17:21 STATE: Compile: {"name":"tfjs/nodejs/gpu","format":"cjs","platform":"node","input":"tfjs/tf-node-gpu.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":110,"outputBytes":1283}
2021-10-11 09:17:21 STATE: Compile: {"name":"human/nodejs/gpu","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-gpu.js","files":52,"inputBytes":515809,"outputBytes":427911}
2021-10-11 09:17:21 STATE: Compile: {"name":"tfjs/nodejs/wasm","format":"cjs","platform":"node","input":"tfjs/tf-node-wasm.ts","output":"dist/tfjs.esm.js","files":1,"inputBytes":149,"outputBytes":1350}
2021-10-11 09:17:21 STATE: Compile: {"name":"human/nodejs/wasm","format":"cjs","platform":"node","input":"src/human.ts","output":"dist/human.node-wasm.js","files":52,"inputBytes":515876,"outputBytes":427983}
2021-10-11 09:17:21 STATE: Compile: {"name":"tfjs/browser/version","format":"esm","platform":"browser","input":"tfjs/tf-version.ts","output":"dist/tfjs.version.js","files":1,"inputBytes":1063,"outputBytes":1631}
2021-10-11 09:17:21 STATE: Compile: {"name":"tfjs/browser/esm/nobundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":2,"inputBytes":3085,"outputBytes":856}
2021-10-11 09:17:21 STATE: Compile: {"name":"human/browser/esm/nobundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm-nobundle.js","files":52,"inputBytes":515382,"outputBytes":429516}
2021-10-11 09:17:22 STATE: Compile: {"name":"tfjs/browser/esm/bundle","format":"esm","platform":"browser","input":"tfjs/tf-browser.ts","output":"dist/tfjs.esm.js","files":8,"inputBytes":3085,"outputBytes":2691961}
2021-10-11 09:17:22 STATE: Compile: {"name":"human/browser/iife/bundle","format":"iife","platform":"browser","input":"src/human.ts","output":"dist/human.js","files":52,"inputBytes":3206487,"outputBytes":1607493}
2021-10-11 09:17:23 STATE: Compile: {"name":"human/browser/esm/bundle","format":"esm","platform":"browser","input":"src/human.ts","output":"dist/human.esm.js","files":52,"inputBytes":3206487,"outputBytes":2921410}
2021-10-11 09:17:39 STATE: Typings: {"input":"src/human.ts","output":"types","files":6}
2021-10-11 09:17:44 STATE: TypeDoc: {"input":"src/human.ts","output":"typedoc","objects":35,"generated":true}
2021-10-11 09:18:12 STATE: Lint: {"locations":["*.json","src/**/*.ts","test/**/*.js","demo/**/*.js"],"files":86,"errors":0,"warnings":0}
2021-10-11 09:18:13 STATE: ChangeLog: {"repository":"https://github.com/vladmandic/human","branch":"main","output":"CHANGELOG.md"}
2021-10-11 09:18:13 INFO:  Done...

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/tfjs/backend.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAOpD,wBAAsB,KAAK,CAAC,QAAQ,KAAA,EAAE,KAAK,UAAQ,oBAmGlD;AAGD,wBAAgB,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,KAAA,QAazD"}
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../src/tfjs/backend.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAOpD,wBAAsB,KAAK,CAAC,QAAQ,KAAA,EAAE,KAAK,UAAQ,oBAqGlD;AAGD,wBAAgB,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,KAAA,QAazD"}