LCOV - code coverage report
Current view: top level - app/firedancer - callbacks_vinyl.c (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 47 0.0 %
Date: 2025-12-06 04:45:29 Functions: 0 9 0.0 %

          Line data    Source code
       1             : #include "../../vinyl/fd_vinyl.h"
       2             : #include "../../disco/topo/fd_topo.h"
       3             : #include "../../util/pod/fd_pod_format.h"
       4             : 
       5           0 : #define VAL(name) (__extension__({                                                             \
       6           0 :   ulong __x = fd_pod_queryf_ulong( topo->props, ULONG_MAX, "obj.%lu.%s", obj->id, name );      \
       7           0 :   if( FD_UNLIKELY( __x==ULONG_MAX ) ) FD_LOG_ERR(( "obj.%lu.%s was not set", obj->id, name )); \
       8           0 :   __x; }))
       9             : 
      10             : 
      11             : /* vinyl_meta: a shared memory separately chained hash map */
      12             : 
      13             : static ulong
      14             : vinyl_meta_align( fd_topo_t const *     topo,
      15           0 :                   fd_topo_obj_t const * obj ) {
      16           0 :   (void)topo; (void)obj;
      17           0 :   return fd_vinyl_meta_align();
      18           0 : }
      19             : 
      20             : static ulong
      21             : vinyl_meta_footprint( fd_topo_t const *     topo,
      22           0 :                       fd_topo_obj_t const * obj ) {
      23           0 :   return fd_vinyl_meta_footprint( VAL("ele_max"), VAL("lock_cnt"), VAL("probe_max") );
      24           0 : }
      25             : 
      26             : static void
      27             : vinyl_meta_new( fd_topo_t const *     topo,
      28           0 :                 fd_topo_obj_t const * obj ) {
      29           0 :   FD_TEST( fd_vinyl_meta_new( fd_topo_obj_laddr( topo, obj->id ), VAL("ele_max"), VAL("lock_cnt"), VAL("probe_max"), VAL("seed") ) );
      30           0 : }
      31             : 
      32             : fd_topo_obj_callbacks_t fd_obj_cb_vinyl_meta = {
      33             :   .name      = "vinyl_meta",
      34             :   .footprint = vinyl_meta_footprint,
      35             :   .align     = vinyl_meta_align,
      36             :   .new       = vinyl_meta_new,
      37             : };
      38             : 
      39             : /* vinyl_meta_ele: hash map elements of vinyl_meta */
      40             : 
      41             : static ulong
      42             : vinyl_meta_ele_align( fd_topo_t const *     topo,
      43           0 :                       fd_topo_obj_t const * obj ) {
      44           0 :   (void)topo; (void)obj;
      45           0 :   return fd_ulong_max( alignof(fd_vinyl_meta_ele_t), 128UL );
      46           0 : }
      47             : 
      48             : static ulong
      49             : vinyl_meta_ele_footprint( fd_topo_t const *     topo,
      50           0 :                           fd_topo_obj_t const * obj ) {
      51           0 :   return fd_ulong_align_up( sizeof(fd_vinyl_meta_ele_t) * VAL("cnt"), vinyl_meta_ele_align( topo, obj ) );
      52           0 : }
      53             : 
      54             : static void
      55             : vinyl_meta_ele_new( fd_topo_t const *     topo,
      56           0 :                     fd_topo_obj_t const * obj ) {
      57             :   /* On Zen 4:
      58             :      - non-temporal wide stores are fastest
      59             :      - scattering 8 byte writes is slower
      60             :      - memset is slowest */
      61             : 
      62           0 : # if FD_HAS_AVX512
      63           0 :   uchar * m0 = fd_topo_obj_laddr( topo, obj->id );
      64           0 :   uchar * m1 = m0 + vinyl_meta_ele_footprint( topo, obj );
      65           0 :   __m512i zero = _mm512_setzero_si512();
      66           0 :   for( uchar * m=m0; m<m1; m+=64 ) {
      67           0 :     _mm512_stream_si512( (__m512i *)m, zero );
      68           0 :   }
      69           0 :   _mm_sfence();
      70             : # else
      71           0 :   fd_vinyl_meta_ele_t * ele = fd_topo_obj_laddr( topo, obj->id );
      72           0 :   ulong cnt = VAL("cnt");
      73           0 :   for( ulong i=0UL; i<cnt; i++ ) {
      74           0 :     ele[ i ].phdr.ctl = 0UL;
      75           0 :   }
      76           0 : # endif
      77           0 : }
      78             : 
      79             : fd_topo_obj_callbacks_t fd_obj_cb_vinyl_meta_ele = {
      80             :   .name      = "vinyl_meta_e",
      81             :   .footprint = vinyl_meta_ele_footprint,
      82             :   .align     = vinyl_meta_ele_align,
      83             :   .new       = vinyl_meta_ele_new,
      84             : };
      85             : 
      86             : /* vinyl_data: memory arena for data cache entries */
      87             : 
      88             : static ulong
      89             : vinyl_data_align( fd_topo_t const *     topo,
      90           0 :                   fd_topo_obj_t const * obj ) {
      91           0 :   (void)topo; (void)obj;
      92           0 :   return alignof(fd_vinyl_data_obj_t);
      93           0 : }
      94             : 
      95             : static ulong
      96             : vinyl_data_footprint( fd_topo_t const *     topo,
      97           0 :                       fd_topo_obj_t const * obj ) {
      98           0 :   return fd_ulong_align_dn( VAL("data_sz"), alignof(fd_vinyl_data_obj_t) );
      99           0 : }
     100             : 
     101             : static void
     102             : vinyl_data_new( fd_topo_t const *     topo,
     103           0 :                 fd_topo_obj_t const * obj ) {
     104           0 :   (void)topo; (void)obj;
     105             :   /* initialized by user */
     106           0 : }
     107             : 
     108             : fd_topo_obj_callbacks_t fd_obj_cb_vinyl_data = {
     109             :   .name      = "vinyl_data",
     110             :   .footprint = vinyl_data_footprint,
     111             :   .align     = vinyl_data_align,
     112             :   .new       = vinyl_data_new,
     113             : };

Generated by: LCOV version 1.14