Performance: Atomic Tasks & PrefetchingTasks that invoke the compute method are constructing subtasks. One of the subtasks is cached on the Host that constructed it. But, what can be done to reduce communcation latency when a task does not construct subtasks? If it is known at compile-time that a task does not construct subtasks, it should extend Atomic. The class Atomic extends Task, and is a way for an application programmer to implicitly direct Janet to perform a prefetch: When a Host receives a Task that is an instance of Atomic, it fetches another task before invoking the Atomic task's execute method.In the preceding example, the F task decomposes into either smaller F tasks or into tasks of a class called Atom that extends Atomic. These tasks trigger a prefetch, materially reducing overall latency. |