You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2020/10/23 19:26:30 UTC

[GitHub] [incubator-mxnet] Zha0q1 opened a new pull request #19419: [wip] CPU reduce kernel optimization

Zha0q1 opened a new pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419


   will add description soon


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715588614


   ```c++
   template<typename Reducer, int ndim, typename AType, typename DType, typename OType, typename OP,
            typename IndexOP = mxnet::op::mshadow_op::set_index_no_op<AType, index_t>>
   MSHADOW_XINLINE AType seq_reduce_assign_block(size_t start, size_t len,
                                                 size_t j,
                                                 const DType* __restrict big,
                                                 const Shape<ndim>& rshape,
                                                 const Shape<ndim>& rstride) {
     Shape<ndim> coord;
     AType val, residual;
     Reducer::SetInitValue(val, residual);
     for (size_t k = start; k < start + len; ++k) {
       coord = mxnet_op::unravel(k, rshape);
       AType temp = OP::Map(big[j + mxnet_op::dot(coord, rstride)]);
       if (IndexOP::do_op)
         IndexOP::Op(&temp, k);
       Reducer::Reduce(val, temp, residual);
     }
     Reducer::Finalize(val, residual);
     return val;
   }
   ```
   
   So here I can also get rid of `Reducer::Finallize` and return both `val` and 'residual' and use `Reducer::Merge` rather than `Reducer::Reduce` in `seq_reduce_assign`. This is more rigorous but is also more expensive (~5%). However the accuracy does not seem to differ by much so I use the current solution. My initial commit has the `Reducer::Merge` implementation for reference.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-716716004


   @sandeep-krishnamurthy @szha @sxjscience 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-716850896


   @mxnet-bot run ci [windows-gpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715624877


   @mxnet-bot run ci [unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715626168


   Jenkins CI successfully triggered : [unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 merged pull request #19419: CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 merged pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715606961


   @mxnet-bot run ci [miscellaneous, unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 edited a comment on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 edited a comment on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715588614


   ```c++
   template<typename Reducer, int ndim, typename AType, typename DType, typename OType, typename OP,
            typename IndexOP = mxnet::op::mshadow_op::set_index_no_op<AType, index_t>>
   MSHADOW_XINLINE AType seq_reduce_assign_block(size_t start, size_t len,
                                                 size_t j,
                                                 const DType* __restrict big,
                                                 const Shape<ndim>& rshape,
                                                 const Shape<ndim>& rstride) {
     Shape<ndim> coord;
     AType val, residual;
     Reducer::SetInitValue(val, residual);
     for (size_t k = start; k < start + len; ++k) {
       coord = mxnet_op::unravel(k, rshape);
       AType temp = OP::Map(big[j + mxnet_op::dot(coord, rstride)]);
       if (IndexOP::do_op)
         IndexOP::Op(&temp, k);
       Reducer::Reduce(val, temp, residual);
     }
     Reducer::Finalize(val, residual);
     return val;
   }
   ```
   
   So here I can also get rid of `Reducer::Finallize` and return both `val` and 'residual' and use `Reducer::Merge` rather than `Reducer::Reduce` in `seq_reduce_assign`. 
   ```c++
       for (int i = 0; i < thread_count; ++i) {
         //Reducer::Reduce(val, vals[i], residual);
         Reducer::Merge(val, vals[i], residual, residuals[i]);
       }
   ```
   This is more rigorous but is also more expensive (~5%). However the accuracy does not seem to differ by much so I use the current solution. My initial commit has the `Reducer::Merge` implementation for reference.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 edited a comment on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 edited a comment on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715588614


   ```c++
   template<typename Reducer, int ndim, typename AType, typename DType, typename OType, typename OP,
            typename IndexOP = mxnet::op::mshadow_op::set_index_no_op<AType, index_t>>
   MSHADOW_XINLINE AType seq_reduce_assign_block(size_t start, size_t len,
                                                 size_t j,
                                                 const DType* __restrict big,
                                                 const Shape<ndim>& rshape,
                                                 const Shape<ndim>& rstride) {
     Shape<ndim> coord;
     AType val, residual;
     Reducer::SetInitValue(val, residual);
     for (size_t k = start; k < start + len; ++k) {
       coord = mxnet_op::unravel(k, rshape);
       AType temp = OP::Map(big[j + mxnet_op::dot(coord, rstride)]);
       if (IndexOP::do_op)
         IndexOP::Op(&temp, k);
       Reducer::Reduce(val, temp, residual);
     }
     Reducer::Finalize(val, residual);
     return val;
   }
   ```
   
   So here I can also get rid of `Reducer::Finallize` and return both `val` and `residual` and use `Reducer::Merge` rather than `Reducer::Reduce` in `seq_reduce_assign`. 
   ```c++
       for (int i = 0; i < thread_count; ++i) {
         //Reducer::Reduce(val, vals[i], residual);
         Reducer::Merge(val, vals[i], residual, residuals[i]);
       }
   ```
   This is more rigorous but is also more expensive (~5%). However the accuracy does not seem to differ by much so I use the current solution. My initial commit has the `Reducer::Merge` implementation for reference.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715537240


   Hey @Zha0q1 , Thanks for submitting the PR 
   All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands: 
   - To trigger all jobs: @mxnet-bot run ci [all] 
   - To trigger specific jobs: @mxnet-bot run ci [job1, job2] 
   *** 
   **CI supported jobs**: [windows-gpu, sanity, website, windows-cpu, centos-gpu, unix-cpu, unix-gpu, miscellaneous, edge, centos-cpu, clang]
   *** 
   _Note_: 
    Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin. 
   All CI tests must pass before the PR can be merged. 
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715646765


   Jenkins CI successfully triggered : [unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715624896


   Jenkins CI successfully triggered : [unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19419: CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-716850919


   Jenkins CI successfully triggered : [windows-gpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] mxnet-bot commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
mxnet-bot commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715606987


   Jenkins CI successfully triggered : [unix-cpu, miscellaneous]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715646753


   @mxnet-bot run ci [unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] Zha0q1 commented on pull request #19419: [wip] CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
Zha0q1 commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-715626147


   @mxnet-bot run ci [unix-cpu]


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-mxnet] sandeep-krishnamurthy commented on pull request #19419: CPU reduce kernel optimization

Posted by GitBox <gi...@apache.org>.
sandeep-krishnamurthy commented on pull request #19419:
URL: https://github.com/apache/incubator-mxnet/pull/19419#issuecomment-716745488


   Great work.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org