You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 2, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/taskgraph.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,42 @@ For this purpose, Daxa has TaskImageViews. A TaskImageView, similarly to an Imag
42
42
43
43
All Tasks take in views instead of the resources themselves. Resources implicitly cast to the views but have the explicit conversion function `.view()`. Views also have a `.view()` function to create a new view from an existing one.
44
44
45
+
### Task Resource Data Dependencies
46
+
47
+
One of the main functions of the task graph is automatically generate sync and to automatically optimize execution by reordering task callbacks and their recorded commands.
48
+
49
+
To know how to generate sync and when its safe to reorder commands, the tg builds a literl graph of resource uses between the tasks. Based on this graph we can infer optimal ordering and sync.
50
+
51
+
#### Usage Implications
52
+
53
+
when a task is added, tg will immediately form new access dependencies for all resources assigned to attachments of that task.
Here, TaskB reads img0, tg will see that the TaskA writing Img0 was recorded before TaskB. Tg will form a write -> read dependency when adding TaskB, forcing TaskB to be executed AFTER TaskA. Same for TaskC to TaskB. This leaves the only execution order:
In this example there is no dependency between TaskC to A and B, no dependency between TaskD to A and B. This allows task graph to move the execution of TaskC and TaskD earlier, this will reduce the number of barriers.
64
+
`TaskA TaskC -> TaskB TaskD`
65
+
66
+
Dependencies are always formed immediately when a task is added based on the given task resource views.
67
+
68
+
### Concurrent Access
69
+
70
+
Sometimes it is undesirable that two tasks that write the same resource form a `write -> write` order depdendency. For example it could be the case that TaskA writes the left half of an image and TaskB the right half or that the access is synchronized via atomics.
71
+
72
+
Tg will form dependencies here per default. To avoid this, use a concurrent task access for all tasks that you want to allow them to execute at the same time.
Notice here that there are still dependencies formed to writes not marked as concurrent. So while B and C execute together, A and D form strong ordering dependencies to the concurrent writes.
80
+
45
81
## Task
46
82
47
83
The core part of any render graph is the nodes in the graph. In the case of Daxa, these nodes are called tasks.
0 commit comments