[pooma-dev] AltView* classes

James Crotinger jcrotinger at proximation.com
Tue Mar 2 16:10:37 UTC 2004


Hi Richard,

This tickled a neuron the other day, but I couldn't recall the details.

The AltView classes were put in to reduce link times and sizes for large
codes. The classes that have enums end up having a link-time cost, both in
space and time. I believe this refactoring was done to reduce the
cardinality of classes having the "sv" enum. My recollection is that this,
and other similar "optimizations", had a pretty substantial impact on
link-time for Blanca. Unless these are hurting something else, I would tend
to leave them in. 

Does the CodeSourcery CVS repository have complete CVS history? (i.e. did we
copy the repository, or just the head version?) This should have been easy
to determine via CVS. 

	Jim

------------------------------------------------------------------------
James A. Crotinger                           email:     jimc at numerix.com
NumeriX, LLC                                 phone:  (505) 424-4477 x104
2960 Rodeo Park Dr. W.
Santa Fe, NM 87505
 

> -----Original Message-----
> From: Richard Guenther [mailto:rguenth at tat.physik.uni-tuebingen.de]
> Sent: Tuesday, March 02, 2004 3:29 AM
> To: pooma-dev at pooma.codesourcery.com
> Cc: Jeffrey D. Oldham
> Subject: Re: [pooma-dev] AltView* classes
> 
> On Tue, 2 Mar 2004, Richard Guenther wrote:
> 
> > On Fri, 27 Feb 2004, Richard Guenther wrote:
> >
> > > Hi!
> > >
> > > Does anyone remember the exact reason for the existance of the
> AltView*
> > > classes in Array.h and Field.h?  Removing them and fixing their usage
> to
> > > use View* seems to work (full test with gcc 3.3 and 3.4 in progress).
> >
> > Testing completed with no new failures.  Would it be ok to remove those
> > AltView* classes?
> 
> Which would be...
> 
> Ok?
> 
> Richard.
> 
> 
> 2004Mar02  Richard Guenther <richard.guenther at uni-tuebingen.de>
> 
> 	* src/Array/Array.h: remove all traces of AltView0 class.
> 	src/Field/Field.h: remove all traces of AltView1 and
> 	AltView1Implementation classes.
> 
> ===== Array/Array.h 1.14 vs edited =====
> --- 1.14/r2/src/Array/Array.h	Tue Dec 16 15:19:57 2003
> +++ edited/Array/Array.h	Tue Mar  2 11:24:14 2004
> @@ -649,8 +649,6 @@
>  // an existing engine cannot be any kind of slice domain.
>  // Also, bounds checking would make no sense because it would
>  // reduce to contains(a.domain(), a.domain());
> -//
> -// Any changes to this class should also be made to AltView0.
> 
>  template<int Dim, class T, class EngineTag>
>  struct View0<Array<Dim, T, EngineTag> >
> @@ -695,41 +693,6 @@
>      }
>  };
> 
> -// AltView0 avoids an instantiation problem that arises when two
> -// classes use each other.  This class's definition should be exactly
> -// the same as View0 except omitting member functions.
> -//
> -// Do NOT explicitly instantiate this class.
> -
> -template<class ArrayTag>
> -struct AltView0;
> -
> -template<int Dim, class T, class EngineTag>
> -struct AltView0<Array<Dim, T, EngineTag> >
> -{
> -  // Convenience typedef for the thing we're taking a view of.
> -
> -  typedef Array<Dim, T, EngineTag> Subject_t;
> -
> -  // Deduce domains for the output type.
> -  // At some point, we need to fix NewDomain1; until then, use
> -  // the temporary version from Array.h.
> -
> -  typedef typename Subject_t::Engine_t Engine_t;
> -  typedef typename Subject_t::Domain_t Domain_t;
> -
> -  // Deduce the template parameters for the output type.
> -
> -  typedef typename NewEngine<Engine_t, Domain_t>::Type_t NewEngine_t;
> -  enum { newDim = NewEngine_t::dimensions };
> -  typedef typename NewEngine_t::Tag_t NewEngineTag_t;
> -
> -  // The output types.
> -
> -  typedef Array<newDim, T, NewEngineTag_t> Type_t;
> -  typedef Type_t ReadType_t;
> -};
> -
>  template<int Dim, class T, class EngineTag>
>  struct View1<Array<Dim, T, EngineTag>, int>
>  {
> @@ -1864,7 +1827,7 @@
>    /// A zero-argument version of operator(), which takes a view of
>    /// array's domain, is also supplied.
>    //@{
> -  typename AltView0<This_t>::ReadType_t
> +  typename View0<This_t>::ReadType_t
>    read() const
>      {
>        typedef View0<This_t> Ret_t;
> @@ -1934,7 +1897,7 @@
>        return Ret_t::makeRead(*this, s1, s2, s3, s4, s5, s6, s7);
>      }
> 
> -  typename AltView0<This_t>::Type_t
> +  typename View0<This_t>::Type_t
>    operator()() const
>      {
>        typedef View0<This_t> Ret_t;
> ===== Field/Field.h 1.14 vs edited =====
> --- 1.14/r2/src/Field/Field.h	Tue Dec 16 15:20:00 2003
> +++ edited/Field/Field.h	Tue Mar  2 11:25:22 2004
> @@ -269,9 +269,6 @@
>   * View1Implementation<Field, D, SV> specialization for indexing a field
>   * with a single domain. There is a single-valued version (SV == true)
>   * and a multi-valued version (SV == false).
> - *
> - * Any changes to View1Implementation should also be made to
> - * AltView1Implementation.
>   */
> 
>  // Single-valued version. Handles scalars and Locs.
> @@ -508,62 +505,7 @@
> 
> 
>  /**
> - * AltView1Implementation avoids an instantiation problem that arises
> when two
> - * classes use each other.  This class's definition should be exactly
> - * the same as View1Implementation except omitting member functions.
> - *
> - * Do NOT explicitly instantiate this class.
> - */
> -
> -// Single-valued version. Handles scalars and Locs.
> -
> -template<class Subject, class Domain, bool SV>
> -struct AltView1Implementation;
> -
> -template<class Mesh, class T, class EngineTag, class Domain>
> -struct AltView1Implementation<Field<Mesh, T, EngineTag>, Domain, true>
> -{
> -  // Convenience typedef for the thing we're taking a view of.
> -
> -  typedef Field<Mesh, T, EngineTag> Subject_t;
> -
> -  // The return types are pretty simple here.
> -
> -  typedef typename Subject_t::Element_t ReadType_t;
> -  typedef typename Subject_t::ElementRef_t Type_t;
> -};
> -
> -template<class Mesh, class T, class EngineTag, class Domain>
> -struct AltView1Implementation<Field<Mesh, T, EngineTag>, Domain, false>
> -{
> -  // Convenience typedef for the thing we're taking a view of.
> -
> -  typedef Field<Mesh, T, EngineTag> Subject_t;
> -
> -  // Deduce domains for the output type.
> -
> -  typedef typename Subject_t::Engine_t Engine_t;
> -  typedef typename NewEngine<Engine_t, Domain>::Type_t NewEngine_t;
> -  typedef typename NewEngine_t::Element_t NewT_t;
> -  typedef typename NewEngine_t::Tag_t NewEngineTag_t;
> -
> -  // Deduce the new Mesh.
> -
> -  typedef typename
> -    NewMeshTag<NewEngine_t::dimensions, Mesh, Domain>::Type_t
> -      NewMeshTag_t;
> -
> -  // The output types.
> -
> -  typedef Field<NewMeshTag_t, NewT_t, NewEngineTag_t> ReadType_t;
> -  typedef Field<NewMeshTag_t, NewT_t, NewEngineTag_t> Type_t;
> -};
> -
> -
> -/**
>   * View1<Field, S1> specialization for indexing a field with a single
> domain.
> - *
> - * Any changes to View1 should also be made to AltView1.
>   */
> 
>  template<class Mesh, class T, class EngineTag, class Sub1>
> @@ -613,8 +555,6 @@
> 
>  /**
>   * View1<Field, int> specialization for indexing a field with an int.
> - *
> - * Any changes to View1 should also be made to AltView1.
>   */
> 
>  template<class Mesh, class T, class EngineTag>
> @@ -658,71 +598,6 @@
> 
> 
>  /**
> - * AltView1 avoids an instantiation problem that arises when two
> - * classes use each other.  This class's definition should be exactly
> - * the same as View1 except omitting member functions.
> - *
> - * Do NOT explicitly instantiate this class.
> - */
> -
> -template<class FieldTag, class DomainTag>
> -struct AltView1;
> -
> -template<class Mesh, class T, class EngineTag, class Sub1>
> -struct AltView1<Field<Mesh, T, EngineTag>, Sub1>
> -{
> -  // Convenience typedef for the thing we're taking a view of.
> -
> -  typedef Field<Mesh, T, EngineTag> Subject_t;
> -
> -  // Deduce domains for the output type.
> -  // At some point, we need to fix NewDomain1; until then, use
> -  // the temporary version from NewDomain.h.
> -
> -  typedef typename Subject_t::Domain_t Domain_t;
> -  typedef TemporaryNewDomain1<Domain_t, Sub1> NewDomain_t;
> -  typedef typename NewDomain_t::SliceType_t SDomain_t;
> -
> -  // Deduce appropriate version of implementation to dispatch to.
> -
> -  enum { sv = DomainTraits<SDomain_t>::singleValued };
> -  typedef AltView1Implementation<Subject_t, SDomain_t, sv> Dispatch_t;
> -
> -  // The optimized domain combiner.
> -
> -  typedef CombineDomainOpt<NewDomain_t, sv> Combine_t;
> -
> -  // The return types.
> -
> -  typedef typename Dispatch_t::ReadType_t ReadType_t;
> -  typedef typename Dispatch_t::Type_t Type_t;
> -};
> -
> -
> -/**
> - * AltView1 avoids an instantiation problem that arises when two
> - * classes use each other.  This class's definition should be exactly
> - * the same as View1 except omitting member functions.
> - *
> - * Do NOT explicitly instantiate this class.
> - */
> -
> -template<class Mesh, class T, class EngineTag>
> -struct AltView1<Field<Mesh, T, EngineTag>, int>
> -{
> -  // Convenience typedef for the thing we're taking a view of.
> -
> -  typedef Field<Mesh, T, EngineTag> Subject_t;
> -
> -  // The return types.
> -
> -  typedef typename Subject_t::Element_t ReadType_t;
> -  typedef typename Subject_t::ElementRef_t Type_t;
> -
> -};
> -
> -
> -/**
>   * View2<Field, S1, S2> specialization for indexing a field with two
>   * domains.
>   */
> @@ -1455,14 +1330,14 @@
>    /// point fields the viewing domain is an actual centering domain.
>    //@{
> 
> -  inline typename AltView1<This_t, Domain_t>::ReadType_t
> +  inline typename View1<This_t, Domain_t>::ReadType_t
>    read() const
>      {
>        typedef View1<This_t, Domain_t> Ret_t;
>        return Ret_t::makeRead(*this, physicalDomain());
>      }
> 
> -  inline typename AltView1<This_t, Domain_t>::ReadType_t
> +  inline typename View1<This_t, Domain_t>::ReadType_t
>    readAll() const
>      {
>        typedef View1<This_t, Domain_t> Ret_t;
> @@ -1470,7 +1345,7 @@
>      }
> 
>    template<class Sub1>
> -  inline typename AltView1<This_t, Sub1>::ReadType_t
> +  inline typename View1<This_t, Sub1>::ReadType_t
>    read(const Sub1 &s1) const
>      {
>        typedef View1<This_t, Sub1> Ret_t;
> @@ -1493,14 +1368,14 @@
>        return Ret_t::makeRead(*this, s1, s2, s3);
>      }
> 
> -  inline typename AltView1<This_t, Domain_t>::Type_t
> +  inline typename View1<This_t, Domain_t>::Type_t
>    operator()() const
>      {
>        typedef View1<This_t, Domain_t> Ret_t;
>        return Ret_t::make(*this, physicalDomain());
>      }
> 
> -  inline typename AltView1<This_t, Domain_t>::Type_t
> +  inline typename View1<This_t, Domain_t>::Type_t
>    all() const
>      {
>        typedef View1<This_t, Domain_t> Ret_t;
> @@ -1508,7 +1383,7 @@
>      }
> 
>    template<class Sub1>
> -  inline typename AltView1<This_t, Sub1>::Type_t
> +  inline typename View1<This_t, Sub1>::Type_t
>    operator()(const Sub1 &s1) const
>      {
>        typedef View1<This_t, Sub1> Ret_t;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20040302/7e030c13/attachment.html>


More information about the pooma-dev mailing list