GpuSync¶
Waits for the launched GPU work to finish.
Declaration¶
Syntax¶
GpuSync()
Arguments¶
None.
Return values¶
None.
Description¶
GpuSync blocks the host until every kernel launched so far has completed, so results written by a kernel can be read afterwards.
Examples¶
(GpuSync)
It comes from this complete ASR text document:
(TranslationUnit
:symtab (SymbolTable
:id 0
:symbols {
"m" (Module
:symtab (SymbolTable
:id 1
:symbols {
"launch" (Function
:symtab (SymbolTable
:id 2
:symbols {
"a" (Variable
:parent_symtab 2
:name "a"
:dependencies []
:intent :InOut
:symbolic_value nil
:value nil
:storage :Default
:type (Array
:type (Real
:kind 4
)
:dims [
(dimension
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:length (IntegerConstant
:n 256
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
]
:physical_type :FixedSizeArray
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "launch"
:function_signature (FunctionType
:arg_types [
(Array
:type (Real
:kind 4
)
:dims [
(dimension
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:length (IntegerConstant
:n 256
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
]
:physical_type :FixedSizeArray
)
]
:return_var_type nil
:abi :Source
:deftype :Implementation
:bindc_name nil
:elemental false
:pure false
:module false
:inline false
:static false
:restrictions []
:is_restriction false
)
:dependencies []
:args [
(Var
:v (SymbolRef 2 "a")
)
]
:body [
(GpuKernelLaunch
:kernel (SymbolRef 1 "zero")
:grid_size (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:block_size (IntegerConstant
:n 256
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:args [
(call_arg
:value (Var
:v (SymbolRef 2 "a")
)
)
]
)
(GpuSync)
]
:return_var nil
:access :Public
:deterministic false
:side_effect_free false
:module_file nil
)
"zero" (GpuKernelFunction
:symtab (SymbolTable
:id 3
:symbols {
"a" (Variable
:parent_symtab 3
:name "a"
:dependencies []
:intent :InOut
:symbolic_value nil
:value nil
:storage :Default
:type (Array
:type (Real
:kind 4
)
:dims [
(dimension
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:length (IntegerConstant
:n 256
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
]
:physical_type :FixedSizeArray
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "zero"
:function_signature (FunctionType
:arg_types [
(Array
:type (Real
:kind 4
)
:dims [
(dimension
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:length (IntegerConstant
:n 256
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
]
:physical_type :FixedSizeArray
)
]
:return_var_type nil
:abi :Source
:deftype :Implementation
:bindc_name nil
:elemental false
:pure false
:module false
:inline false
:static false
:restrictions []
:is_restriction false
)
:dependencies []
:args [
(Var
:v (SymbolRef 3 "a")
)
]
:body []
:access :Public
)
}
)
:name "m"
:parent_module nil
:dependencies []
:loaded_from_mod false
:intrinsic false
:has_submodules false
)
"main" (Program
:symtab (SymbolTable
:id 4
:symbols {}
)
:name "main"
:dependencies []
:body []
)
}
)
:items []
)