cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

rotor
Journeyman III

24 bit integer and operations?

Hi all,

I am kind of curious about the 24 bit integer and 24 bit integer operations. On the OpenCL spec doc talk about 24 bit integer but I don't see any datatype keyword for it. Can someone delight me about this stuff?

Additionally, what happens to the CHAR(8bit) and SHORT(16bit) operations? Are they natively supported or they will be executed as a 32 bit operations? or as 24 bit operations?

Thank you,

Roto

0 Likes
9 Replies

currently 8/16 bit operations utilize the 32bit operations at the hardware level. Also the only 24bit ops are in the math library.
0 Likes

Originally posted by: MicahVillmow currently 8/16 bit operations utilize the 32bit operations at the hardware level. Also the only 24bit ops are in the math library.


Thank you Micah. Can you tell me the way to declare 24 bit integer(i.e. keyword)?

0 Likes

There are no 24bit integers, there are only functions that do 24bit operations. see MUL24 and MAD24
0 Likes

Originally posted by: MicahVillmow There are no 24bit integers, there are only functions that do 24bit operations. see MUL24 and MAD24


So I still have to declare my variables as 32bit integers, e.x: int x,y and then the operation mul24(x,y) will take only 24 least significant bits of x and y and feed to the 24-bit multiplier?

If my above assumption is right and also assume that my graphic card natively support 24 bit MUL24(x,y) which is faster than the regular 32 bit multiplication operation (x*y). Then should I use MULT24(x,y) for the 8/16 bit variables for faster performance?

Thank you,

Roto

0 Likes

Yes it will be faster, in the future the code generator will produce mul24/mad24 for 8/16 bit operations when necessary.
0 Likes

Does 8/16 bit variables also take 32 bits at memory level? I.e. does a char take 4 bytes of memory?

What about char[4]? Or char4?

0 Likes

one char/short will IMHO take whole 32bit GPR. but in RAM it will take only one/two bytes.

0 Likes

Nou is correct, in memory a char/short will only take the memory it requires. In a registers however, it is up-converted to 32bits on load and down-converted to the correct type on store.
0 Likes

thanks.

0 Likes