1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! Software graph capture for wgpu.
//!
//! WebGPU has no driver-side graph object and no re-submittable command
//! buffers (`queue.submit` consumes them), so unlike CUDA/HIP a captured graph
//! is a **software graph**: everything a launch resolves per dispatch —
//! pipeline lookup, binding resolution, info-uniform upload, bind group
//! creation — is done once while recording, and
//! [`WgpuStream::replay_graph`](super::stream::WgpuStream::replay_graph)
//! re-encodes the prebuilt state in a tight loop.
//!
//! Replay therefore stays O(n) in recorded tasks — encoding cannot be skipped
//! under WebGPU — and only the constant shrinks. That makes it worth measuring
//! rather than assuming: `cargo run --release -p cubecl-wgpu --example
//! graph_bench` sweeps kernel size against graph length and prints, per size,
//! how much of the pass was launch overhead in the first place. The win is
//! confined to sizes where that share is large, and the sweep includes
//! GPU-bound rows where it must vanish.
use crateWgpuResource;
use crateAddresses;
use ;
use Arc;
use ComputePipeline;
/// A captured graph: the recorded launch sequence, fully resolved (see the
/// [module docs](self)).
///
/// Owned by the [`WgpuServer`](super::server::WgpuServer) registry and
/// referenced by [`GraphId`](cubecl_runtime::id::GraphId); the client
/// references the graph by id and, on the last drop, asks the server to
/// release it.
/// One recorded dispatch, resolved down to what `wgpu` needs at encode time.
pub
/// The dispatch shape of a recorded task.
pub
/// The in-progress recording on a stream, moved into a [`WgpuGraph`] at
/// `end_capture`.
pub