|Re: [eigen] Optimizing Eigen::Tensor operations for tiny level 1 cache|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>, Eugene Zhulenev <ezhulenev@xxxxxxxxxx>
- Subject: Re: [eigen] Optimizing Eigen::Tensor operations for tiny level 1 cache
- From: Rasmus Munk Larsen <rmlarsen@xxxxxxxxxx>
- Date: Tue, 28 May 2019 10:39:55 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=fu9jQ9LGSH19zHjaDiKTkDRFFThr0Jy4i0r0A0OvK2o=; b=RVLYZcAwehHa54kRIS7o3BeY1UnWmUWQT4Whp/3BLXdwKNCX42kIhw3YXfEH7GnSnF URczxO/CAn2UXxRM1lcczgMDOuTBgZ5sRlz4aFXES1c8CW1BU4sCGdxeJTpsHBMrUWH4 0ASigsGY/aMaGz0wmXnzTfOEMnUSgjl3kLB48BdgckLfGFpRp2eBm3kEwxTskm2IAAwq 6l5LfaDm85Cwcya0k4NZPNUiiodUcUr4n9w1UstLkWs0JbCF1LmzxDcuTrqhH14was/o sDY0EtI8NITtjMnR42hLVHbxbzpwKe8mier/E21dphPRciKN1RRjIA+dFe1ZdJLlgTPR gUEA==
The way to optimize the tensor library for hardware with limited cache sizes would be to
1. Reduce the size of the buffer used for the ".block()" interface. I believe we currently try to fit them in L1, but perhaps the detection doesn't work correctly on your hardware.
2. Reduce the block sizes used in TensorContraction.
1. By default the blocksize is chosen such that the blocks fits in L1:
Each evaluator in an _expression_ reports how scratch memory it needs to compute a block's worth of data through the getResourceRequirements() API, e.g.:
These values are then merged by the the executor in the calls here:
2. The tensor contraction blocking uses a number of heuristics to choose block sizes and level of parallelism. In particular, it tries to pack the lhs into L2, and rhs into L3.
I hope these pointers help.
I'm currently using the Eigen::Tensor module on a relatively small processors which has very limited cache, 16KB level 1 no level 2 at all! I've been looking for any way to optimise the blocking of operations performed by Eigen for a particular block size but I can't find anything so far.
Is there a way to optimise the Tensor operations for this type of small cache?