Frontory

Open code, practice, and notes →

Download source with English comments · for reading

WebGPU · 28 Compute and Readback

Series contents · Technology map

Stage: Recovery, Measurement, and an Integrated Project · Editable example · Storage ID: webgpu-03

Goals and learning outcomes

Prerequisites

Continue using the output and notes from unit 27. Preserve the previous inputs and reference outputs before the Compute and Readback experiment.

Key concepts and explanations

Combined Comparison

When moving array calculations to the GPU, data movement can determine the overall benefit. Compare both the compute interval and the latency until results reach the user.

Adoption Evidence

Input sizes where the GPU path is not faster are results too. Define conditions for use that include correctness, support coverage, and recovery costs.

Practice setup

The existing webgpu-03 preview is a starting point. It does not replace implementation or validation of the entire subsequent assignment. This is a document-guided exercise to implement yourself in a separate localhost or HTTPS project. Check the secure context, navigator.gpu, and adapter request result, and provide an unsupported-environment message. Preserve device.lost handling and resource release.

The linked example is a starting point. It does not implement every task below. Complete work beyond its supported scope in a separate project.

Practice tasks

  1. Run the final kernel and CPU function with the same seed for 65·1003·65536 elements.
  2. Record end-to-end latency for three readback policies: none, once at the end, and every step.
  3. In report.md, document maximum error, environment, selected workgroup, device loss recovery results, and adoption conditions.

Variables to observe

VariableBaselineChangeExpected change / hypothesis
Readback frequencyOnce at the endEvery stepResults are expected to remain the same, but repeated transfer and waiting may increase end-to-end latency.

Predictions in this table are not measured results. Change one condition at a time and record why the actual result differs.

Completion criteria

Self-check

  1. For which inputs is the CPU path more suitable?
  2. How do comparison conditions change if results are drawn directly on the GPU?

Official references

Linked example and execution scope

Example source · Runtime environments and limits

Source code and records are not overwritten automatically. Resetting an existing example also preserves your notes.

Next learning

Previous: Acceptance of the Integrated Particle Experiment

Open code, practice, and notes →