WebGPU f16 support (f16 bounty part 2) (#8653)

* WebGPU f16 support

* Don't enable f16 yet

* dtype tests passing after bitcast fix

* Maybe all WebGPU green?

* Require shader-f16 in examples

* Minor wgsl touchup

* 1 line shorter

* Simpler

* Add transcendetal support

* log2 nan location mismatch on Vulkan

* Nan skips
This commit is contained in:
Ahmed Harmouche
2025-02-12 12:46:53 +01:00
committed by GitHub
parent aaed315fee
commit 916d5e7f08
12 changed files with 59 additions and 27 deletions

View File

@@ -49,7 +49,10 @@ canvas { display: none; }
const getDevice = async () => {
if (!navigator.gpu) error("WebGPU not supported.");
const adapter = await navigator.gpu.requestAdapter();
return await adapter.requestDevice();
return await adapter.requestDevice({
requiredFeatures: ["shader-f16"],
powerPreference: "high-performance"
});
};
const timer = async (func, label = "") => {

View File

@@ -322,7 +322,9 @@
requiredLimits.maxBufferSize = maxBufferSizeInSDModel;
return await adapter.requestDevice({
requiredLimits
requiredLimits,
requiredFeatures: ["shader-f16"],
powerPreference: "high-performance"
});
};

View File

@@ -251,7 +251,10 @@
const getDevice = async () => {
if (!navigator.gpu) return false;
const adapter = await navigator.gpu.requestAdapter();
return await adapter.requestDevice();
return await adapter.requestDevice({
requiredFeatures: ["shader-f16"],
powerPreference: "high-performance"
});
};
function processOutput(output, img_width, img_height) {