Actions

icon Post
text/html Subscribe
text/html Unsubscribe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] enable use of refcount policy for ext_data


  • To: VSIPL++ Developers List <vsipl++@xxxxxxxxxxxxxxxx>
  • Subject: [patch] enable use of refcount policy for ext_data
  • From: Jules Bergmann <jules@xxxxxxxxxxxxxxxx>
  • Date: Wed, 28 Sep 2005 15:07:31 -0400

Comparing our vector-add performance (using IPP) against IPP directly showed that we had some overhead for small vector sizes (for vector sizes less than 1024 elements, our red line falls below IPP's green line). This overhead appears to be from incrementing and decrementing reference counts for the blocks being used. This is being done by Ext_data when getting a pointer to the block's data to pass to IPP. Ext_data takes a policy template parameter to indicate whether reference counting should be done, but it was being ignored and reference counting always done.

This patch adds a mechanism to View_block_storage to hold a reference using according to a reference-counting policy.

With this patch, our performance (blue line) is closer to IPP for small vector sizes.

Patch applied.

				-- Jules
Index: ChangeLog
===================================================================
RCS file: /home/cvs/Repository/vpp/ChangeLog,v
retrieving revision 1.279
diff -c -p -r1.279 ChangeLog
*** ChangeLog	28 Sep 2005 04:33:34 -0000	1.279
--- ChangeLog	28 Sep 2005 18:52:21 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2005-09-28  Jules Bergmann  <jules@xxxxxxxxxxxxxxxx>
+ 
+ 	* src/vsip/impl/block-traits.hpp (View_block_storage):
+ 	  Add 'With_rp' template typedef to specify ref-count policy.
+ 	* src/vsip/impl/extdata.hpp: Use View_block_storage::With_rp to
+ 	  apply ref-count policy for block being held.
+ 
  2005-09-27  Nathan Myers  <ncm@xxxxxxxxxxxxxxxx>
  
  	* tests/extdata-fft.cpp, tests/fft.cpp, tests/fftm-par.cpp,
Index: src/vsip/impl/block-traits.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/impl/block-traits.hpp,v
retrieving revision 1.13
diff -c -p -r1.13 block-traits.hpp
*** src/vsip/impl/block-traits.hpp	15 Sep 2005 11:14:57 -0000	1.13
--- src/vsip/impl/block-traits.hpp	28 Sep 2005 18:52:21 -0000
*************** struct By_ref_block_storage
*** 49,54 ****
--- 49,60 ----
    typedef Ref_counted_ptr<Block> type;
    typedef Block&                 plain_type;
    typedef Block const&           expr_type;
+ 
+   template <typename RP>
+   struct With_rp
+   {
+     typedef RPPtr<Block, RP> type;
+   };
  };
  
  template <typename Block>
*************** struct By_value_block_storage
*** 57,62 ****
--- 63,74 ----
    typedef Stored_value<Block> type;
    typedef Block               plain_type;
    typedef Block               expr_type;
+ 
+   template <typename RP>
+   struct With_rp
+   {
+     typedef Stored_value<Block> type;
+   };
  };
  
  template <typename Block>
Index: src/vsip/impl/extdata.hpp
===================================================================
RCS file: /home/cvs/Repository/vpp/src/vsip/impl/extdata.hpp,v
retrieving revision 1.14
diff -c -p -r1.14 extdata.hpp
*** src/vsip/impl/extdata.hpp	16 Sep 2005 22:03:20 -0000	1.14
--- src/vsip/impl/extdata.hpp	28 Sep 2005 18:52:21 -0000
*************** public:
*** 711,717 ****
  
    // Member data.
  private:
!   typename View_block_storage<Block>::type blk_;
    ext_type         ext_;
    sync_action_type sync_;
  };
--- 711,718 ----
  
    // Member data.
  private:
!   typename View_block_storage<Block>::template With_rp<RP>::type
! 		   blk_;
    ext_type         ext_;
    sync_action_type sync_;
  };
*************** public:
*** 768,774 ****
  
    // Member data.
  private:
!   typename View_block_storage<Block>::type blk_;
    ext_type         ext_;
    sync_action_type sync_;
  };
--- 769,776 ----
  
    // Member data.
  private:
!   typename View_block_storage<Block>::template With_rp<RP>::type
! 		   blk_;
    ext_type         ext_;
    sync_action_type sync_;
  };

PNG image