Why does TOSA use signless integer types?

Hi!
There is something confusing about the element types used by TOSA ops.
According to the spec these are the supported types:


So int is either signed int or unsigned int.
In TOSA implementation, we have:

def Tosa_Int8 : I<8>;
def Tosa_Int16 : I<16>;
def Tosa_Int32 : I<32>;
def Tosa_Int48 : I<48>;
def Tosa_Int64 : I<64>;

def Tosa_SignedInt : AnyTypeOf<[Tosa_Int8,
                                Tosa_Int16,
                                Tosa_Int32,
                                Tosa_Int48,
                                Tosa_Int64]>;

Here we actually have signless integer because we use:

// Signless integer type of a specific width.
class I<int width>

I would expect it to use:

// Signed integer type of a specific width.
class SI<int width>

Can someone elaborate on the decision to use signless types? It will make things clearer for me.

Thanks in advance,
Maya

I don’t know if this is going to make it clearer, but when we first created the TOSA dialect, we used signless by mistake. At the time, the TOSA specification was less clear about the types used, so it was easier to miss. We’ve improved the specification so that it defines the types clearly, but we have not changed the dialect.

I think in practice the situation is not too bad, as the majority of the TOSA integer operators only work on signed values, so the op does carry the signedness interpretation. It’s on my todo list to find a better way to document this, and make sure we update the dialect to be more clear on this subject.

Thanks,
Eric

Thanks for your answer :slight_smile:
Does it mean TOSA will use signed integer type at some point?