Changeset 9d3dc40
- Timestamp:
- Jan 19, 2026, 11:38:54 AM (2 weeks ago)
- Branches:
- master
- Children:
- 79a8c2a
- Parents:
- 5a95560
- Files:
-
- 8 edited
-
doc/theses/mike_brooks_MMath/benchmarks/list/Makefile (modified) (4 diffs)
-
doc/theses/mike_brooks_MMath/benchmarks/list/driver.c (modified) (14 diffs)
-
doc/theses/mike_brooks_MMath/benchmarks/list/fx-cfa-GENERAL.h (modified) (1 diff)
-
doc/theses/mike_brooks_MMath/benchmarks/list/observation.c (modified) (2 diffs)
-
doc/theses/mike_brooks_MMath/benchmarks/list/observation.h (modified) (2 diffs)
-
doc/theses/mike_brooks_MMath/benchmarks/list/results-smoketest.csv (modified) (1 diff)
-
doc/theses/mike_brooks_MMath/plots/ListCommon.py (modified) (1 diff)
-
libcfa/src/collections/list2.hfa (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/theses/mike_brooks_MMath/benchmarks/list/Makefile
r5a95560 r9d3dc40 13 13 CC = gcc-11 14 14 CXX = g++-11 15 UXX ?= ~/u ++/u++-7.0.0/bin/u++15 UXX ?= ~/usys1/uCPP/source/bin/u++ 16 16 17 17 hi: … … 412 412 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_REP_IDS=4 RUN_DATA_SIZE_MODE=sweetspot RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='lq-tailq lq-list cfa-cfa cfa-mandHead cfa-noListed cfa-noIter cfa-likeLq cfa-strip upp-upp cpp-stlref' MAKE_DISABLE_OBSERVATION=yes EXTRA_COMP_FLAGS=-DDISABLE_INTERLEAVING 413 413 cat results-latest.csv >> $@ 414 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_REP_IDS= 4RUN_DATA_SIZE_MODE=sweetspot RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='lq-tailq lq-list cfa-cfa cfa-mandHead cfa-noListed cfa-noIter cfa-likeLq cfa-strip upp-upp cpp-stlref' MAKE_DISABLE_OBSERVATION=yes EXTRA_COMP_FLAGS=-DDISABLE_INTERLEAVING414 $(MAKE) results-latest.csv RUN_DURATION_SEC=5 RUN_REP_IDS=5 RUN_DATA_SIZE_MODE=sweetspot RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='lq-tailq lq-list cfa-cfa cfa-mandHead cfa-noListed cfa-noIter cfa-likeLq cfa-strip upp-upp cpp-stlref' MAKE_DISABLE_OBSERVATION=yes EXTRA_COMP_FLAGS=-DDISABLE_INTERLEAVING 415 415 cat results-latest.csv >> $@ 416 417 SHORT_SEMIPERIM=7 418 419 results-short-once.phony: MAKE_DISABLE_OBSERVATION=yes 420 results-short-once.phony: LEN_LIMIT=$(strip $(shell echo $$(($(SHORT_SEMIPERIM)-$(WIDTH)+1)))) 421 results-short-once.phony: LEN_VALS=$(strip $(shell echo {1..$(LEN_LIMIT)})) 422 results-short-once.phony: RUN_DATA_SIZES= $(call cross,-,$(LEN_VALS),1000000) 423 results-short-once.phony: EXTRA_COMP_FLAGS+= -DDISABLE_INTERLEAVING -DWIDTH=$(WIDTH) 424 results-short-once.phony: FX_SOLUTIONS=lq-tailq cfa-cfa 425 results-short-once.phony: OP_MOVEMENTS=queue 426 results-short-once.phony: OP_ACCESSORS=allhead 427 results-short-once.phony: FORCE cleanbuild 428 $(MAKE) results-latest.csv RUN_DATA_SIZE_MODE=manual RUN_DATA_SIZES="$(RUN_DATA_SIZES)" RUN_INTERLEAVE_PCTS='0' FX_SOLUTIONS='lq-tailq cfa-cfa' EXTRA_COMP_FLAGS=-DDISABLE_INTERLEAVING OP_MOVEMENTS=queue OP_ACCESSORS=allhead MAKE_DISABLE_OBSERVATION=yes 429 430 results-short.csv: FORCE 431 rm -f $@ 432 for i in {1..$(SHORT_SEMIPERIM)}; do $(MAKE) results-short-once.phony WIDTH=$$i; cat results-latest.csv >> $@; done 416 433 417 434 results-zoomout-noshuf.csv: MAKE_DISABLE_OBSERVATION=yes … … 455 472 results-smoketest.csv: OP_POLARITIES=insfirst 456 473 results-smoketest.csv: OP_ACCESSORS=allhead 474 results-smoketest.csv: EXTRA_COMP_FLAGS+= -DDISABLE_INTERLEAVING 457 475 results-smoketest.csv: $(RESULT) 458 476 mv $< $@ … … 469 487 export FX_SOLUTIONS 470 488 export MAKE_DISABLE_OBSERVATION 489 export WIDTH 490 export EXTRA_COMP_FLAGS 471 491 472 492 cleanbuild: FORCE clean -
doc/theses/mike_brooks_MMath/benchmarks/list/driver.c
r5a95560 r9d3dc40 5 5 #include <stdint.h> 6 6 #include <assert.h> 7 #include <signal.h> // signal 8 #include <unistd.h> // alarm 9 #include <sys/param.h> // MIN 7 10 8 11 #ifdef DISABLE_OBSERVATION … … 16 19 #define UDATA_T float 17 20 #define UDATA_LEN 17 21 #endif 22 23 #ifndef DISABLE_INTERLEAVING 24 #error You must disable interleaving---no longer maintained 18 25 #endif 19 26 … … 55 62 56 63 #if defined(NDEBUG) || (defined(__cforall) && !defined(__CFA_DEBUG__)) 57 enum { Default NumNodes= 1000, DefaultExperimentDurSec = 1, DefaultCheckDonePeriod = 1000, DefaultExperimentDurOpCount = -1, DefaultSeed = 5 };64 enum { DefaultListLen = 1000, DefaultExperimentDurSec = 1, DefaultCheckDonePeriod = 1000, DefaultExperimentDurOpCount = -1, DefaultSeed = 5 }; 58 65 const double DefaultInterleaveFrac = 0.0; 59 66 #define TRACE(tp) 60 67 #else 61 enum { Default NumNodes= 10, DefaultExperimentDurSec = 1, DefaultCheckDonePeriod = 2, DefaultExperimentDurOpCount = 20, DefaultSeed = 5 };68 enum { DefaultListLen = 10, DefaultExperimentDurSec = 1, DefaultCheckDonePeriod = 2, DefaultExperimentDurOpCount = 20, DefaultSeed = 5 }; 62 69 const double DefaultInterleaveFrac = 0.0; 63 70 static const char * tp_filter … … 72 79 #endif 73 80 81 // Number of lists used in experiment 82 // General tests use one 83 // Greater values help explain away poor len-1 IPC 84 // Value always compiled in 85 #ifndef WIDTH 86 #define WIDTH 1 87 #endif 88 74 89 static B_UserItem *ui = NULL; 75 90 76 91 static BFX_LISTED_ELEM_T(B_UserItem) observedItem; 77 92 78 static BFX_LIST_HEAD_T(B_UserItem) lst ;93 static BFX_LIST_HEAD_T(B_UserItem) lst[ WIDTH ]; 79 94 80 95 B_UserItem * seekUi( size_t i ) { … … 104 119 MAYBE_EXTERN_C ( 105 120 106 volatile size_t bobs_ops_completed = 0;121 volatile size_t bobs_ops_completed = 0; 107 122 volatile size_t bobs_prog_inserting = 0; 108 123 volatile size_t bobs_prog_removing = 0; 109 124 volatile size_t bobs_prog_removing_end = 0; 110 125 volatile size_t bobs_prog_rollover_flag = 0; 111 // bobs_prog_rem_pos (defined after BOP_REMPROGEND_IS_REMNO_BASED) 126 // bobs_prog_rem_pos (declared obs.h; defined after BOP_REMPROGEND_IS_REMNO_BASED) 127 128 volatile size_t bobs_priv_active_list_no = -1; 129 volatile size_t bobs_priv_list_len = -1; 112 130 113 131 void bobs_seek(size_t i) { … … 118 136 119 137 void bobs_moveNext() { 120 observedItem = BFX_GET_AFTER(B_UserItem, lst , observedItem);138 observedItem = BFX_GET_AFTER(B_UserItem, lst[bobs_priv_active_list_no], observedItem); 121 139 } 122 140 123 141 void bobs_movePrev() { 124 observedItem = BFX_GET_BEFORE(B_UserItem, lst , observedItem);142 observedItem = BFX_GET_BEFORE(B_UserItem, lst[bobs_priv_active_list_no], observedItem); 125 143 } 126 144 127 145 bool bobs_hasCurrent() { 128 return BFX_IS_VALID_POS(B_UserItem, lst , observedItem);146 return BFX_IS_VALID_POS(B_UserItem, lst[bobs_priv_active_list_no], observedItem); 129 147 } 130 148 131 149 void * bobs_getCurrentLoc() { 132 return BFX_DEREF_POS(B_UserItem, lst , observedItem);150 return BFX_DEREF_POS(B_UserItem, lst[bobs_priv_active_list_no], observedItem); 133 151 } 134 152 size_t bobs_getCurrentVal() { 135 B_UserItem * curUI = BFX_DEREF_POS(B_UserItem, lst , observedItem);153 B_UserItem * curUI = BFX_DEREF_POS(B_UserItem, lst[bobs_priv_active_list_no], observedItem); 136 154 return curUI->self_ord; 137 155 } … … 139 157 enum bobs_op_movement_t bobs_op_movement = OP_MOVEMENT; 140 158 enum bobs_op_polarity_t bobs_op_polarity = OP_POLARITY; 159 160 static inline ssize_t signDiv( ssize_t num, size_t denom ) { 161 if ( num >= 0 ) return num / denom; 162 else return -1 - ( ((-num)-1) / denom ); 163 } 164 165 // Abstracts progress on all insertions and on queue removals into one treatment. 166 // `nodeProgress` is a count of nodes inserted or removed, stepping (quickly) through [0..NumNodes] 167 // (rather than steppling slowly through [0..Length]). 168 // Returns the position congruent to the active list number (mod WIDTH) 169 // that is maximally less than `nodeProgress`. 170 // A negative return means no such position is yet reached. 171 // Interpreting this result as last listed (last inserted) vs first unlisted (last removed), 172 // and interpreting `nodeProgress` as advancing from 0 (eg inslast-stack remove) vs 173 // receding from NumNodes-1 (eg insfirst-stack remove), are left to the caller. 174 static ssize_t lastActiveNodeReached( size_t nodeProgress ) { 175 assert( signDiv( 20, 5 ) == 4 ); 176 assert( signDiv( 19, 5 ) == 3 ); 177 assert( signDiv( 6, 5 ) == 1 ); 178 assert( signDiv( 5, 5 ) == 1 ); 179 assert( signDiv( 4, 5 ) == 0 ); 180 assert( signDiv( 3, 5 ) == 0 ); 181 assert( signDiv( 2, 5 ) == 0 ); 182 assert( signDiv( 1, 5 ) == 0 ); 183 assert( signDiv( 0, 5 ) == 0 ); 184 assert( signDiv( -1, 5 ) == -1 ); 185 assert( signDiv( -2, 5 ) == -1 ); 186 assert( signDiv( -2, 5 ) == -1 ); 187 assert( signDiv( -3, 5 ) == -1 ); 188 assert( signDiv( -4, 5 ) == -1 ); 189 assert( signDiv( -6, 5 ) == -2 ); 190 assert( signDiv( -7, 5 ) == -2 ); 191 assert( signDiv( -20, 5 ) == -4 ); 192 assert( signDiv( -21, 5 ) == -5 ); 193 ssize_t activeLenProgress = signDiv( (ssize_t)nodeProgress - (ssize_t)bobs_priv_active_list_no, WIDTH ); // IDW 194 ssize_t activeNodeProgress = activeLenProgress * WIDTH + (ssize_t)bobs_priv_active_list_no; // IWA 195 if ( activeNodeProgress == nodeProgress ) return activeNodeProgress - WIDTH; 196 else return activeNodeProgress; 197 } 198 199 ssize_t bobs_first_valid() { 200 switch(bobs_op_movement) { 201 case stack: return (ssize_t)bobs_priv_active_list_no; 202 case queue: return lastActiveNodeReached( *bobs_prog_rem_pos ) + WIDTH; 203 } 204 assert(0 && "unsupported bobs_op_movement value"); 205 return -1; 206 } 207 ssize_t bobs_last_valid() { 208 switch(bobs_op_movement) { 209 case stack: return lastActiveNodeReached( MIN( (ssize_t)bobs_prog_inserting - (ssize_t)WIDTH, (ssize_t)bobs_priv_list_len - (ssize_t)*bobs_prog_rem_pos - (ssize_t)WIDTH ) ) + WIDTH; 210 case queue: return lastActiveNodeReached( bobs_prog_inserting ); 211 } 212 assert(0 && "unsupported bobs_op_movement value"); 213 return -1; 214 } 141 215 ) 142 216 #endif … … 192 266 // end: copied from https://stackoverflow.com/a/33021408 193 267 268 #ifdef DISABLE_OBSERVATION 269 #define OBS(...) 270 #else 271 #define OBS(...) __VA_ARGS__ 272 #endif 273 274 static volatile bool stop = false; 275 static void sigAlarm( int p __attribute__(( unused )) ) { stop = true; } 276 277 void runtest(const char * argv0, size_t NumNodes, size_t ExperimentDurOpCount ); 278 194 279 int main(int argc, const char *argv[]) { 195 280 196 #ifdef DISABLE_OBSERVATION 197 // define the outbound dependencies as locals, for compiling into nops 198 size_t bobs_ops_completed = 0; 199 size_t bobs_prog_inserting = 0; 200 size_t bobs_prog_removing = 0; 201 size_t bobs_prog_removing_end = 0; 202 size_t bobs_prog_rollover_flag = 0; 203 #endif 204 205 const char * usage_args = "[ExperimentDurSec [CheckDonePeriod [NumNodes [ExperimentDurOpCount [Seed [InterleaveFrac]]]]]]"; 281 const char * usage_args = "[ExperimentDurSec [CheckDonePeriod [ListLen [ExperimentDurOpCount [Seed [InterleaveFrac]]]]]]"; 206 282 const int static_arg_posns = 6; 207 283 208 284 size_t ExperimentDurSec = DefaultExperimentDurSec; 209 285 size_t CheckDonePeriod = DefaultCheckDonePeriod; 210 size_t NumNodes = DefaultNumNodes;286 size_t ListLen = DefaultListLen; 211 287 size_t ExperimentDurOpCount = DefaultExperimentDurOpCount; 212 288 size_t Seed = DefaultSeed; … … 217 293 case 5: Seed = atoi(argv[5]); 218 294 case 4: ExperimentDurOpCount = atol(argv[4]); 219 case 3: NumNodes= atoi(argv[3]);295 case 3: ListLen = atoi(argv[3]); 220 296 case 2: CheckDonePeriod = atoi(argv[2]); 221 297 case 1: ExperimentDurSec = atoi(argv[1]); 222 298 } 223 299 224 // printf("ExperimentDurSec=%d, CheckDonePeriod=%d, NumNodes=%d, ExperimentDurOpCount=%zd, Seed=%d,\n",225 // ExperimentDurSec, CheckDonePeriod, NumNodes, ExperimentDurOpCount, Seed );226 227 if (ExperimentDurSec == 0 || CheckDonePeriod == 0 || NumNodes== 0 || ExperimentDurOpCount == 0 || Seed == 0 ) {300 // printf("ExperimentDurSec=%d, CheckDonePeriod=%d, ListLen=%d, ExperimentDurOpCount=%zd, Seed=%d,\n", 301 // ExperimentDurSec, CheckDonePeriod, ListLen, ExperimentDurOpCount, Seed ); 302 303 if (ExperimentDurSec == 0 || CheckDonePeriod == 0 || ListLen == 0 || ExperimentDurOpCount == 0 || Seed == 0 ) { 228 304 printf("usage: %s %s\n", argv[0], usage_args); 229 305 return -1; … … 236 312 } 237 313 #endif 314 315 OBS( bobs_priv_list_len = ListLen ); 316 const size_t NumNodes = ListLen * WIDTH; 238 317 239 318 ui = (B_UserItem*) malloc( (size_t)NumNodes * (size_t)sizeof(B_UserItem) ); … … 436 515 437 516 #ifndef DISABLE_ITERS 438 #define ITERS_SAVE(lastInsertedElemPtr, lastInsertedIter) (lastInsertedElemPtr)->selfListed = lastInsertedIter 439 #endif 440 441 BFX_INIT(B_UserItem, lst); 517 #define ITERS_SAVE(lastInsertedElemPtr, lastInsertedIter) \ 518 lastInserted[listno] = (lastInsertedElemPtr)->selfListed = lastInsertedIter 519 #endif 520 521 for ( size_t listno = 0; listno < WIDTH; listno ++ ) 522 BFX_INIT(B_UserItem, lst[ listno ]); 442 523 443 524 bobs_init(NumNodes); … … 465 546 #endif 466 547 548 #ifdef __U_CPLUSPLUS__ 549 // uC++ doesn't implement `alarm`---it crashes with "not implemented" at runtime 550 // so, here is an equivalent timer task 551 _Task timer_t { 552 size_t alarmDurSec; 553 void main() { 554 _Accept( ~timer_t ); 555 or _Timeout( uDuration( alarmDurSec ) ) { sigAlarm(0); } 556 } 557 public: 558 timer_t( size_t alarmDurSec ) : alarmDurSec(alarmDurSec) {} 559 }; 560 timer_t timer ( ExperimentDurSec ); 561 #else 562 signal( SIGALRM, sigAlarm ); // setup signal handler 563 alarm( ExperimentDurSec ); // trigger in N seconds 564 #endif 565 566 runtest( argv[0], NumNodes, ExperimentDurOpCount ); 567 568 free(ui); 569 } 570 571 572 void runtest(const char * argv0, const size_t NumNodes, size_t ExperimentDurOpCount ) { 573 574 assert( NumNodes >= WIDTH ); 575 assert( NumNodes % WIDTH == 0 ); 467 576 468 577 size_t privateOpsCompleted = 0; … … 471 580 clock_t start = clock(); 472 581 473 while (elapsed_sec <= (double) ExperimentDurSec && privateOpsCompleted < ExperimentDurOpCount) { 474 for ( size_t t = 0; t < CheckDonePeriod; t += 1 ) { 475 TRACE('a') // insert special first 476 ITERS_SAVE( &ui[0], 477 BOP_INIT(lst, ui[0]) ); 478 TRACE('b') // insert general 479 // Keep lastInserted even on DISABLE_ITERS because it's communication to the remove phase 480 BFX_LISTED_ELEM_T(B_UserItem) lastInserted = BFX_GET_FIRST(B_UserItem, lst); 481 B_UserItem * insertNow = seekUi(1); 482 for ( size_t privateCurInsert = 1; 483 (bobs_prog_inserting = privateCurInsert, privateCurInsert < NumNodes); 484 privateCurInsert += 1 485 ) { 486 assert( insertNow->self_ord == privateCurInsert ); 582 while ( ! stop && privateOpsCompleted < ExperimentDurOpCount ) { 583 584 B_UserItem * insertNow = & ui[ 0 ]; 585 586 #ifdef DISABLE_ITERS 587 #define INSERTION_NEIGHBOUR NOT_SUPPORTED 588 #else 589 BFX_LISTED_ELEM_T(B_UserItem) lastInserted[ WIDTH ]; 590 #define INSERTION_NEIGHBOUR lastInserted[ listno ] 591 #endif 592 593 #ifdef DISABLE_SHUFFLING_INDIRECTION 594 #define HAS_NEXT ( (void*)insertNow < (void*)&ui[NumNodes] ) 595 #define MOVE_NEXT ( insertNow++ ) 596 #else 597 #define HAS_NEXT ( insertNow->self_ord != 0 ) 598 #define MOVE_NEXT ( insertNow = & ui[ insertNow->succ_pos ] ) 599 #endif 600 601 // insert special first 602 for ( size_t listno = 0; listno < WIDTH; listno ++ ) { 603 OBS( bobs_priv_active_list_no = bobs_prog_inserting = listno; ) 604 TRACE('a') 605 ITERS_SAVE( insertNow, 606 BOP_INIT( lst[listno], (*insertNow) ) ); 607 MOVE_NEXT; 608 TRACE('b') 609 } 610 // insert general 611 for ( OBS( size_t privateCurInsert = WIDTH ); HAS_NEXT; ) { 612 for ( size_t listno = 0; listno < WIDTH; (listno ++) ) { 613 OBS( bobs_prog_inserting = privateCurInsert; ) 614 OBS( bobs_priv_active_list_no = listno; ) 487 615 TRACE('-') 488 lastInserted =489 BOP_INSERT( lst , lastInserted, (*insertNow) );616 ITERS_SAVE( insertNow, 617 BOP_INSERT( lst[listno], INSERTION_NEIGHBOUR, (*insertNow) ) ); 490 618 TRACE('+') 491 ITERS_SAVE( insertNow, lastInserted ); 492 #ifdef DISABLE_SHUFFLING_INDIRECTION 493 insertNow++; 494 #else 495 insertNow = & ui[ insertNow->succ_pos ]; 619 OBS( privateCurInsert += 1; ) 620 MOVE_NEXT; 621 } 622 OBS( bobs_prog_inserting = privateCurInsert; ) 623 } 624 #ifndef DISABLE_ITERS 625 BFX_LISTED_ELEM_T(B_UserItem) nextRemoval = BOP_SWITCH_REMDIR ( 626 ui[0].selfListed, // forward starts from first insert 627 lastInserted[ WIDTH - 1 ] // backward starts from last insert 628 ); 496 629 #endif 497 } 498 #ifdef DISABLE_INTERLEAVING 499 // interleaving off, simple removes 500 // (remove logic of 2b01f8eb0956) 501 #ifndef DISABLE_ITERS 502 BFX_LISTED_ELEM_T(B_UserItem) nextRemoval = BOP_SWITCH_REMDIR ( 503 ui[0].selfListed, // forward starts from first insert 504 lastInserted // backward starts from last insert 505 ); 506 #endif 507 TRACE('c') 508 for ( size_t privateCurRemove = 1; 509 (bobs_prog_removing = privateCurRemove, privateCurRemove < NumNodes); 510 privateCurRemove += 1 511 ) { 512 #ifdef DISABLE_ITERS 513 #define curRemovalI ERROR_REQD_ITER_NOT_PROVIDED 514 #else 515 BFX_LISTED_ELEM_T(B_UserItem) curRemovalI = nextRemoval; 516 B_UserItem * curRemovalE = BFX_DEREF_POS(B_UserItem, lst, nextRemoval); 517 #ifdef DISABLE_SHUFFLING_INDIRECTION 518 nextRemoval = (BOP_SWITCH_REMDIR( curRemovalE + 1, curRemovalE - 1 ))->selfListed; 519 #else 520 nextRemoval = ui[ curRemovalE->BOP_SWITCH_REMDIR(succ_pos, pred_pos) ].selfListed; 521 #endif 522 #endif 523 TRACE('-') 524 BOP_REMOVE( lst, curRemovalI ); 525 TRACE('+') 526 } 527 #else 528 // interleaving on, complex removes 529 TRACE('c') // remove general 530 size_t removeProgress [N_INTERLEAVE_ACTION] = { 0, 0 }; 531 #define startItem BOP_SWITCH_REMDIR( iactFwdStartItem, iactRevStartItem ) 532 B_UserItem * removeItem[N_INTERLEAVE_ACTION] = 533 { startItem[OuterActn], startItem[InnerActn] }; 534 for ( InterleaveAction flip = OuterActn 535 ; (bobs_prog_removing = removeProgress[0] + removeProgress[1] + 1, 536 bobs_prog_removing_end = removeProgress[0] + 1, 537 removeProgress[0] + removeProgress[1] < NumNodes - 1 ) 538 ; 539 ) { 540 //printf("--- flip=%d removeProgress[0]=%zd removeProgress[1]=%zd removeItem[flip]->self_ord=%zd\n", flip, removeProgress[0], removeProgress[1], removeItem[flip]->self_ord); 541 TRACE('-') 542 BOP_REMOVE( lst, removeItem[flip]->selfListed ); 543 TRACE('+') 544 545 InterleaveAction nextFlip = removeItem[flip]->later_flip; 546 removeProgress[flip] += 1; 547 removeItem[flip] = & ui[ removeItem[flip]-> BOP_SWITCH_REMDIR(succ_pos, pred_pos) ]; 548 flip = nextFlip; 549 } 550 551 // for ( InterleaveAction flip = OuterActn; 552 // (bobs_prog_removing = removeProgress[0] + removeProgress[1] + 1, 553 // bobs_prog_removing_end = removeProgress[0] + 1, 554 // removeProgress[0] < numNodesItlv[0] && removeProgress[1] < numNodesItlv[1] ); 555 // ) { 556 // TRACE('-') 557 // BOP_REMOVE( lst, removeItem[flip]->selfListed ); 558 // TRACE('+') 559 560 // InterleaveAction nextFlip = removeItem[flip]->later_flip; 561 // removeProgress[flip] += 1; 562 // removeItem[flip] = & ui[ removeItem[flip]-> BOP_SWITCH_REMDIR(succ_pos, pred_pos) ]; 563 // flip = nextFlip; 564 // } 565 // TRACE('X') // remove imbalanced 566 // // most work done under general; it stops when either flip-side's work finishes 567 // // now drain any any stragglers so both flip-sides' work finishes 568 // for ( InterleaveAction flip = 0; flip < N_INTERLEAVE_ACTION; flip ++ ) { 569 // for ( ; (bobs_prog_removing = removeProgress[0] + removeProgress[1] + 1, 570 // bobs_prog_removing_end = removeProgress[0] + 1, 571 // removeProgress[flip] < numNodesItlv[flip] ) 572 // ; 573 // ) { 574 // //printf("--- flip=%d removeProgress[flip]=%zd numNodesItlv[flip]=%zd removeItem[flip]->self_ord=%zd\n", flip, removeProgress[flip], numNodesItlv[flip], removeItem[flip]->self_ord); 575 // TRACE('-') 576 // BOP_REMOVE( lst, removeItem[flip]->selfListed ); 577 // TRACE('+') 578 579 // removeProgress[flip] += 1; 580 // removeItem[flip] = & ui[ removeItem[flip]-> BOP_SWITCH_REMDIR(succ_pos, pred_pos) ]; 581 // } 582 // } 583 #endif // DISABLE_INTERLEAVING 584 TRACE('D') // remove special last 585 BOP_TEARDOWN(lst); 586 TRACE('d') 630 for ( size_t listno = 0; listno < WIDTH; listno += 1 ) { 631 OBS( bobs_priv_active_list_no = listno; ) 632 TRACE('c') 633 } 634 // remove general 635 size_t privateCurRemove = 1; // count 1/<= to observe from the item not yet being removed 636 while ( privateCurRemove <= NumNodes - WIDTH ) // -WIDTH to stop before special last 637 for ( size_t listno = 0; listno < WIDTH; listno += 1 ) { 638 OBS( bobs_prog_removing = privateCurRemove; ) 639 OBS( bobs_priv_active_list_no = listno; ) 640 #ifdef DISABLE_ITERS 641 #define curRemovalI ERROR_REQD_ITER_NOT_PROVIDED 642 #else 643 BFX_LISTED_ELEM_T(B_UserItem) curRemovalI = nextRemoval; 644 B_UserItem * curRemovalE = BFX_DEREF_POS(B_UserItem, lst[listno], nextRemoval); 645 #ifdef DISABLE_SHUFFLING_INDIRECTION 646 nextRemoval = (BOP_SWITCH_REMDIR( curRemovalE + 1, curRemovalE - 1 ))->selfListed; 647 #else 648 nextRemoval = ui[ curRemovalE->BOP_SWITCH_REMDIR(succ_pos, pred_pos) ].selfListed; 649 #endif 650 #endif 651 TRACE('-') 652 BOP_REMOVE( lst[listno], curRemovalI ); 653 TRACE('+') 654 privateCurRemove += 1; 655 } 656 // remove special last 657 for ( size_t listno = 0; listno < WIDTH; listno += 1 ) { 658 OBS( bobs_prog_removing = privateCurRemove; ) 659 OBS( bobs_priv_active_list_no = listno; ) 660 TRACE('D') 661 BOP_TEARDOWN(lst[listno]); 662 TRACE('d') 663 privateCurRemove += 1; 664 } 665 OBS( bobs_prog_removing = privateCurRemove; ) 587 666 588 667 privateOpsCompleted += NumNodes; 589 668 OBS( 590 669 bobs_prog_rollover_flag = 1; 591 670 TRACE('e') … … 596 675 TRACE('f') 597 676 bobs_prog_rollover_flag = 0; 598 TRACE('g') 599 } 600 #ifndef DISABLE_CLOCK_RECHECK 601 clock_t end = clock(); 602 elapsed_sec = ((double)(end - start)) / ((double)CLOCKS_PER_SEC); 603 #endif 604 } 605 #ifdef DISABLE_CLOCK_RECHECK 606 { 607 clock_t end = clock(); 608 elapsed_sec = ((double)(end - start)) / ((double)CLOCKS_PER_SEC); 609 } 610 #endif 611 612 double mean_op_dur_ns = elapsed_sec / ((double)bobs_ops_completed) * 1000 * 1000 * 1000; 613 printf("%s,%zd,%f,%f\n", argv[0], bobs_ops_completed, elapsed_sec, mean_op_dur_ns); 614 615 free(ui); 677 TRACE('g') ) 678 } 679 680 clock_t end = clock(); 681 elapsed_sec = ((double)(end - start)) / ((double)CLOCKS_PER_SEC); 682 683 double mean_op_dur_ns = elapsed_sec / ((double)privateOpsCompleted) * 1000 * 1000 * 1000; 684 printf("%s,%d,%zd,%f,%f\n", argv0, WIDTH, privateOpsCompleted, elapsed_sec, mean_op_dur_ns); 616 685 } -
doc/theses/mike_brooks_MMath/benchmarks/list/fx-cfa-GENERAL.h
r5a95560 r9d3dc40 37 37 #define BFX_GET_AFTER(S, lst, iter) ( & next( * (iter) ) ) 38 38 #define BFX_GET_BEFORE(S, lst, iter) ( & prev( * (iter) ) ) 39 #define BFX_DEREF_POS(S, lst, iter) (iter) 40 41 #ifdef __EXPERIMENTAL_DISABLE_OTAG__ 42 // alt list impl, no tagging: next/prev accessors don't known when "no more elems" 43 // so hack around it in harness: look for leaked abstraction of list head being reported as a regular neighbour 44 #define BFX_IS_VALID_POS(S, lst, iter) ((void*)(iter)!=(void*)(&lst)) 45 #else 46 // normal list impl: next/prev accessors return *0p on "no more elems" 39 47 #define BFX_IS_VALID_POS(S, lst, iter) ((iter)!=NULL) 40 # define BFX_DEREF_POS(S, lst, iter) (iter)48 #endif -
doc/theses/mike_brooks_MMath/benchmarks/list/observation.c
r5a95560 r9d3dc40 7 7 #include <stdio.h> 8 8 #include <stddef.h> 9 #include <sys/param.h>10 9 11 10 #include "observation.h" … … 113 112 printf("%8zd + %6zd/2 + %6zd/2, %6zd@e %6zd_u", bobs_ops_completed, bobs_prog_inserting, bobs_prog_removing, bobs_prog_removing_end, *bobs_prog_rem_pos); 114 113 115 // signed arithmetic allows representating empty range as from=0, to=-1 116 ptrdiff_t validFrom, validTo; 117 switch(bobs_op_movement) { 118 case stack: 119 validFrom = 0; 120 validTo = MIN( (ptrdiff_t)bobs_prog_inserting -1, (ptrdiff_t)NumNodes - (ptrdiff_t)*bobs_prog_rem_pos - 1 ); 121 break; 122 case queue: 123 validFrom = (ptrdiff_t)*bobs_prog_rem_pos; 124 validTo = (ptrdiff_t)bobs_prog_inserting-1; 125 break; 126 default: 127 assert(0 && "unsupported bobs_op_movement value"); 128 } 114 ptrdiff_t validFrom = bobs_first_valid(); 115 ptrdiff_t validTo = bobs_last_valid(); 129 116 130 117 printf(" "); -
doc/theses/mike_brooks_MMath/benchmarks/list/observation.h
r5a95560 r9d3dc40 1 1 #include "proglang.h" 2 2 #include <stdbool.h> 3 #include <stddef.h> 3 4 4 5 … … 24 25 extern volatile size_t const * bobs_prog_rem_pos; 25 26 27 // signed values allows representating empty range as from=0, to=-1 28 ptrdiff_t bobs_first_valid(); 29 ptrdiff_t bobs_last_valid(); 30 26 31 // observation.c defines 27 32 -
doc/theses/mike_brooks_MMath/benchmarks/list/results-smoketest.csv
r5a95560 r9d3dc40 1 202 5-07-25 14:33:37,1,1 10 289637 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,14481850,1.124100,77.6212982 202 5-07-25 14:33:38,1,1 10000 283 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,127350000,1.001588,7.8648453 202 5-07-25 14:33:39,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,73669000,1.031389,14.0003124 202 5-07-25 14:33:40,1,1 10000 283 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,124520000,1.002236,8.0487955 202 5-07-25 14:33:41,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,11000000,1.074396,97.6723646 202 5-07-25 14:33:42,1,1 1000000 3 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,150000000,1.018578,6.7905207 202 5-07-25 14:33:43,1,1 1 1000000 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,11000000,1.058028,96.1843648 202 5-07-25 14:33:45,1,1 100 25601 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,51202000,1.008144,19.6895439 202 5-07-25 14:33:46,1,1 10 289637 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,28963700,1.083887,37.42225610 202 5-07-25 14:33:47,1,1 10000 283 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,124520000,1.012447,8.13079811 202 5-07-25 14:33:48,1,1 1 1000000 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,26000000,1.011152,38.89046212 202 5-07-25 14:33:49,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,11000000,1.071608,97.41890913 202 5-07-25 14:33:50,1,1 1000 3203 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,32030000,1.022850,31.93412414 202 5-07-25 14:33:52,1,1 10 289637 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,14481850,1.096347,75.70490015 202 5-07-25 14:33:53,1,1 100000 29 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,162400000,1.009615,6.21684116 202 5-07-25 14:33:54,1,1 100000 29 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,139200000,1.009525,7.25233517 202 5-07-25 14:33:55,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,11000000,1.055844,95.98581818 202 5-07-25 14:33:56,1,1 100 25601 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,33281300,1.054635,31.68851619 202 5-07-25 14:33:57,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,9830409,1.156687,117.66417920 202 5-07-25 14:33:59,1,1 100000 29 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,171100000,1.010629,5.90665721 202 5-07-25 14:34:00,1,1 10 289637 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,14481850,1.068056,73.75135122 202 5-07-25 14:34:01,1,1 1 10000000 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,10000000,1.513156,151.31560023 202 5-07-25 14:34:05,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,120000000,1.005410,8.37841724 202 5-07-25 14:34:06,1,1 1000 3203 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,73669000,1.027758,13.95102425 202 5-07-25 14:34:07,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,10000000,1.528870,152.88700026 202 5-07-25 14:34:11,1,1 100 25601 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,51202000,1.006337,19.65425227 202 5-07-25 14:34:12,1,1 10000 283 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,124520000,1.017963,8.17509628 202 5-07-25 14:34:13,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,9830409,1.149980,116.98190829 202 5-07-25 14:34:15,1,1 100000 29 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,150800000,1.014836,6.72968230 202 5-07-25 14:34:16,1,1 1 3276803 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,9830409,1.132979,115.25247831 202 5-07-25 14:34:18,1,1 10 289637 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,14481850,1.067593,73.71938032 202 5-07-25 14:34:19,1,1 1 1000000 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,11000000,1.057079,96.09809133 202 5-07-25 14:34:20,1,1 1000 3203 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,73669000,1.005406,13.64761334 202 5-07-25 14:34:21,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,129000000,1.010534,7.83359735 202 5-07-25 14:34:22,1,1 1000000 3 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,162000000,1.005930,6.20944436 202 5-07-25 14:34:23,1,1 1 3276803 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,9830409,1.135083,115.46650837 202 5-07-25 14:34:25,1,1 10 289637 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,14481850,1.067839,73.73636738 202 5-07-25 14:34:26,1,1 100000 29 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,156600000,1.002060,6.39885139 202 5-07-25 14:34:27,1,1 100 25601 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,48641900,1.005337,20.66812840 202 5-07-25 14:34:28,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,76872000,1.016555,13.22399641 202 5-07-25 14:34:29,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,9830409,1.136574,115.61818042 202 5-07-25 14:34:31,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,123000000,1.004886,8.16980543 202 5-07-25 14:34:32,1,1 10 289637 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,14481850,1.089222,75.21290444 202 5-07-25 14:34:33,1,1 1 3276803 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,9830409,1.191476,121.20309545 202 5-07-25 14:34:35,1,1 10000 283 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,110370000,1.002689,9.08479746 202 5-07-25 14:34:36,1,1 10 289637 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,14481850,1.071031,73.95678047 202 5-07-25 14:34:37,1,1 100 25601 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,48641900,1.022545,21.02189748 202 5-07-25 14:34:38,1,1 10 289637 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,14481850,1.101408,76.05437249 202 5-07-25 14:34:40,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,9830409,1.151480,117.13449650 202 5-07-25 14:34:41,1,1 10000 283 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,124520000,1.007859,8.09395351 202 5-07-25 14:34:42,1,1 10 289637 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,14481850,1.101968,76.09304152 202 5-07-25 14:34:44,1,1 10000 283 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,124520000,1.018063,8.17589953 202 5-07-25 14:34:45,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,9830409,1.137307,115.69274554 202 5-07-25 14:34:46,1,1 100 25601 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,53762100,1.044294,19.42435355 202 5-07-25 14:34:48,1,1 100000 29 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,34800000,1.009267,29.00192556 202 5-07-25 14:34:49,1,1 100 25601 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,51202000,1.037505,20.26297857 202 5-07-25 14:34:50,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,9830409,1.150686,117.05372658 202 5-07-25 14:34:51,1,1 1 10000000 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,10000000,1.570977,157.09770059 202 5-07-25 14:34:55,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,73669000,1.004851,13.64007960 202 5-07-25 14:34:56,1,1 100 25601 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,48641900,1.007154,20.70548261 202 5-07-25 14:34:57,1,1 100 25601 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,51202000,1.021808,19.95640862 202 5-07-25 14:34:58,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,162000000,1.018332,6.28600063 202 5-07-25 14:34:59,1,1 100000 29 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,139200000,1.001096,7.19178264 202 5-07-25 14:35:00,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,10000000,1.509163,150.91630065 202 5-07-25 14:35:04,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,10000000,1.523187,152.31870066 202 5-07-25 14:35:08,1,1 1 10000000 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,30000000,1.291843,43.06143367 202 5-07-25 14:35:12,1,1 100000 29 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,133400000,1.017233,7.62543568 202 5-07-25 14:35:13,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,10000000,1.529335,152.93350069 202 5-07-25 14:35:17,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,153000000,1.013427,6.62370670 202 5-07-25 14:35:18,1,1 100 25601 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,51202000,1.019527,19.91185971 202 5-07-25 14:35:19,1,1 100000 29 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,147900000,1.009347,6.82452372 202 5-07-25 14:35:20,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,10000000,1.529478,152.94780073 202 5-07-25 14:35:24,1,1 1 1000000 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,10000000,1.009042,100.90420074 202 5-07-25 14:35:25,1,1 1000 3203 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,70466000,1.008914,14.31774275 202 5-07-25 14:35:26,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,73669000,1.007051,13.66994376 202 5-07-25 14:35:27,1,1 1 10000000 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,10000000,1.508540,150.85400077 202 5-07-25 14:35:31,1,1 10000 283 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,36790000,1.070702,29.10307178 202 5-07-25 14:35:32,1,1 10000 283 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,124520000,1.007902,8.09429879 202 5-07-25 14:35:33,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,10000000,1.514299,151.42990080 202 5-07-25 14:35:37,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,11000000,1.080953,98.26845581 202 5-07-25 14:35:38,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,11000000,1.055062,95.91472782 202 5-07-25 14:35:39,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,73669000,1.038104,14.09146383 202 5-07-25 14:35:40,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,76872000,1.023905,13.31960984 202 5-07-25 14:35:41,1,1 100000 29 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,153700000,1.018344,6.62553085 202 5-07-25 14:35:42,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,123000000,1.015098,8.25282986 202 5-07-25 14:35:44,1,1 1 3276803 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,26214424,1.063951,40.58647387 202 5-07-25 14:35:45,1,1 1000000 3 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,42000000,1.048904,24.97390588 202 5-07-25 14:35:46,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,11000000,1.077116,97.91963689 202 5-07-25 14:35:48,1,1 1000000 3 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,123000000,1.016081,8.26082190 202 5-07-25 14:35:49,1,1 10000 283 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,113200000,1.017333,8.9870411 2026-01-14 13:31:15,1,1 10000 283 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,218531185,0.997842,4.566131 2 2026-01-14 13:31:16,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,254103891,0.997786,3.926685 3 2026-01-14 13:31:18,1,1 10 289637 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,10137295,1.005258,99.164323 4 2026-01-14 13:31:19,1,1 100000 29 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,240960565,0.997563,4.139943 5 2026-01-14 13:31:20,1,1 10000 283 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,190404381,0.997883,5.240862 6 2026-01-14 13:31:21,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,10000000,2.755017,275.501700 7 2026-01-14 13:31:26,1,1 1 1000000 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,8000000,1.042393,130.299125 8 2026-01-14 13:31:27,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,10000000,2.772334,277.233400 9 2026-01-14 13:31:32,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,257335470,0.997170,3.874981 10 2026-01-14 13:31:33,1,1 100 25601 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,48539496,0.996439,20.528417 11 2026-01-14 13:31:34,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,105990473,0.997352,9.409827 12 2026-01-14 13:31:35,1,1 1000000 3 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,220198293,0.997419,4.529640 13 2026-01-14 13:31:36,1,1 100000 29 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,56787974,0.997062,17.557626 14 2026-01-14 13:31:37,1,1 10 289637 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,15350761,1.013997,66.055162 15 2026-01-14 13:31:39,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,102092422,0.997564,9.771186 16 2026-01-14 13:31:40,1,1 100000 29 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,220075548,0.997592,4.532952 17 2026-01-14 13:31:41,1,1 100000 29 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,225015408,0.997433,4.432732 18 2026-01-14 13:31:42,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,10000000,2.766565,276.656500 19 2026-01-14 13:31:47,1,1 1000 3203 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,59710326,0.996931,16.696124 20 2026-01-14 13:31:48,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,10000000,2.769569,276.956900 21 2026-01-14 13:31:53,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,5000000,0.999754,199.950800 22 2026-01-14 13:31:54,1,1 1 10000000 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,10000000,2.798025,279.802500 23 2026-01-14 13:31:59,1,1 1 1000000 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,5000000,1.114745,222.949000 24 2026-01-14 13:32:00,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,6553606,1.652167,252.100447 25 2026-01-14 13:32:03,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,5000000,1.010957,202.191400 26 2026-01-14 13:32:04,1,1 100 25601 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,49589137,0.997162,20.108477 27 2026-01-14 13:32:05,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,5000000,1.027244,205.448800 28 2026-01-14 13:32:06,1,1 1 1000000 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,5000000,1.097968,219.593600 29 2026-01-14 13:32:08,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,102355068,0.997254,9.743084 30 2026-01-14 13:32:09,1,1 100 25601 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,40423979,0.997596,24.678323 31 2026-01-14 13:32:10,1,1 1 1000000 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,5000000,1.095872,219.174400 32 2026-01-14 13:32:11,1,1 10000 283 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,229888258,0.996748,4.335793 33 2026-01-14 13:32:12,1,1 100 25601 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,48129880,0.997287,20.720746 34 2026-01-14 13:32:13,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,5000000,1.016024,203.204800 35 2026-01-14 13:32:14,1,1 100 25601 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,40167969,0.996992,24.820573 36 2026-01-14 13:32:15,1,1 1 3276803 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,6553606,1.701438,259.618598 37 2026-01-14 13:32:18,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,6553606,1.659565,253.229291 38 2026-01-14 13:32:20,1,1 1 10000000 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,10000000,1.712096,171.209600 39 2026-01-14 13:32:24,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,5000000,1.010222,202.044400 40 2026-01-14 13:32:25,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,6553606,1.652375,252.132185 41 2026-01-14 13:32:28,1,1 1 10000000 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,10000000,2.800626,280.062600 42 2026-01-14 13:32:33,1,1 1 3276803 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,9830409,1.457078,148.221503 43 2026-01-14 13:32:35,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,102367880,0.996927,9.738670 44 2026-01-14 13:32:36,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,10000000,2.776255,277.625500 45 2026-01-14 13:32:41,1,1 10000 283 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,210731705,0.997105,4.731633 46 2026-01-14 13:32:42,1,1 10000 283 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,183331079,1.007402,5.494988 47 2026-01-14 13:32:43,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,6553606,1.659047,253.150250 48 2026-01-14 13:32:45,1,1 10 289637 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,11295843,1.001223,88.636413 49 2026-01-14 13:32:46,1,1 100000 29 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,257539111,0.996702,3.870100 50 2026-01-14 13:32:48,1,1 10 289637 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,17378220,1.013402,58.314488 51 2026-01-14 13:32:49,1,1 100000 29 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,193986481,1.007222,5.192228 52 2026-01-14 13:32:50,1,1 1 3276803 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,6553606,1.694047,258.490822 53 2026-01-14 13:32:52,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,106320382,0.997101,9.378268 54 2026-01-14 13:32:53,1,1 1 10000000 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,10000000,2.826834,282.683400 55 2026-01-14 13:32:58,1,1 10 289637 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,15930035,1.008439,63.304255 56 2026-01-14 13:32:59,1,1 1000000 3 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,218307684,0.997486,4.569175 57 2026-01-14 13:33:01,1,1 1000 3203 -1 1 0 ,./perfexp--lq-list--stack-insfirst-allhead,1,108383114,0.997610,9.204478 58 2026-01-14 13:33:02,1,1 100000 29 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,202317746,0.997714,4.931421 59 2026-01-14 13:33:03,1,1 10000 283 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,224146754,0.997379,4.449670 60 2026-01-14 13:33:04,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,278978787,0.997312,3.574867 61 2026-01-14 13:33:05,1,1 100000 29 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,220330197,0.997615,4.527818 62 2026-01-14 13:33:06,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,6553606,1.651677,252.025679 63 2026-01-14 13:33:08,1,1 10 289637 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,17667857,1.006085,56.944371 64 2026-01-14 13:33:09,1,1 10 289637 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,10426932,1.028608,98.649152 65 2026-01-14 13:33:10,1,1 10 289637 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,10137295,1.004726,99.111844 66 2026-01-14 13:33:11,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,183649596,0.996584,5.426552 67 2026-01-14 13:33:13,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,257244321,0.997290,3.876820 68 2026-01-14 13:33:14,1,1 1000000 3 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,232135437,1.007686,4.340940 69 2026-01-14 13:33:15,1,1 1000000 3 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,188214108,0.996753,5.295846 70 2026-01-14 13:33:16,1,1 100 25601 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,46824229,0.998110,21.316101 71 2026-01-14 13:33:17,1,1 10000 283 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,235627498,0.997451,4.233169 72 2026-01-14 13:33:18,1,1 100 25601 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,38196692,1.005921,26.335291 73 2026-01-14 13:33:19,1,1 10 289637 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,16219672,1.000400,61.678189 74 2026-01-14 13:33:20,1,1 1 1000000 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,5000000,1.004890,200.978000 75 2026-01-14 13:33:21,1,1 10000 283 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,218309030,0.997505,4.569234 76 2026-01-14 13:33:23,1,1 1000 3203 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,106051330,0.997313,9.404059 77 2026-01-14 13:33:24,1,1 1 3276803 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,6553606,1.650389,251.829146 78 2026-01-14 13:33:26,1,1 1000000 3 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,59182548,0.996826,16.843242 79 2026-01-14 13:33:27,1,1 1000 3203 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,108770677,0.997598,9.171571 80 2026-01-14 13:33:28,1,1 100 25601 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,38094288,0.996921,26.169829 81 2026-01-14 13:33:29,1,1 1 3276803 -1 1 0 ,./perfexp--lq-tailq--stack-insfirst-allhead,1,6553606,1.694205,258.514931 82 2026-01-14 13:33:31,1,1 100000 29 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,252794392,0.997021,3.944000 83 2026-01-14 13:33:32,1,1 100 25601 -1 1 0 ,./perfexp--cfa-strip--stack-insfirst-allhead,1,49000314,0.997295,20.352829 84 2026-01-14 13:33:34,1,1 100000 29 -1 1 0 ,./perfexp--cfa-cfa--stack-insfirst-allhead,1,240746864,0.997096,4.141678 85 2026-01-14 13:33:35,1,1 1 10000000 -1 1 0 ,./perfexp--cfa-noIter--stack-insfirst-allhead,1,10000000,2.761402,276.140200 86 2026-01-14 13:33:40,1,1 10000 283 -1 1 0 ,./perfexp--cpp-stlref--stack-insfirst-allhead,1,58884942,0.997327,16.936877 87 2026-01-14 13:33:41,1,1 100 25601 -1 1 0 ,./perfexp--cfa-noListed--stack-insfirst-allhead,1,49307526,0.996337,20.206591 88 2026-01-14 13:33:42,1,1 1000 3203 -1 1 0 ,./perfexp--upp-upp--stack-insfirst-allhead,1,100151404,1.007291,10.057682 89 2026-01-14 13:33:43,1,1 10000 283 -1 1 0 ,./perfexp--cfa-mandHead--stack-insfirst-allhead,1,232844476,0.997456,4.283786 90 2026-01-14 13:33:44,1,1 10 289637 -1 1 0 ,./perfexp--cfa-likeLq--stack-insfirst-allhead,1,16509309,1.005273,60.891283 -
doc/theses/mike_brooks_MMath/plots/ListCommon.py
r5a95560 r9d3dc40 14 14 timings = pd.read_csv( 15 15 process.stdout, 16 names=['RunMoment', 'RunIdx', 'Args', 'Program', 'expt_ops_completed', 'expt_elapsed_sec', 'mean_op_dur_ns'], 16 names=['RunMoment', 'RunIdx', 'Args', 'Program', 'Width', 17 'expt_ops_completed', 'expt_elapsed_sec', 'mean_op_dur_ns'], 17 18 dtype={'RunMoment': str, 18 19 'RunIdx': np.int64, 19 20 'Args': str, 20 21 'Program': str, 22 'Width': np.int64, 21 23 'expt_ops_completed': np.int64, 22 24 'expt_elapsed_sec': np.float64, -
libcfa/src/collections/list2.hfa
r5a95560 r9d3dc40 108 108 #define ORIGIN_TAG_NEQ(v1, v2) 0 109 109 110 #define TAGSONLY(...) 111 #define NOTAGS(...) __VA_ARGS__ 112 110 113 #else // Normal 111 114 … … 146 149 ) 147 150 151 #define TAGSONLY(...) __VA_ARGS__ 152 #define NOTAGS(...) 153 148 154 #endif 149 155 … … 270 276 } 271 277 278 // Compile-time memory (cmem) barrier 279 // Prevents the optimizer from reordering instructions across it 280 // Originally included for correctness, though a broken state is not known to be reproducible. 281 // Found to have a critical impact on performance: 282 // - in the positions given by default: generally optimal 283 // - absent: sometimes much slower, depending on the test harness 284 // - in positions (that my be influenced by a principle but) that are arbitrary wrt microarchitecture: typically, much slower 285 #ifdef __EXPERIMENTAL_DISABLE_CMEM_BARRIER__ 286 // upon request, disable cmem barriers 287 #define MAYBE_CMEM_BARRIER 288 #else 289 // by default, enable cmem barriers 290 #define MAYBE_CMEM_BARRIER asm( "" : : : "memory" ) 291 #endif 292 293 // Insert read (location) 294 // One of the read operations that occurs during an insert operation was found to be performace-critical under certain harnesses. 295 // Arguably, the position should not matter if cmem barriers are off. Treating the factors as independent allows for measuring this idea. 296 #ifdef __EXPERIMENTAL_DELAY_INSERT_READ__ 297 // upon request: do the read late (between the cmem barriers); this location is where the read was originally found when this insert read first became a performance-perterbing hypothesis 298 #define MAYBE_INSERT_READ_EARLY(...) 299 #define MAYBE_INSERT_READ_LATE(...) __VA_ARGS__ 300 #else 301 // by default: do the read early (before the first cmem barrier); better performance has been seen here 302 #define MAYBE_INSERT_READ_EARLY(...) __VA_ARGS__ 303 #define MAYBE_INSERT_READ_LATE(...) 304 #endif 305 272 306 forall( tE &, tLinks & | embedded( tE, tLinks, dlink(tE) ) ) { 273 307 … … 283 317 dlink(tE) & linkToInsert = to_insert`inner; 284 318 NOLOOSE( 319 TAGSONLY( 285 320 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.prev)); 286 321 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.next)); 322 ) 287 323 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.prev) == (size_t)&linkToInsert); 288 324 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.next) == (size_t)&linkToInsert); 289 325 ) 290 326 dlink(tE) & list_pos_links = list_pos_real`inner; 291 asm( "" : : : "memory" ); 327 MAYBE_INSERT_READ_EARLY( 328 dlink(tE) & afterLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.next ); 329 ) 330 MAYBE_CMEM_BARRIER; 292 331 size_t list_pos_links_num = (size_t)(& list_pos_links); 293 332 size_t to_insert_prev_num = ORIGIN_TAG_ASGN(list_pos_links_num, list_pos_tag); … … 295 334 linkToInsert.prev = to_insert_prev; 296 335 linkToInsert.next = list_pos_links.next; 336 MAYBE_INSERT_READ_LATE( 297 337 dlink(tE) & afterLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.next ); 338 ) 298 339 size_t afterLinks_prev_tag = ORIGIN_TAG_QUERY((size_t)afterLinks.prev); 299 340 size_t linkToInsert_num = (size_t)(& linkToInsert); … … 301 342 afterLinks.prev = (dlink(tE)*)(afterLinks_prev_num); 302 343 list_pos_links.next = &linkToInsert; 303 asm( "" : : : "memory" );344 MAYBE_CMEM_BARRIER; 304 345 } 305 346 … … 315 356 dlink(tE) & linkToInsert = to_insert`inner; 316 357 NOLOOSE( 358 TAGSONLY( 317 359 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.prev)); 318 360 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.next)); 361 ) 319 362 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.prev) == (size_t)&linkToInsert); 320 363 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.next) == (size_t)&linkToInsert); 321 364 ) 322 365 dlink(tE) & list_pos_links = list_pos_real`inner; 323 asm( "" : : : "memory" ); 366 MAYBE_INSERT_READ_EARLY( 367 dlink(tE) & beforeLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.prev ); 368 ) 369 MAYBE_CMEM_BARRIER; 324 370 size_t list_pos_links_num = (size_t)(& list_pos_links); 325 371 size_t to_insert_next_num = ORIGIN_TAG_ASGN(list_pos_links_num, list_pos_tag); … … 327 373 linkToInsert.next = to_insert_next; 328 374 linkToInsert.prev = list_pos_links.prev; 375 MAYBE_INSERT_READ_LATE( 329 376 dlink(tE) & beforeLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.prev ); 377 ) 330 378 size_t beforeLinks_next_tag = ORIGIN_TAG_QUERY((size_t)beforeLinks.next); 331 379 size_t linkToInsert_num = (size_t)(& linkToInsert); … … 333 381 beforeLinks.next = (dlink(tE)*)(beforeLinks_next_num); 334 382 list_pos_links.prev = &linkToInsert; 335 asm( "" : : : "memory" );383 MAYBE_CMEM_BARRIER; 336 384 } 337 385 … … 355 403 356 404 NOLOOSE( 357 asm( "" : : : "memory" );405 MAYBE_CMEM_BARRIER; 358 406 size_t list_pos_links_num = (size_t) &list_pos_links; 359 407 size_t list_pos_links_tagged_num = ORIGIN_TAG_ENABL( list_pos_links_num ); 360 408 list_pos_links.next = list_pos_links.prev = (dlink(tE)*) list_pos_links_tagged_num; 361 asm( "" : : : "memory" );409 MAYBE_CMEM_BARRIER; 362 410 ) 363 411 return list_pos; … … 482 530 static inline void insert_first( dlist(tE, tLinks) &lst, tE & e ) { 483 531 dlink(tE) & linkToInsert = e`inner; 532 NOLOOSE( 533 TAGSONLY( 484 534 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.prev)); 485 535 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.next)); 536 ) 486 537 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.prev) == (size_t)&linkToInsert); 487 538 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.next) == (size_t)&linkToInsert); 539 ) 488 540 dlink(tE) & list_pos_links = lst; 489 asm( "" : : : "memory" ); 541 MAYBE_INSERT_READ_EARLY( 542 dlink(tE) & afterLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.next ); 543 ) 544 MAYBE_CMEM_BARRIER; 490 545 size_t list_pos_links_num = (size_t)(& list_pos_links); 491 546 size_t to_insert_prev_num = ORIGIN_TAG_ENABL(list_pos_links_num); … … 493 548 linkToInsert.prev = to_insert_prev; 494 549 linkToInsert.next = list_pos_links.next; 550 MAYBE_INSERT_READ_LATE( 495 551 dlink(tE) & afterLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.next ); 552 ) 496 553 size_t linkToInsert_num = (size_t)(& linkToInsert); 497 554 size_t afterLinks_prev_num = linkToInsert_num; 498 555 afterLinks.prev = (dlink(tE)*)(afterLinks_prev_num); 499 556 list_pos_links.next = &linkToInsert; 500 asm( "" : : : "memory" );557 MAYBE_CMEM_BARRIER; 501 558 } 502 559 503 560 static inline void insert_last( dlist(tE, tLinks) &lst, tE & e ) { 504 // insert_before(iter(lst), e);505 561 dlink(tE) & linkToInsert = e`inner; 562 NOLOOSE( 563 TAGSONLY( 506 564 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.next)); 507 565 verify(ORIGIN_TAG_QUERY((size_t)linkToInsert.prev)); 566 ) 508 567 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.next) == (size_t)&linkToInsert); 509 568 verify(ORIGIN_TAG_CLEAR((size_t)linkToInsert.prev) == (size_t)&linkToInsert); 569 ) 510 570 dlink(tE) & list_pos_links = lst; 511 asm( "" : : : "memory" ); 571 MAYBE_INSERT_READ_EARLY( 572 dlink(tE) & beforeLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.prev ); 573 ) 574 MAYBE_CMEM_BARRIER; 512 575 size_t list_pos_links_num = (size_t)(& list_pos_links); 513 576 size_t to_insert_next_num = ORIGIN_TAG_ENABL(list_pos_links_num); … … 515 578 linkToInsert.next = to_insert_next; 516 579 linkToInsert.prev = list_pos_links.prev; 580 MAYBE_INSERT_READ_LATE( 517 581 dlink(tE) & beforeLinks = * (dlink(tE) *) ORIGIN_TAG_CLEAR( (size_t) list_pos_links.prev ); 582 ) 518 583 size_t linkToInsert_num = (size_t)(& linkToInsert); 519 584 size_t beforeLinks_next_num = linkToInsert_num; 520 585 beforeLinks.next = (dlink(tE)*)(beforeLinks_next_num); 521 586 list_pos_links.prev = &linkToInsert; 522 asm( "" : : : "memory" );587 MAYBE_CMEM_BARRIER; 523 588 } 524 589 … … 526 591 verify (&lst != 0p); 527 592 dlink(tE) & list_links = lst; 528 verify (! ORIGIN_TAG_QUERY( (size_t) (& list_links) ) );529 593 // call is valid on empty list; when so, list_links.next and after_links.prev have otags set 530 594 … … 541 605 after_links.prev = (dlink(tE) *) after_links_prev_rslt; 542 606 543 asm( "" : : : "memory" );607 MAYBE_CMEM_BARRIER; 544 608 size_t list_pos_links_num = (size_t) &fst_links; 545 609 size_t list_pos_links_tagged_num = ORIGIN_TAG_ENABL( list_pos_links_num ); 546 610 fst_links.next = fst_links.prev = (dlink(tE)*) list_pos_links_tagged_num; 547 asm( "" : : : "memory" );611 MAYBE_CMEM_BARRIER; 548 612 549 613 tytagref( tLinks, dlink(tE) ) retExt = { fst_links }; … … 568 632 before_links.next = (dlink(tE) *) before_links_next_rslt; 569 633 570 asm( "" : : : "memory" );634 MAYBE_CMEM_BARRIER; 571 635 size_t list_pos_links_num = (size_t) &last_links; 572 636 size_t list_pos_links_tagged_num = ORIGIN_TAG_ENABL( list_pos_links_num ); 573 637 last_links.prev = last_links.next = (dlink(tE)*) list_pos_links_tagged_num; 574 asm( "" : : : "memory" );638 MAYBE_CMEM_BARRIER; 575 639 576 640 tytagref( tLinks, dlink(tE) ) lpLnkTagged = { last_links }; … … 630 694 631 695 } 632
Note:
See TracChangeset
for help on using the changeset viewer.