Changeset 1095ccd


Ignore:
Timestamp:
Aug 14, 2020, 5:32:32 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d2b5d2d
Parents:
a5bc72e
Message:

Added support for partial submit strategy

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io.cfa

    ra5bc72e r1095ccd  
    514514        }
    515515
     516        #define PARTIAL_SUBMIT 32
    516517        static unsigned __collect_submitions( struct __io_data & ring ) {
    517518                /* paranoid */ verify( ring.submit_q.ready != 0p );
     
    521522                __u32 tail = *ring.submit_q.tail;
    522523                const __u32 mask = *ring.submit_q.mask;
     524                #if defined(PARTIAL_SUBMIT)
     525                        #if defined(LEADER_LOCK)
     526                                #error PARTIAL_SUBMIT and LEADER_LOCK cannot co-exist
     527                        #endif
     528                        const __u32 cnt = ring.submit_q.ready_cnt > PARTIAL_SUBMIT ? PARTIAL_SUBMIT : ring.submit_q.ready_cnt;
     529                        const __u32 offset = ring.submit_q.prev_ready;
     530                        ring.submit_q.prev_ready += cnt;
     531                #else
     532                        const __u32 cnt = ring.submit_q.ready_cnt;
     533                        const __u32 offset = 0;
     534                #endif
    523535
    524536                // Go through the list of ready submissions
    525                 for( i; ring.submit_q.ready_cnt ) {
     537                for( c; cnt ) {
     538                        __u32 i = (offset + c) % ring.submit_q.ready_cnt;
     539
    526540                        // replace any submission with the sentinel, to consume it.
    527541                        __u32 idx = __atomic_exchange_n( &ring.submit_q.ready[i], -1ul32, __ATOMIC_RELAXED);
  • libcfa/src/concurrency/io/setup.cfa

    ra5bc72e r1095ccd  
    388388                                sq.ready[i] = -1ul32;
    389389                        }
     390                        sq.prev_ready = 0;
    390391                }
    391392                else {
    392393                        sq.ready_cnt = 0;
    393394                        sq.ready = 0p;
     395                        sq.prev_ready = 0;
    394396                }
    395397
  • libcfa/src/concurrency/io/types.hfa

    ra5bc72e r1095ccd  
    2323      #include "bits/locks.hfa"
    2424
    25         #define LEADER_LOCK
     25        // #define LEADER_LOCK
    2626        struct __leaderlock_t {
    2727                struct $thread * volatile value;        // ($thread) next_leader | (bool:1) is_locked
     
    5555                volatile __u32 * ready;
    5656                __u32 ready_cnt;
     57                __u32 prev_ready;
    5758
    5859                #if defined(LEADER_LOCK)
Note: See TracChangeset for help on using the changeset viewer.