Changes in / [b0b89a8:9373b6a]


Ignore:
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • benchmark/readyQ/cycle.cfa

    rb0b89a8 r9373b6a  
    8585                }
    8686
    87                 printf("Duration (ms)        : %'ld\n", (end - start)`dms);
     87                printf("Duration (ms)        : %'lf\n", (end - start)`dms);
    8888                printf("Number of processors : %'d\n", nprocs);
    8989                printf("Number of threads    : %'d\n", tthreads);
  • benchmark/readyQ/locality.cfa

    rb0b89a8 r9373b6a  
    126126// ==================================================
    127127// Do some work by accessing 'cnt' cells in the array
    128 __attribute__((noinline)) void work(MyData & data, size_t cnt, uint64_t & state) {
    129         for (cnt) {
     128__attribute__((noinline)) void work(MyData & data, size_t cnt_, uint64_t & state) {
     129        for (cnt_) {
    130130                access(data, __xorshift64(state));
    131131        }
     
    200200
    201201        if( nspots == 0 ) { nspots = nthreads - nprocs; }
     202        if( nspots == 0 ) {
     203                fprintf(stderr, "--nspots must be set or --nthreads set to something bigger than --nprocs\n");
     204                exit(EXIT_FAILURE);
     205        }
    202206
    203207        Time start, end;
  • benchmark/readyQ/yield.cpp

    rb0b89a8 r9373b6a  
    2929#include "libfibre/fibre.h"
    3030
    31 FibreBarrier * barrier;
     31FredBarrier * barrier;
    3232struct __attribute__((aligned(128))) counter_t {
    3333        int value = 0;
     
    6666
    6767                const char * arg = optarg ? optarg : "";
    68                 size_t len = 0;
    6968                char * end;
    7069                switch(opt) {
     
    111110
    112111                FibreInit();
    113                 barrier = new FibreBarrier(nthreads + 1);
     112                barrier = new FredBarrier(nthreads + 1);
    114113                {
    115114                        Context::CurrCluster().addWorkers(nprocs);
  • libcfa/prelude/bootloader.cf

    rb0b89a8 r9373b6a  
    33char ** cfa_args_argv;
    44char ** cfa_args_envp;
     5int cfa_main_returned = 0;
    56
    67int main(int argc, char* argv[], char* envp[]) {
     
    89        cfa_args_argv = argv;
    910        cfa_args_envp = envp;
    10         return invoke_main(argc, argv, envp);
     11        int ret = invoke_main(argc, argv, envp);
     12        cfa_main_returned = 1;
     13        return ret;
    1114}
  • libcfa/src/concurrency/invoke.h

    rb0b89a8 r9373b6a  
    170170                bool corctx_flag;
    171171
     172                int last_cpu;
     173
    172174                //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it
    173175
  • libcfa/src/concurrency/kernel.cfa

    rb0b89a8 r9373b6a  
    394394        __builtin_prefetch( thrd_dst->context.SP );
    395395
     396        int curr = __kernel_getcpu();
     397        if(thrd_dst->last_cpu != curr) {
     398                int64_t l = thrd_dst->last_cpu;
     399                int64_t c = curr;
     400                int64_t v = (l << 32) | c;
     401                __push_stat( __tls_stats(), v, false, "Processor", this );
     402        }
     403
     404        thrd_dst->last_cpu = curr;
     405
    396406        __cfadbg_print_safe(runtime_core, "Kernel : core %p running thread %p (%s)\n", this, thrd_dst, thrd_dst->self_cor.name);
    397407
     
    470480                                #if !defined(__CFA_NO_STATISTICS__)
    471481                                        __tls_stats()->ready.threads.threads++;
    472                                         __push_stat( __tls_stats(), __tls_stats()->ready.threads.threads, false, "Processor", this );
    473482                                #endif
    474483                                // This is case 2, the racy case, someone tried to run this thread before it finished blocking
     
    488497        #if !defined(__CFA_NO_STATISTICS__)
    489498                __tls_stats()->ready.threads.threads--;
    490                 __push_stat( __tls_stats(), __tls_stats()->ready.threads.threads, false, "Processor", this );
    491499        #endif
    492500
     
    570578                                __tls_stats()->ready.threads.extunpark++;
    571579                        }
    572                         __push_stat( __tls_stats(), __tls_stats()->ready.threads.threads, false, "Processor", kernelTLS().this_processor );
    573580                }
    574581                else {
    575582                        __atomic_fetch_add(&cl->stats->ready.threads.threads, 1, __ATOMIC_RELAXED);
    576583                        __atomic_fetch_add(&cl->stats->ready.threads.extunpark, 1, __ATOMIC_RELAXED);
    577                         __push_stat( cl->stats, cl->stats->ready.threads.threads, true, "Cluster", cl );
    578584                }
    579585        #endif
  • libcfa/src/concurrency/kernel.hfa

    rb0b89a8 r9373b6a  
    6767                unsigned target;
    6868                unsigned last;
     69                unsigned cnt;
    6970                unsigned long long int cutoff;
    7071        } rdq;
  • libcfa/src/concurrency/kernel/startup.cfa

    rb0b89a8 r9373b6a  
    478478        state = Start;
    479479        self_cor{ info };
     480        last_cpu = __kernel_getcpu();
    480481        curr_cor = &self_cor;
    481482        curr_cluster = mainCluster;
  • libcfa/src/concurrency/ready_queue.cfa

    rb0b89a8 r9373b6a  
    345345                        /* paranoid */ verify(lanes.count < 65536); // The following code assumes max 65536 cores.
    346346                        /* paranoid */ verify(map.count < 65536); // The following code assumes max 65536 cores.
    347                         uint64_t chaos = __tls_rand();
    348                         uint64_t high_chaos = (chaos >> 32);
    349                         uint64_t  mid_chaos = (chaos >> 16) & 0xffff;
    350                         uint64_t  low_chaos = chaos & 0xffff;
    351 
    352                         unsigned me = map.self;
    353                         unsigned cpu_chaos = map.start + (mid_chaos % map.count);
    354                         bool global = cpu_chaos == me;
    355 
    356                         if(global) {
    357                                 proc->rdq.target = high_chaos % lanes.count;
     347
     348                        if(0 == (__tls_rand() % 10_000)) {
     349                                proc->rdq.target = __tls_rand() % lanes.count;
    358350                        } else {
    359                                 proc->rdq.target = (cpu_chaos * READYQ_SHARD_FACTOR) + (low_chaos % READYQ_SHARD_FACTOR);
     351                                unsigned cpu_chaos = map.start + (__tls_rand() % map.count);
     352                                proc->rdq.target = (cpu_chaos * READYQ_SHARD_FACTOR) + (__tls_rand() % READYQ_SHARD_FACTOR);
    360353                                /* paranoid */ verify(proc->rdq.target >= (map.start * READYQ_SHARD_FACTOR));
    361354                                /* paranoid */ verify(proc->rdq.target <  ((map.start + map.count) * READYQ_SHARD_FACTOR));
  • libcfa/src/concurrency/thread.cfa

    rb0b89a8 r9373b6a  
    3434        preempted = __NO_PREEMPTION;
    3535        corctx_flag = false;
     36        last_cpu = __kernel_getcpu();
    3637        curr_cor = &self_cor;
    3738        self_mon.owner = &this;
Note: See TracChangeset for help on using the changeset viewer.