Skip to content

WebGPU Developer Features

Fresh 🌱

Source: WebGPU Developer FeaturesPublished: June 3, 2025

Production Warning

These features are outside the standard WebGPU specification and intended for development and testing only. Do NOT use in production.

Enable Dev Features

  1. Navigate to chrome://flags/#enable-webgpu-developer-features
  2. Set to Enabled
  3. Restart Chrome

Feature 1: Disable Timestamp Query Quantization

By default, timestamp queries are quantized to 100 microsecond resolution to prevent timing side-channel attacks.

With dev flag enabled, quantization is automatically disabled, giving you nanosecond precision for GPU profiling.

javascript
// Timestamp queries — precise timing of GPU operations
const querySet = device.createQuerySet({ type: 'timestamp', count: 2 });

const resolveBuffer = device.createBuffer({
  size: 16,
  usage: GPUBufferUsage.QUERY_RESOLVE | GPUBufferUsage.COPY_SRC
});

const enc = device.createCommandEncoder();
const pass = enc.beginComputePass({
  timestampWrites: {
    querySet,
    beginningOfPassWriteIndex: 0,
    endOfPassWriteIndex: 1
  }
});
// ... dispatch work ...
pass.end();
enc.resolveQuerySet(querySet, 0, 2, resolveBuffer, 0);
device.queue.submit([enc.finish()]);

// Read timestamps (nanoseconds)
const staging = device.createBuffer({
  size: 16,
  usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
});
const enc2 = device.createCommandEncoder();
enc2.copyBufferToBuffer(resolveBuffer, 0, staging, 0, 16);
device.queue.submit([enc2.finish()]);

await staging.mapAsync(GPUMapMode.READ);
const timestamps = new BigUint64Array(staging.getMappedRange());
const gpuTimeNs = Number(timestamps[1] - timestamps[0]);
console.log(`GPU pass duration: ${gpuTimeNs / 1e6} ms`);
staging.unmap();

Feature 2: Extended Adapter Information

javascript
const adapter = await navigator.gpu.requestAdapter();

// Standardized attributes (available in production)
console.log(adapter.info.vendor);      // e.g. "NVIDIA"
console.log(adapter.info.architecture); // e.g. "Turing"
console.log(adapter.info.device);      // Vendor-specific adapter ID
console.log(adapter.info.description); // Human-readable string

// Non-standardized (dev feature only)
console.log(adapter.info.driver);          // Driver version string
console.log(adapter.info.backend);         // "D3D12" | "metal" | "vulkan" | "openGL" | "openGLES" | "null"
console.log(adapter.info.type);            // "discrete GPU" | "integrated GPU" | "CPU" | "unknown"
console.log(adapter.info.d3dShaderModel);  // e.g. 62 = HLSL SM 6.2
console.log(adapter.info.vkDriverVersion); // Vulkan driver version
console.log(adapter.info.powerPreference); // "low-power" | "high-performance"

Memory Heap Information

javascript
const adapter = await navigator.gpu.requestAdapter();

for (const { size, properties } of adapter.info.memoryHeaps) {
  console.log(`Heap size: ${(size / 1024 / 1024 / 1024).toFixed(2)} GB`);

  if (properties & GPUHeapProperty.DEVICE_LOCAL)  console.log('  → Device local (VRAM)');
  if (properties & GPUHeapProperty.HOST_VISIBLE)  console.log('  → Host visible (CPU can access)');
  if (properties & GPUHeapProperty.HOST_COHERENT) console.log('  → Host coherent (no explicit flush)');
  if (properties & GPUHeapProperty.HOST_UNCACHED)  console.log('  → Uncached');
  if (properties & GPUHeapProperty.HOST_CACHED)    console.log('  → Cached');
}

Use Case

Use memory heap info to anticipate allocation failures when building large GPU workloads (e.g., allocating a 4GB model on a 2GB VRAM device).

Feature 3: Strict Math Shader Option

Controls floating-point precision optimizations during shader compilation. Supported on Metal and Direct3D.

javascript
// Enable strict math: compiler follows IEEE 754 precisely
// - Does NOT assume NaN/Infinity are impossible
// - Treats -0 as distinct from +0
// - No division → reciprocal replacement
// - No reordering of operations
const strictShader = device.createShaderModule({
  code: `
    fn isNaN(x: f32) -> bool {
      // This check REQUIRES strict math to work correctly
      let ones_exp = (bitcast<u32>(x) & 0x7f800000u) == 0x7f800000u;
      let non_zero_sig = (bitcast<u32>(x) & 0x007fffffu) != 0u;
      return ones_exp && non_zero_sig;
    }
  `,
  strictMath: true  // Enable strict math
});

// Disable strict math: allows aggressive optimizations
// - Ignores NaN/Infinity possibility
// - Replaces division with reciprocal multiplication
// - Reorders associative operations
const fastShader = device.createShaderModule({
  code: fastWGSL,
  strictMath: false
});

When to use strict math:

  • Scientific computing requiring IEEE 754 compliance
  • NaN/Infinity detection routines
  • Algorithms where operation order matters

When to disable (default):

  • Game graphics shaders (performance > precision)
  • General ML inference layers

Feature 4: Zero-Copy Video Import Check

javascript
const adapter = await navigator.gpu.requestAdapter();
const device = await adapter.requestDevice();

const video = document.querySelector('video');
const externalTexture = device.importExternalTexture({ source: video });

if (externalTexture.isZeroCopy) {
  console.log('Optimal: GPU reads video frame directly — no intermediate copy');
} else {
  console.warn('Suboptimal: Intermediate copy created (platform/driver limitation)');
}

Zero-copy occurs when:

  • OS/driver supports direct GPU-to-GPU video texture path
  • Video decoder outputs in GPU-accessible memory

Falls back to copy when:

  • Software video decoding
  • Certain OS/GPU combinations without native support

See Also

Based on Chrome for Developers WebGPU Documentation