This is a test plan for the changes in APIs described in SYCL 2020 compared to SYCL 1.2.1 relating to mathematical, integer, common, geometric, and relational functions.
Estimated development time is six days.
Tests intend to extend partial to full coverage for:
-
4.17.2. Function objects
-
4.17.5. Math functions
-
4.17.6. Integer functions
-
4.17.7. Common functions
-
4.17.8. Geometric functions
-
4.17.9. Relational functions
Device coverage does not change. All of the tests described below are performed only on the default device that is selected on the CTS command line.
Most of the tests are extensions of the existing tests to new marray
types. The system of types
coverage is coded in Python code generators therefore these type generators will be extended to cover
full Table 165. Generic type name description, which serves as a description for all valid types
of parameters to kernel functions.
More specifically, new marray
types will be introduced with 1, 2, 3, 4, 5, and 17 elements and
they will be added to the following generic type names (this will extend also more generic names):
Generic type name | Description |
---|---|
|
float{n}, mfloat{n}, marray<{N},float> |
|
double{n}, mdouble{n}, marray<{N},double> |
|
half{n}, mhalf{n}, marray<{N},half> |
|
marray<float,{N}>, marray<double,{N}>, marray<half,{N}> |
|
float, float2, float3, float4, mfloat2, mfloat3, mfloat4 |
|
double, double2, double3, double4, mdouble2, mdouble3, mdouble4 |
|
char{n}, mchar{n}, marray<{N},char> |
|
schar{n}, mschar{n}, marray<{N},signed char> |
|
uchar{n}, muchar{n}, marray<{N},unsigned char> |
|
short{n}, mshort{n}, marray<{N},short> |
|
ushort{n}, mushort{n}, marray<{N},unsigned short> |
|
uint{n}, muint{n}, marray<{N},unsigned int> |
|
int{n}, mint{n}, marray<{N},int> |
|
ulong{n}, mulong{n}, marray<{N},unsigned long int> |
|
long{n}, mlong{n}, marray<{N},long int> |
|
ulonglong{n}, mulonglong{n}, marray<{N},unsigned long long int> |
|
longlong{n}, mlonglong{n}, marray<{N},long long int> |
|
marray<signed char,{N}>, marray<short,{N}>, marray<int,{N}>, marray<long,{N}>, marray<long long,{N}> |
|
marray<unsigned char,{N}>, marray<unsigned short,{N}>, marray<unsigned int,{N}>, marray<unsigned long int,{N}>, marray<unsigned long long int,{N}> |
|
marray<char,{N}>, migeninteger, mugeninteger |
|
mgenfloat, mgeninteger |
|
marray<{N},bool> |
|
bool, booln |
If the device has aspect::fp64
, double
type is tested, and
if the device has aspect::fp16
, sycl::half
type is tested.
Reference templated implementations for marray
functions will be added to sycl-cts/util/math_reference.h
.
The function objects are already tested in CTS in reduction
tests. The only aspect non-tested is
their <void>
specializations that are transparent function objects which deduce their parameter types and return type.
Then the test will check that C++ conversion and promotion rules are satisfied for <void>
specializations
of the function objects.
marray
tests will be added to every function from Table 175. Math functions which work on SYCL host and device.
marray
tests will be added to every function from Table 178. Integer functions which work on SYCL host and device,
are available in the sycl namespace. Additionally some problems in existing tests should be fixed and new tests added:
-
Reference implementation of
template <typename T, int N, typename R = typename std::make_unsigned_t<T>> sycl::vec<R, N> abs(sycl::vec<T, N> a)
should returnT
, notR
following Table 178 definition. -
Reference implementation of
template <typename T> T abs_diff(T a, T b)
should returntypename R = typename std::make_unsigned_t<T>
instead following Table 178 definition. Implementation should be updated to avoid overflow and UB. -
New function test for
geninteger ctz(geninteger x)
should be introduced along with reference implementation. -
Reference implementations of
mad24
andmul24
should be extended to cover full ranges for multipliers defined by specification.
marray
tests will be added to every function from Table 179. Common functions which work on SYCL host and device,
are available in the sycl namespace. Additionally some problems in existing tests should be fixed and new tests added:
-
Reference implementations of
genfloat degrees(genfloat radians)
,genfloat radians(genfloat degrees)
,genfloat smoothstep(genfloat edge0, genfloat edge1, genfloat x)
, andgenfloat sign(genfloat x)
withsycl::half
should be added. -
Reference implementations of
genfloat max(genfloat x, genfloat y)
andgenfloat min (genfloat x, genfloat y)
should be fixed to provide correct undefined return value behavior (if any input is infinite or NaN). -
Reference implementation of
genfloat mix(genfloat x, genfloat y, genfloat a)
withsycl::half
should be added.
marray
tests will be added to the following functions from Table 180. Geometric functions which work on SYCL host and device,
are available in the sycl namespace:
Geometric Function | Description |
---|---|
|
Returns the cross product of first 3 components of p0 and p1. The 4th component of result returned will be 0.0. |
|
Compute dot product. |
|
Returns the distance between p0 and p1. This is calculated as length(p0 - p1). |
|
Return the length of vector p, i.e., \(\sqrt{ p.x^2 + p.y^2 + ...}\) |
|
Returns a vector in the same direction as p but with a length of 1. |
|
Returns fast_length(p0 - p1). |
|
Returns the length of vector p computed as: sqrt((half)(pow(p.x,2) + pow(p.y,2) + ...)) |
|
Returns a vector in the same direction as p but with a length of 1. fast_normalize is computed as: p*rsqrt((half)(pow(p.x,2) + pow(p.y,2) + ... )) The result shall be within 8192 ulps error from the infinitely precise result of
with the following exceptions:
|
Additionally some problems in existing tests should be fixed and new tests added:
-
Reference implementation of
template <typename T> T normalize(T p)
should be fixed for scalar types to provide -1 for negative values. -
Reference implementations of
float fast_distance(gengeofloat p0, gengeofloat p1)
,float fast_length(gengeofloat p)
, andgengeofloat fast_normalize(gengeofloat p)
should be fixed to follow spec definitions.
The following realtional functions for sycl::half
inputs should be provided with tests
like already present ones for float
and double
:
Relational Function | Description |
---|---|
|
Returns the component-wise compare of x == y. |
|
Returns the component-wise compare of x != y. |
|
Returns the component-wise compare of x > y. |
|
Returns the component-wise compare of x >= y. |
|
Returns the component-wise compare of x < y. |
|
Returns the component-wise compare of x <= y. |
|
Returns the component-wise compare of (x < y) || (x > y). |
|
Test for finite value. |
|
Test for infinity value (positive or negative) . |
|
Test for a NaN. |
|
Test for a normal value. |
|
Test if arguments are ordered. isordered() takes arguments x and y, and returns the result isequal(x, x) && isequal(y, y). |
|
Test if arguments are unordered. isunordered() takes arguments x and y, returning non-zero if x or y is NaN, and zero otherwise. |
|
Test for sign bit. Returns the following for each component in x: -1 (i.e all bits set) if the sign bit in the component value is set else returns 0. |
Reference implementations for the scalar input functions should be fixed to provide
correct bool
output, and marray
tests should be added for the marray
input functions
of the following table:
Relational Function | Description |
---|---|
|
Returns the component-wise compare of x == y. |
|
Returns the component-wise compare of x != y. |
|
Returns the component-wise compare of x > y. |
|
Returns the component-wise compare of x >= y. |
|
Returns the component-wise compare of x < y. |
|
Returns the component-wise compare of x <= y. |
|
Returns the component-wise compare of (x < y) || (x > y). |
|
Test for finite value. |
|
Test for infinity value (positive or negative) . |
|
Test for a NaN. |
|
Test for a normal value. |
|
Test if arguments are ordered. isordered() takes arguments x and y, and returns the result isequal(x, x) && isequal(y, y). |
|
Test if arguments are unordered. isunordered() takes arguments x and y, returning true if x or y is NaN, and false otherwise. |
|
Test for sign bit, returning true if the sign bit in x is set, and false otherwise. |
|
Returns true if the most significant bit in any component of x is set; otherwise returns false. |
|
Returns true if the most significant bit in all components of x is set; otherwise returns false. |
|
Each bit of the result is the corresponding bit of a if the corresponding bit of c is 0. Otherwise it is the corresponding bit of b. |
|
Returns the component-wise result = c ? b : a. |