Ignore:
Timestamp:
Jul 27, 2025, 3:25:11 PM (2 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
5ba1356
Parents:
b9d1242
Message:

Continue disabling harness features, achieving best-case times that match Peter's, on the three tests with new CSVs here.

The fully-disabled harness probably still fools the optimizer because it uses the Buhr-Dice "pass function" trick in place of the disabled observation and iterators array. That these times are now often beating Peter's requires further investigation.

Make STL run with (cpp-sltref) and without (cpp-stlrefAlloGlib) llheap.
Include peter-*.csv from runs on Swift. (Thesis still builds with original numbers from labpc.)
Add data post-processing for sorting and aggregation, leveraging thesis's plots' framework.

Add makefile-saved setups for matching Peter.
Add ability to disable "observation" (use of volatiles) and iterators array (support for remelem).
Add integrated clean-build-run targets for varying the "disable" switches.
Strengthen disable-interleaving mode to avoid the extra loops on remove.

Still to entertain some of this stripping being unnecessary for achieving near Peter-match.
Still to compare costs of the relevant stripped features, and recommend harness variation(s) to for use in thesis.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/mike_brooks_MMath/benchmarks/list/driver.c

    rb9d1242 r2b0e754  
    44#include <string.h>
    55
     6#ifdef DISABLE_OBSERVATION
     7#include "proglang.h"
     8#define bobs_init(...)
     9#else
    610#include "observation.h"
     11#endif
    712
    813#ifdef TINY_USER_ITEMS
     
    2025{
    2126    BFX_INTRUSION(B_UserItem)
     27//    BFX_LISTED_ELEM_T(B_UserItem) selfListed;
    2228    UDATA_T userdata[ UDATA_LEN ];
    2329}
     
    5157static BFX_LIST_HEAD_T(B_UserItem) lst;
    5258
     59#ifdef DISABLE_OBSERVATION
     60MAYBE_EXTERN_C (
     61    void bobs_seek(unsigned int i) {}
     62    void bobs_moveNext() {}
     63    void bobs_movePrev() {}
     64    int bobs_hasCurrent() { return 0; }
     65    void * bobs_getCurrentLoc() { return NULL; }
     66    int bobs_getCurrentVal() { return 0; }
     67    // enum bobs_op_movement_t bobs_op_movement = OP_MOVEMENT;
     68    // enum bobs_op_polarity_t bobs_op_polarity = OP_POLARITY;
     69)
     70
     71#else
     72
    5373MAYBE_EXTERN_C (
    5474
     
    87107    enum bobs_op_polarity_t bobs_op_polarity = OP_POLARITY;
    88108)
    89 
     109#endif
     110
     111
     112#ifndef DISABLE_OBSERVATION
    90113
    91114// Remove progress end (number) is based (upon) remove-number
     
    101124)
    102125
     126#endif // ndef DISABLE_OBSERVATION
     127
    103128unsigned int uDefaultPreemption() {
    104129        return 0;
    105130}
    106131
     132#ifdef DISABLE_ITERS_AR
     133// Saves on memory accesses, makes element-oriented removals and observation impossible (instead, they crash)
     134static inline BFX_LISTED_ELEM_T(B_UserItem) buhrdice_pass( BFX_LISTED_ELEM_T(B_UserItem) v ) {   // prevent eliding, cheaper than volatile
     135    __asm__ __volatile__ ( "" : "+r"(v) );
     136    return v ;
     137} // pass
     138#define ITERS_SAVE(i, insertElemExpr) buhrdice_pass(insertElemExpr)
     139#endif
     140
    107141int main(int argc, const char *argv[]) {
     142
     143  #ifdef DISABLE_OBSERVATION
     144    // define the outbound dependencies as locals, for compiling into nops
     145    size_t       bobs_ops_completed      = 0;
     146    unsigned int bobs_prog_inserting     = 0;
     147    unsigned int bobs_prog_removing      = 0;
     148    unsigned int bobs_prog_removing_end  = 0;
     149    unsigned int bobs_prog_rollover_flag = 0;
     150  #endif
    108151
    109152    const char * usage_args = "[ExperimentDurSec [CheckDonePeriod [NumNodes [ExperimentDurOpCount [Seed [InterleaveFrac]]]]]]";
     
    227270    memset(ui, 0, (size_t)NumNodes * (size_t)sizeof(B_UserItem));
    228271
     272  #ifndef DISABLE_ITERS_AR
    229273    listedItems = (BFX_LISTED_ELEM_T(B_UserItem)*)malloc( (size_t)NumNodes * (size_t)sizeof(BFX_LISTED_ELEM_T(B_UserItem)) );
    230274    if (!listedItems) {
     
    233277    }
    234278    memset(listedItems, 0, (size_t)NumNodes * (size_t)sizeof(BFX_LISTED_ELEM_T(B_UserItem)));
     279    #define ITERS_SAVE(i, insertElemExpr) listedItems[i] = (insertElemExpr)
     280  #endif
    235281
    236282    // Construct and fill with demo data
     
    285331        for ( int t = 0; t < CheckDonePeriod; t += 1 ) {
    286332            TRACE('a')              // insert special first
    287             listedItems[0] =
    288                 BOP_INIT(lst, listedItems, 0, ui[INSERTPOS(0)]);
     333            ITERS_SAVE( 0,
     334                BOP_INIT(lst, listedItems, 0, ui[INSERTPOS(0)]) );
    289335            TRACE('b')              // insert general
    290336            for ( int privateCurInsert = 1;
     
    293339                ) {
    294340                TRACE('-')
    295                 listedItems[privateCurInsert] =
    296                     BOP_INSERT( lst, listedItems, privateCurInsert, ui[INSERTPOS(privateCurInsert)] );
     341                ITERS_SAVE( privateCurInsert,
     342                    BOP_INSERT( lst, listedItems, privateCurInsert, ui[INSERTPOS(privateCurInsert)] ) );
    297343                TRACE('+')
    298344            }
     345          #ifdef DISABLE_INTERLEAVING
     346            // interleaving off, simple removes
     347            // (remove logic of 2b01f8eb0956)
     348            TRACE('c')
     349            for ( int privateCurRemove = 1;
     350                  (bobs_prog_removing = privateCurRemove, privateCurRemove < NumNodes);
     351                  privateCurRemove += 1
     352                ) {
     353                TRACE('-')
     354                BOP_REMOVE( lst, listedItems, privateCurRemove-1 );
     355                TRACE('+')
     356            }
     357          #else
     358            // interleaving on, complex removes
    299359            TRACE('c')              // remove general
    300360            int removeProgress[] = { 0, 0 };
     
    324384                }
    325385            }
     386          #endif // DISABLE_INTERLEAVING
    326387            TRACE('D')              // remove special last
    327388            BOP_TEARDOWN(lst, listedItems, NumNodes-1);
Note: See TracChangeset for help on using the changeset viewer.