Coder Social home page Coder Social logo

fastconv's Introduction

fastconv

Reading this post from Pete Warden, which in short describes a way to convert a 3D tensor convolution operation into a 2D GEneral Matrix to Matrix Multiplication (GEMM), I wondered if this could apply to 2D matrix convolution.

This little project aims at verifying this hypothesis, using two different matrix implementations : one static allocation matrix container and one dynamic allocation matrix container, respectively based on std::array and std::vector private inheritance.

Static allocation matrix container

Int this case the compiler is aware of loop sizes and allocation sizes at compile time. Therefore in this case it seems hard to beat the standard implementation.

Testing this scenario required to increase the allowed stack size for the application, in order to have measures on big enough matrix (250Mb stack size to test on 1500x1500 matrix).

Dynamic allocation matrix container

Here the time spent to build the im2col/Toeplitz matrix is counterbalanced with the reduced time to operate the mulitply/add operations related to GEMM. The latter process can be efficiently vectorized using appropriate SIMD intrinsics.

First preliminary results show an average 20% gain in computation time compared to the standard implementation.

fastconv's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

fastconv's Issues

Question on the project

What's the difference between the function 'convolve' and 'fast_convolve'? And where to use the function 'multiply'?
I thought the project is to show the efficiency of three convolution implementation 'convolve', 'fast_convolve' and im2col matrix 'multiply'.
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.