HSAIL defines a set of exceptions, and provides a mechanism to control these exceptions by means of hardware exception policies (see Hardware Exception Policies). The exception policies are specified when a kernel is finalized and cannot be changed at runtime.
HSAIL requires the hardware to generate the exceptions, as defined by the HSAIL instructions, that are enabled for at least one of the exception policies. The hardware is not required to generate exceptions that are not enabled for any exception policy.
The exceptions include the five floating-point exceptions specified in IEEE/ANSI Standard 754-2008. HSAIL also allows, but does not require, an implementation to generate a divide by zero exception if integer division or remainder with a divisor of zero is performed.
For the Base profile (see Base Profile Requirements), it is not permitted to enable any of the exception policies for the five floating-point exceptions.
HSAIL also allows, but does not require, an implementation to generate other exceptions, such as invalid address and memory exception. However, HSAIL does not provide support to control these exceptions by means of the HSAIL exception policies. If such exceptions are generated, it is implementation defined if the exception is signaled. See Handling Signaled Exceptions. If the implementation does not signal the exception, or if execution is resumed after being halted due to signaling the exception, the value returned by the associated instruction is undefined. For example, a load from an address of a non-existent memory page can return an undefined value.
The exceptions supported by the HSAIL exception policies are:
The floating-point exponent of a value is too large to be represented. See Floating-Point Rounding.
A non-zero tiny floating-point value is computed and either:
ftzmodifier was specified,
ftzmodifier was not specified and the value cannot be represented exactly.
Division by zero
A finite non-zero floating-point value is divided by zero.
Instructions are performed on values for which the results are not defined. These are:
mul(0.0, infinity) or
fma(0.0, infinity, c) or
fma(infinity, 0.0, c) unless c is a quiet NaN, in which case it is implementation defined if an exception is generated.
add(positive infinity, negative infinity),
sub(positive infinity, positive infinity).
div(0.0, 0.0) or
cvtwith a floating-point source type, an integer destination type, and a nonsaturating rounding mode, when the source value is a NaN, infinity, or the rounded value, after any flush to zero, cannot be represented precisely in the integer type of the destination.
A computed floating-point value is not represented exactly in the destination. This can occur:
ftzmodifier that cause a value to be flushed to zero generate the inexact exception. See Flush to Zero (ftz).
This exception is very common.
In addition, the native floating-point operations may generate exceptions. However, it is implementation defined if, and which, exceptions they generate. For example, the
nlog2 instruction may generate a divide by zero exception when given the value 0.
PDF versions of the specifications are available.
HSA Specification Library
© 2015 HSA Foundation™. All rights reserved.