NVlabs / timeloop

Timeloop performs modeling, mapping and code-generation for tensor algebra workloads on various accelerator architectures.
https://timeloop.csail.mit.edu/
BSD 3-Clause "New" or "Revised" License
325 stars 101 forks source link

Tile size #122

Closed nivi1501 closed 2 years ago

nivi1501 commented 2 years ago

Hi, How to estimate the tile size of an output feature map, weights, and ifmap using the mapper function? I wish to estimate the tile size generated in a single loop iteration (wrt DRAM). Suppose I get the following mapping from timeloop: { target = 0; type = "temporal"; factors = "C1 K1 R11 S1 P1 Q1"; permutation = "RCKSPQ"; }, { target = 1; type = "spatial"; factors = "C1 K16 R1 S1 P1 Q11"; permutation = "QKCRSP"; split = 1; }, { target = 1; type = "temporal"; factors = "C1 K1 R1 S11 P1 Q1"; permutation = "SCKRPQ"; }, { target = 2; type = "temporal"; factors = "C3 K6 R1 S1 P55 Q5"; permutation = "PQCKRS"; } Tile size for the output=55x5X6. I am not sure about this. Can anyone please help me out?

angshuman-parashar commented 2 years ago

Are you interested in the tile size at a particular memory level, or the delta size (i.e., the set-difference between tiles at time t and t+1)? If it's the former then the output mapping in timeloop-mapper.map.txt or timeloop-model.map.txt shows you that information for each storage level, e.g., lines 2, 6 and 13 in https://github.com/Accelergy-Project/timeloop-accelergy-exercises/blob/master/workspace/exercises/2020.ispass/timeloop/04-model-conv1d%2Boc-3levelspatial/ref-output/cp/timeloop-model.map.txt

nivi1501 commented 2 years ago

Thanks for the response, how can we compute delta size?

angshuman-parashar commented 2 years ago

In general it may change from iteration to iteration, and may also depend on the state of ancestor loops. You can reason about it manually by computing the tensor tiles corresponding to two specific consecutive iterations of any loop, and then calculating the set-difference between them. If you haven't done so already, we strongly recommend watching and working through one of our tutorials, that will help you build a strong intuitive foundation.

nivi1501 commented 2 years ago

Thanks a lot :)