Skip to content
Snippets Groups Projects

Refactoring Tensor

Closed laurent soulier requested to merge fix/TensorPIMPL into main

Adding context to Tensor
Adding "active area" to Tensor
Forward declaring TensorImpl in Tensor instead of the another way around
CPU storage is unsigned char instead of void *
todo: memory location for device different than CPU
todo: a Tensor can share a TensorImpl with another Tensor
TensorImpl = storage
Tensor = view on storage

Notes:

  • Tensor::getImpl() returns a reference not a pointer, thus client code must replace getImpl()-> by getImpl().
  • Tensor.hpp does not includes backend\TensorImpl.hpp but backend\TensorImpl.hpp includes Tensor.hpp. Thus client code needs to include backend\TensorImpl.hpp (with or without Tensor.hpp)
Edited by laurent soulier

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Cyril Moineau
  • Cyril Moineau
  • The merge is hard to read due to a lot of formating changes, it is hard to see what is just formating what has changed. I may have missed some changes. I think other reviewers are recquired, @pineapple, @vtemplier.

    The TensorView feature is not implemented as discussed between us. Instead it was added in the Tensor object which increase its complexity. I fear that this merge request decrease the maintanability of the Tensor object.

    Some added methods are not very clear on what they do (getFirstDataCoord).

    I do not understand exactly what MakeInteger.hpp does, is it really necessary ?

    Naming convention is not respected with multiple method begining with uppercase.

  • Author Contributor

    clang-format related change: no better move than sharing the .clang-format file...

    TensorView: !13 (comment 1223010)
    Discussing more on this point will not bring tiling faster.

    naming conventions and documentation clarification request noted and wip.

    MakeInteger is used to deduce, in aidge context, types from std::size_t. There is no function id STL to say "I want a type whos size is half the size of another one", or "one byte less than...". MakeInteger can do that.

  • laurent soulier added 2 commits

    added 2 commits

    • fab26c43 - [MIN][DOX] renaming wrt to implicit naming convention
    • 4f6757a1 - [IMPR] Removing a python-binding only function from C++ API and make it a...

    Compare with previous version

  • laurent soulier added 2 commits

    added 2 commits

    • bd427aa7 - [FIX] fixed typo in runHooks
    • ac44f114 - [UT] Use all unit-tests by default

    Compare with previous version

  • Author Contributor

    Comments answered. Corresponding update pushed and passed the CI.

  • You have, in TensorImpl, the following member variables:

    std::vector<DimSize_t> mvDimensions;
    std::vector<std::size_t> mvLayout;
    Byte_t *mStorage = nullptr;
    std::vector<Coord_t> mvFirstDataCoordinates;

    In Tensor, you have:

    std::vector<DimSize_t> mDims;

    Why keep mDims in Tensor? Itsn't it redondant with mvDimensions? More generally, I do not understand the separation between Tensor and TensorImpl. It feels like you could have put what is in TensorImpl in Tensor and keep TensorImpl a pure abstract class.

  • Author Contributor

    No, please read again above discussion.
    I may have underdocument the notion of active area in the code which I may fix. mDims are the dimension of the active area, mvDimensions, those of the storage.
    I've got a slideware somewhere that illustrate that, I will try to retrieve it and upload it here.tensor_english.pdf

    Edited by laurent soulier
  • Then why isn't mvFirstDataCoordinates in Tensor? It seems like you would need that in order to generate different views to the same TensorImpl?

    Edited by Olivier BICHLER
  • Author Contributor

    You're right, same thing there should be also a First Data Coordinates in Tensor in order to define the position of the active area. If it fell under the radar, as it is not in unit-tests yet, I propose to add it in the next MR.

  • laurent soulier added 22 commits

    added 22 commits

    Compare with previous version

  • laurent soulier added 1 commit

    added 1 commit

    • 3debb70b - [FIX][TBV] trying a fix for an issue with clang 9 to 14

    Compare with previous version

  • laurent soulier added 32 commits

    added 32 commits

    Compare with previous version

  • mentioned in issue #42 (closed)

  • laurent soulier added 2 commits

    added 2 commits

    • e2eda56e - [FUN][IMPR] Adding TensorImpl cloning for cleaner Tensor copy
    • f3ab1b2e - [IMPR][MAJ] removing reference to Tensor object inside TensorImpl and improving creation interface

    Compare with previous version

  • laurent soulier added 21 commits

    added 21 commits

    Compare with previous version

  • mentioned in issue #38 (closed)

  • laurent soulier added 1 commit

    added 1 commit

    • 40934b09 - [FIX] fixing some issues detected with msvc.

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading