cutlass icon indicating copy to clipboard operation
cutlass copied to clipboard

[QST] Any support or examples of uint1_t x int1_t GEMM?

Open Akimoto-Cris opened this issue 3 years ago • 5 comments

Is b1 x b1 GEMMs all implemented by XOR that requires uint1_t x uint1_t ? What if A=uint1_t and B=int1_t ? (e.g. A is ReLU output, B is weight)

Thanks in advance.

Akimoto-Cris avatar Jun 20 '22 08:06 Akimoto-Cris

Is b1 x b1 GEMMs all implemented by XOR that requires uint1_t x uint1_t ?

We supports both xor_popc and and_popc. See this one https://github.com/NVIDIA/cutlass/blob/master/include/cutlass/arch/mma_sm80.h#L2017 and this one https://github.com/NVIDIA/cutlass/blob/master/include/cutlass/arch/mma_sm80.h#L2084

What if A=uint1_t and B=int1_t ?

signed int1_t is impossible. sign bit would take the only available bit and you have no place to store the data.

hwu36 avatar Jun 23 '22 03:06 hwu36

Hi @hwu36 , I've seen works that use signed representation, e.g., Xnor-net: Imagenet classification using binary convolutional neural networks, who signed representation for both X and W and supposedly uses XNOR-Bitcount op for conv. So I think signed 1-bit W is a realistic scenario.

Akimoto-Cris avatar Jun 23 '22 05:06 Akimoto-Cris

Maybe it is a question to the paper author. I don't know how to pack signed bit and data bit into 1 bit. xoring with signed bit also sounds strange to me. Maybe they used 0 to represent -1? If so, that's customized data representation.

hwu36 avatar Jun 23 '22 13:06 hwu36

Check this post https://sushscience.wordpress.com/2017/10/01/understanding-binary-neural-networks/. They do use 0 to represent -1. But I suspect current xor_popc and and_popc will work on such "bipolar binary". This project seems implement xnor_popc for that: https://github.com/Xilinx/finn/issues/31

Akimoto-Cris avatar Jun 23 '22 16:06 Akimoto-Cris

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Aug 04 '22 14:08 github-actions[bot]