setmode¶
Sets a new mode for VM functions according to the mode
parameter
and returns the previous VM mode.
Syntax
-
uint64_t
set_mode
(queue &exec_queue, uint64_t new_mode)¶
Description
The set_mode function sets a new mode for VM functions according
to the new_mode
parameter and returns the previous VM mode.
The mode change has a global effect on all the VM functions within
a thread.
The mode
parameter is designed to control accuracy and
handling of denormalized numbers. You can obtain all other
possible values of the mode
parameter using bitwise OR ( | )
operation to combine one value for handling of denormalized
numbers.
The mode::ftzdazon is specifically designed to improve the performance of computations that involve denormalized numbers at the cost of reasonable accuracy loss. This mode changes the numeric behavior of the functions: denormalized input values are treated as zeros (DAZ = denormals-are-zero) and denormalized results are flushed to zero (FTZ = flush-to-zero). Accuracy loss may occur if input and/or output values are close to denormal range.
Value of mode |
Description |
---|---|
Accuracy Control |
|
|
High accuracy versions of VM functions. |
|
Low accuracy versions of VM functions. |
|
Enhanced performance accuracy versions of VM functions. |
Denormalized Numbers Handling Control |
|
|
Faster processing of denormalized inputs is enabled. |
|
Faster processing of denormalized inputs is disabled. |
Other |
|
|
VM status not defined. |
The default value of the mode parameter is:
mode::ha | mode::ftdazoff
Input Parameters
- exec_queue
The queue where the routine should be executed.
- new_mode
Specifies the VM mode to be set.
Output Parameters
- return value (old_mode)
Specifies the former VM mode.
Example
oldmode = set_mode (exec_queue , mode::la);
oldmode = set_mode (exec_queue , mode::ep | mode::ftzdazon);
Parent topic: VM Service Functions