GpuKeep

Tells the runtime that the host does not change some arrays until a launch reads them again.

Declaration

Syntax

GpuKeep(expr* vars)

Arguments

Argument

Описание

vars

the arrays: whole, contiguous arrays that are locals or dummy arguments of the procedure.

Return values

None.

Описание

A runtime with memory of its own copies an array a GpuKernelLaunch only reads to the device, and keeps that copy for the launches after it until the host waits (GpuSync or GpuWait): only then may the host change the array. GpuKeep comes right before such a wait, and names the arrays the host does not change from there until a launch reads them or the next wait: the copies of them stay on the device past this wait. A time loop whose host reads the result of a reduction at every iteration waits there, and copies the arrays it reads only once.

The gpu_launch_sync pass places it; see GPU offloading.

Examples

(GpuKeep
  :vars [
    (Var
      :v (SymbolRef 2 "a")
    )
  ]
)

See Also

GpuKernelLaunch, GpuSync, GpuWait, GpuDiscard