extend zet_value_t to support unsigned 8- and 16- bit integer types #286
Open
Description
Summary
Some tools produce unsigned values that use only one or two bites but L0 specification does not have that resolution on the union for results. Therefore, the proposal is to extend zet_value_t to support them. Note that zet_value_type_t already supports ZET_VALUE_TYPE_UINT8 and ZET_VALUE_TYPE_UINT16
https://spec.oneapi.io/level-zero/latest/tools/api.html#_CPPv411zet_value_t
https://spec.oneapi.io/level-zero/latest/tools/api.html#_CPPv416zet_value_type_t
Details
Motivation
Support tools that returns one and/or two bites results without casting to bigger result type.
Interoperability with Other APIs
N/A
Proposed APIs
N/A
New Enumerations
Extend zet_value_t
/// @brief Union of values
typedef union _zet_value_t
{
uint8_t ui8; ///< [out] 8-bit unsigned-integer
uint16_t ui16; ///< [out] 16-bit unsigned-integer
uint32_t ui32; ///< [out] 32-bit unsigned-integer
uint64_t ui64; ///< [out] 64-bit unsigned-integer
float fp32; ///< [out] 32-bit floating-point
double fp64; ///< [out] 64-bit floating-point
ze_bool_t b8; ///< [out] 8-bit boolean
} zet_value_t;
Usage example
extend https://spec.oneapi.io/level-zero/latest/tools/PROG.html#calculation to support uint8_t and uint16_t
switch( data.type )
{
case ZET_VALUE_TYPE_UINT8:
printf(" Value: %u", data.value.ui8 );
break;
case ZET_VALUE_TYPE_UINT16:
printf(" Value: %u", data.value.ui16 );
break;
case ZET_VALUE_TYPE_UINT32:
printf(" Value: %un", data.value.ui32 );
break;
case ZET_VALUE_TYPE_UINT64:
printf(" Value: %llun", data.value.ui64 );
break;
case ZET_VALUE_TYPE_FLOAT32:
printf(" Value: %fn", data.value.fp32 );
break;
case ZET_VALUE_TYPE_FLOAT64:
printf(" Value: %fn", data.value.fp64 );
break;
case ZET_VALUE_TYPE_BOOL8:
if( data.value.ui32 )
printf(" Value: true\n" );
else
printf(" Value: false\n" );
break;
default:
break;
};
Metadata
Assignees
Labels
Type
Projects
Status
Todo