Changeset b9376fe


Ignore:
Timestamp:
May 5, 2021, 2:12:36 PM (6 weeks ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, master
Children:
7f54356, a67c5b6
Parents:
4026d1be (diff), f302d80 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/Makefile.am

    r4026d1be rb9376fe  
    5959        concurrency/iofwd.hfa \
    6060        containers/list.hfa \
     61        containers/list2.hfa \
    6162        containers/queueLockFree.hfa \
    6263        containers/stackLockFree.hfa \
  • libcfa/src/concurrency/ready_queue.cfa

    r4026d1be rb9376fe  
    398398
    399399                if(proc->rdq.target == -1u) {
    400                         proc->rdq.target = __tls_rand() % lanes.count;
    401                         unsigned it1  = proc->rdq.itr;
    402                         unsigned it2  = proc->rdq.itr + 1;
    403                         unsigned idx1 = proc->rdq.id + (it1 % READYQ_SHARD_FACTOR);
    404                         unsigned idx2 = proc->rdq.id + (it2 % READYQ_SHARD_FACTOR);
     400                        _Static_assert(READYQ_SHARD_FACTOR == 2);
     401                        unsigned idx1 = proc->rdq.id + 0;
     402                        unsigned idx2 = proc->rdq.id + 1;
    405403                        unsigned long long tsc1 = ts(lanes.data[idx1]);
    406404                        unsigned long long tsc2 = ts(lanes.data[idx2]);
    407                         proc->rdq.cutoff = min(tsc1, tsc2);
    408                         if(proc->rdq.cutoff == 0) proc->rdq.cutoff = -1ull;
     405                        proc->rdq.target = __tls_rand() % lanes.count;
     406
     407                        // WARNING: std::min is polymorphic and therefore causes 500% slowdown instead of the expected 2%
     408                        proc->rdq.cutoff = tsc1 < tsc2 ? tsc1 : tsc2;
    409409                }
    410410                else {
     
    418418
    419419                for(READYQ_SHARD_FACTOR) {
    420                         unsigned i = proc->rdq.id + (--proc->rdq.itr % READYQ_SHARD_FACTOR);
     420                        unsigned i = proc->rdq.id + (proc->rdq.itr++ % READYQ_SHARD_FACTOR);
    421421                        if($thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t;
    422422                }
     
    469469        // Actually pop the list
    470470        struct $thread * thrd;
    471         thrd = pop(lane);
     471        unsigned long long tsv;
     472        [thrd, tsv] = pop(lane);
    472473
    473474        /* paranoid */ verify(thrd);
     
    481482
    482483        #if defined(USE_WORK_STEALING)
    483                 lanes.tscs[w].tv = thrd->link.ts;
     484                lanes.tscs[w].tv = tsv;
    484485        #endif
    485486
     
    663664                        while(!is_empty(lanes.data[idx])) {
    664665                                struct $thread * thrd;
    665                                 thrd = pop(lanes.data[idx]);
     666                                unsigned long long _;
     667                                [thrd, _] = pop(lanes.data[idx]);
    666668
    667669                                push(cltr, thrd);
  • libcfa/src/concurrency/ready_subqueue.hfa

    r4026d1be rb9376fe  
    5353// Push a thread onto this lane
    5454// returns true of lane was empty before push, false otherwise
    55 void push( __intrusive_lane_t & this, $thread * node ) {
     55static inline void push( __intrusive_lane_t & this, $thread * node ) {
    5656        /* paranoid */ verify( node->link.next == 0p );
    5757        /* paranoid */ verify( node->link.ts   == 0  );
     
    7777// returns popped
    7878// returns true of lane was empty before push, false otherwise
    79 $thread * pop( __intrusive_lane_t & this ) {
     79static inline [* $thread, unsigned long long] pop( __intrusive_lane_t & this ) {
    8080        /* paranoid */ verify( this.anchor.next != 0p );
    8181        /* paranoid */ verify( this.anchor.ts   != 0  );
    8282
    8383        // Get the relevant nodes locally
     84        unsigned long long ts = this.anchor.ts;
    8485        $thread * node = this.anchor.next;
    8586        this.anchor.next = node->link.next;
     
    9495        /* paranoid */ verify( node->link.next == 0p );
    9596        /* paranoid */ verify( node->link.ts   == 0  );
    96         return node;
     97        return [node, ts];
    9798}
    9899
  • tests/array-container/array-md-sbscr-cases.cfa

    r4026d1be rb9376fe  
    108108
    109109    // order wxzy: wx*z, y
    110 
     110  #if 0
     111    // not working on 32-bit
    111112    assert(( wxyz[[iw  , ix  , all , iz  ]][iy  ] == valExpected ));
    112113    assert(( wxyz[[iw  , ix  , all , iz-1]][iy  ] != valExpected ));
    113114    assert(( wxyz[[iw  , ix  , all , iz  ]][iy-1] != valExpected ));
     115  #endif
    114116}
    115117
Note: See TracChangeset for help on using the changeset viewer.