weixin_39550258
weixin_39550258
2020-12-06 12:54

New macros for faster node validation checks

The current NODE_VALIDATION_ASSERT machinery is unfortunately kind of a drag on performance, because the use of streams forces us to build error messages even when we are not actually going to throw them. This adds a new macro called NODE_VALIDATION_CHECK, which pushes the explanation strings into the arguments of the macro, allowing them to be evaluated lazily.

This results in a big speedup of node validation for ops which have a lot of checks (like Convolution), and even a measurable improvement on ops that don't (like Add):


Time to construct 1,000,000 nodes
=================================

+------------+-----------------+----------------+
|            |  With old macros| With new macros|
|Op          |       Time (sec)|      Time (sec)|
+------------+-----------------+----------------+
|Add         |             5.2 |            3.4 |
|Convolution |            36.4 |            4.8 |
+------------+-----------------+----------------+

The underlying mechanism could eventually be used to replace NGRAPH_ASSERT as well.

该提问来源于开源项目:NervanaSystems/ngraph

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39550258 weixin_39550258 5月前

    BTW: we can do more ops in a follow-on PR. Wanted to do just the minimum to demonstrate that this was beneficial.

    点赞 评论 复制链接分享
  • weixin_39550258 weixin_39550258 5月前

    TESTNOW

    点赞 评论 复制链接分享
  • weixin_39605347 weixin_39605347 5月前

    Strange failure

    
    OutOfMemoryOrKill-9
    
    detect hudson status 137 which indicates an out-of-memory condition has been encountered
    Indication 1 
    
    点赞 评论 复制链接分享
  • weixin_39605347 weixin_39605347 5月前

    Rebuilding python-ci

    点赞 评论 复制链接分享

相关推荐