aihwkit icon indicating copy to clipboard operation
aihwkit copied to clipboard

synaptic bit-slicing

Open saba-er opened this issue 3 years ago • 4 comments

Hi, I was wondering if and how synaptic bit-slicing is supported by the simulator? For example, the needed weight precision is 4 bits but the device only supports 2 bits and hence you need to use 2 devices per synaptic weight. Then, the analog computation (e.g. multiplication) will take into account the fact that the two devices combined represent a single weight (might be partially handled in the digital periphery?).

saba-er avatar Sep 15 '21 13:09 saba-er

Hi @SaBaKa2020 , thanks again! Currently, the simulator does not do bit-slicing in the way you are describing it by default, however, this is definitely on our roadmap to add tools to support that in a convenient way. With the VectorUnitCell multiple devices per crosspoint can be used, as well as a significance factor, however, the currents would always be added up "in analog" i.e. before the ADC.

Having said this, it is actually very easy to build your own bit slicing layer that sums the outputs of the weight slices in digital: You could just define an new module (e.g. AnalogLinearBitSlicing) that internally has two analog tiles, e.g. linear_1 = AnalogLinear() and linear_2 = AnalogLinear() and combine the output in the forward method, e.g. y = linear_1(x) + factor * linear_2(x). In case you would implement it in this way, we would highly appreciate if you would contribute it to the toolkit by making pull request!

maljoras avatar Sep 15 '21 15:09 maljoras

Hi @SaBaKa2020 , thanks again! Currently, the simulator does not do bit-slicing in the way you are describing it by default, however, this is definitely on our roadmap to add tools to support that in a convenient way. With the VectorUnitCell multiple devices per crosspoint can be used, as well as a significance factor, however, the currents would always be added up "in analog" i.e. before the ADC.

@maljoras, can a VectorUnitCell setup be combined with, say, InferenceRPUConfig in the sense of rpu_config contains a vector of devices -> with each device is (inference only w/ a given noise model) contributing a part of the full weight. In other words, can we achieve this bit-slicing within an inference only setup?

I could not find an example describing such a usage, only this example.

HeatPhoenix avatar Mar 11 '24 09:03 HeatPhoenix

Opened a pull request in #631 to hopefully help implement this and solve this issue.

HeatPhoenix avatar Mar 27 '24 10:03 HeatPhoenix