> > For sure a lower miss rate on the cache is possible.  Also, the
> > miss path -- function cmpGEQ_VTS -- is naively coded, we could
> > do a lot better there.  Maybe it is possible to change the
> > representation of VTSs so that comparison using vector operations
> > (SSE insns, etc) is possible.  Or at least so that the complex
> > alignment logic can be avoided.
>
> Right now I use the graph machinery, not vts.
> In order to support barrier I have to create a fake segment which does not
> belong to any thread.

Another way is with O(log N) new segments.  No need for segments 
that do not belong to any thread, and you can implement it using
the existing Segment representation easily.

Suppose there are 4 threads, t1, t2, t3, t4

* wait for all the threads to arrive at the barrier.  When the
  last one arrives:

* make a binary tree:
  - "seg12": new segment belonging to t2, depending on t1 and old t2
    
  - "seg34": new segment belonging to t4, depending on t3 and old t4

  - "seg1234": new segment belonging to t4, depending on seg12 and seg34

* now seg1234 depends on all threads arriving at the barrier.  

* now construct new segments for t1, t2, t3, t4, which of course
  depend on the previous segments in the same thread, and also on
  seg1234

I heard that this technique or something like it is explained in 
Arndt Muehlenfeld's thesis, although I did not read it.

It is inefficient (in space) compared to having a single fake segment.
But at least you can implement it using the 2-input Segment nodes in
the original Helgrind.  For a single fake segment, you would need 
to represent N input dependencies, which makes the representation more
complex.  Note that because the VTS effectively caches the result of
all hb-queries between all segment-pairs, this technique is not 
inefficient in time, only in space (and then only O(log N) cost).

> I did not figure out what VTS to put in that fake segment (well, I did not
> try hard :))

General rule:

supposing thread T is starting a new segment, giving segments Told and Tnew
and also we want to add dependence on some other segment S, then

  Tnew->vts = tickL_and_joinR( Told->vts, S->vts )

assuming that Tnew->prev == Told and Tnew->other == S
and it is important that Told and Tnew are from the same thread.

J

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to