Changeset 00f5fde


Ignore:
Timestamp:
Jan 12, 2022, 9:30:48 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
42daeb4
Parents:
1959528 (diff), 07a1e7a (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.
git-author:
Peter A. Buhr <pabuhr@…> (01/12/22 18:35:04)
git-committer:
Peter A. Buhr <pabuhr@…> (01/12/22 21:30:48)
Message:

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

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/locks.hfa

    r1959528 r00f5fde  
    3131                // previous thread to acquire the lock
    3232                void* prev_thrd;
     33                // keep track of number of times we had to spin, just in case the number is unexpectedly huge
     34                size_t spin_count;
    3335        #endif
    3436};
     
    4850        static inline void ?{}( __spinlock_t & this ) {
    4951                this.lock = 0;
     52                #ifdef __CFA_DEBUG__
     53                        this.spin_count = 0;
     54                #endif
    5055        }
    5156
     
    7277                for ( unsigned int i = 1;; i += 1 ) {
    7378                        if ( (this.lock == 0) && (__atomic_test_and_set( &this.lock, __ATOMIC_ACQUIRE ) == 0) ) break;
     79                        #ifdef __CFA_DEBUG__
     80                                this.spin_count++;
     81                        #endif
    7482                        #ifndef NOEXPBACK
    7583                                // exponential spin
  • libcfa/src/concurrency/io.cfa

    r1959528 r00f5fde  
    548548                        /* paranoid */ verify( proc == __cfaabi_tls.this_processor );
    549549                        /* paranoid */ verify( ! __preemption_enabled() );
     550
     551                        return true;
    550552                }
    551553        #endif
  • libcfa/src/concurrency/kernel.cfa

    r1959528 r00f5fde  
    554554        /* paranoid */ verify( 0x0D15EA5E0D15EA5Ep == thrd->canary );
    555555
    556         const bool local = thrd->state != Start;
    557556        if (thrd->preempted == __NO_PREEMPTION) thrd->state = Ready;
    558557
     
    737736
    738737        // Check if there is a sleeping processor
    739         int fd = __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST);
     738        // int fd = __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST);
     739        int fd = 0;
     740        if( __atomic_load_n(&this->procs.fd, __ATOMIC_SEQ_CST) != 0 ) {
     741                fd = __atomic_exchange_n(&this->procs.fd, 0, __ATOMIC_RELAXED);
     742        }
    740743
    741744        // If no one is sleeping, we are done
  • libcfa/src/concurrency/ready_queue.cfa

    r1959528 r00f5fde  
    681681        // Actually pop the list
    682682        struct thread$ * thrd;
    683         unsigned long long tsc_before = ts(lane);
     683        #if defined(USE_WORK_STEALING) || defined(USE_CPU_WORK_STEALING)
     684                unsigned long long tsc_before = ts(lane);
     685        #endif
    684686        unsigned long long tsv;
    685687        [thrd, tsv] = pop(lane);
  • libcfa/src/concurrency/thread.cfa

    r1959528 r00f5fde  
    1010// Created On       : Tue Jan 17 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 12 18:28:18 2022
    13 // Update Count     : 35
     12// Last Modified On : Wed Jan 12 18:46:48 2022
     13// Update Count     : 36
    1414//
    1515
     
    197197} // LCG
    198198
    199 void set_seed( uint32_t seed ) { active_thread()->random_state = seed; __global_random_seed = seed; }
     199void set_seed( uint32_t seed ) {
     200        active_thread()->random_state = __global_random_seed = seed;
     201        GENERATOR( active_thread()->random_state );
     202} // set_seed
    200203uint32_t prng( void ) { return GENERATOR( active_thread()->random_state ); } // [0,UINT_MAX]
    201204
  • libcfa/src/device/cpu.cfa

    r1959528 r00f5fde  
    427427                        unsigned c = pairings[i].cpu;
    428428                        unsigned llc_id = pairings[i].id;
    429                         unsigned width = maps[llc_id].raw->width;
    430429                        unsigned start = maps[llc_id].start;
    431                         unsigned self  = start + (maps[llc_id].count++);
    432                         entries[c].count = width;
     430                        entries[c].count = maps[llc_id].raw->width;
    433431                        entries[c].start = start;
    434                         entries[c].self  = self;
     432                        entries[c].self  = start + (maps[llc_id].count++);
     433                        entries[c].cache = llc_id;
    435434                }
    436435
  • libcfa/src/device/cpu.hfa

    r1959528 r00f5fde  
    1616#include <stddef.h>
    1717
     18// Map from cpu entry to a structure detailling cpus with common topologies
     19// Note that the cpu-groups are contiguous so the indexing is different from
     20// the cpu indexing
    1821struct cpu_map_entry_t {
     22        // Where this particular cpu is in the group
    1923        unsigned self;
     24
     25        // Starting index of the cpus with the same topology
    2026        unsigned start;
     27
     28        // Number of cpus with the same topology
    2129        unsigned count;
     30
     31        // Index of the cache this entry describes
     32        unsigned cache;
    2233};
    2334
  • libcfa/src/startup.cfa

    r1959528 r00f5fde  
    1010// Created On       : Tue Jul 24 16:21:57 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 12 16:25:37 2022
    13 // Update Count     : 49
     12// Last Modified On : Wed Jan 12 18:51:24 2022
     13// Update Count     : 51
    1414//
    1515
     
    2020#include "bits/defs.hfa"
    2121
    22 extern uint32_t __global_random_seed;
     22extern uint32_t __global_random_seed, __global_random_state;
    2323
    2424extern "C" {
     
    5151        void __cfaabi_core_startup( void ) __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
    5252        void __cfaabi_core_startup( void ) {
    53                 __global_random_seed = rdtscl();
     53                __global_random_state = __global_random_seed = rdtscl();
    5454                __cfaabi_interpose_startup();
    5555                __cfaabi_device_startup();
  • libcfa/src/stdlib.cfa

    r1959528 r00f5fde  
    1010// Created On       : Thu Jan 28 17:10:29 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 12 16:25:36 2022
    13 // Update Count     : 578
     12// Last Modified On : Wed Jan 12 18:52:41 2022
     13// Update Count     : 582
    1414//
    1515
     
    242242} // LCG
    243243
    244 uint32_t __global_random_seed;
     244uint32_t __global_random_seed;                                                  // sequential/concurrent
     245uint32_t __global_random_state;                                                 // sequential only
    245246
    246247void set_seed( PRNG & prng, uint32_t seed_ ) with( prng ) { state = seed = seed_; GENERATOR( state ); } // set seed
    247248uint32_t prng( PRNG & prng ) with( prng ) { callcnt += 1; return GENERATOR( state ); }
    248249
    249 void set_seed( uint32_t seed ) {
    250         active_thread()->random_state = __global_random_seed = seed;
    251         GENERATOR( active_thread()->random_state );
    252 } // set_seed
     250void set_seed( uint32_t seed ) { __global_random_seed = seed; GENERATOR( __global_random_state ); }
    253251uint32_t get_seed() { return __global_random_seed; }
    254 uint32_t prng( void ) { return GENERATOR( active_thread()->random_state ); } // [0,UINT_MAX]
     252uint32_t prng( void ) { return GENERATOR( __global_random_state ); } // [0,UINT_MAX]
    255253
    256254//---------------------------------------
  • libcfa/src/stdlib.hfa

    r1959528 r00f5fde  
    1010// Created On       : Thu Jan 28 17:12:35 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jan 12 09:09:48 2022
    13 // Update Count     : 620
     12// Last Modified On : Wed Jan 12 18:56:13 2022
     13// Update Count     : 621
    1414//
    1515
     
    437437
    438438void set_seed( uint32_t seed_ ) OPTIONAL_THREAD;
    439 uint32_t get_seed() __attribute__(( warn_unused_result )) OPTIONAL_THREAD;
     439uint32_t get_seed() __attribute__(( warn_unused_result ));
    440440uint32_t prng( void ) __attribute__(( warn_unused_result )) OPTIONAL_THREAD; // [0,UINT_MAX]
    441441static inline {
  • tools/jenkins/setup.sh.in

    r1959528 r00f5fde  
    4848                regex1='/([[:alpha:][:digit:]@/_.-]+)'
    4949                regex2='(libcfa[[:alpha:][:digit:].]+) => not found'
    50                 regex3='linux-vdso.so.1'
     50                regex3='linux-vdso.so.1|linux-gate.so.1'
    5151                if [[ $line =~ $regex1 ]]; then
    5252                        retsysdeps+=(${BASH_REMATCH[1]})
Note: See TracChangeset for help on using the changeset viewer.