Ignore:
Timestamp:
Feb 8, 2015, 12:55:35 PM (9 years ago)
Author:
alain
Message:

Introduce quad tree for distributed locks and barriers.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_common/kernel_locks.h

    r466 r495  
    11///////////////////////////////////////////////////////////////////////////////////
    2 // File     : locks.h
     2// File     : kernel_locks.h
    33// Date     : 01/12/2014
    44// Author   : alain greiner
     
    3434typedef struct spin_lock_s
    3535{
    36     unsigned int current;        // current slot index
     36    unsigned int current;        // current slot index:
    3737    unsigned int free;           // next free tiket index
    3838    unsigned int padding[14];    // for 64 bytes alignment
     
    4040
    4141extern unsigned int _atomic_increment( unsigned int* ptr,
    42                                        unsigned int  increment );
     42                                       int  increment );
    4343
    4444extern void _spin_lock_init( spin_lock_t* lock );
     
    4848extern void _spin_lock_release( spin_lock_t* lock );
    4949
     50
    5051//////////////////////////////////////////////////////////////////////////////////
    51 //      SBT lock structures and access functions
     52//      SQT lock structures and access functions
    5253//////////////////////////////////////////////////////////////////////////////////
    5354
    54 typedef struct lock_node_s
     55typedef struct sqt_lock_node_s
    5556{
    56     unsigned int            taken;           // lock taken if non zero
     57    unsigned int            current;         // current ticket index
     58    unsigned int            free;            // next free ticket index
    5759    unsigned int            level;           // hierarchical level (0 is bottom)
    58     struct lock_node_s*     parent;          // pointer on parent node (NULL for root)
    59     struct lock_node_s*     child0;          // pointer on children node
    60     struct lock_node_s*     child1;          // pointer on children node
    61     unsigned int            x;               // cluster x coordinate       
    62     unsigned int            y;               // cluster y coordinate           
    63     unsigned int            padding[9];      // for 64 bytes alignment         
    64 } lock_node_t;
     60    struct sqt_lock_node_s* parent;          // parent node (NULL for root)
     61    struct sqt_lock_node_s* child[4];        // children node
     62    unsigned int            padding[8];      // for 64 bytes alignment         
     63} sqt_lock_node_t;
    6564
    66 typedef struct sbt_lock_s
     65typedef struct sqt_lock_s
    6766{
    68     unsigned int    ntasks;                   // total number of expected tasks
    69     lock_node_t*    node[X_SIZE][Y_SIZE][9];  // array of pointers on SBT nodes
    70 } sbt_lock_t;
     67    sqt_lock_node_t* node[X_SIZE][Y_SIZE][5];  // array of pointers on SBT nodes
     68} sqt_lock_t;
    7169
    72 extern void _sbt_lock_init( sbt_lock_t*   lock );
     70extern void _sqt_lock_init( sqt_lock_t*   lock );
    7371
    74 extern void _sbt_lock_acquire( sbt_lock_t*  lock );
     72extern void _sqt_lock_acquire( sqt_lock_t*  lock );
    7573
    76 extern void _sbt_lock_release( sbt_lock_t*  lock );
     74extern void _sqt_lock_release( sqt_lock_t*  lock );
     75
    7776
    7877#endif
Note: See TracChangeset for help on using the changeset viewer.