Commit ca62edd
authored
Swept the stack-heavy measurement across placements, and qualified its result (#638)
#636 reported that a stack in BTCM gave a threefold tighter spread than DRAM0
for stack-heavy work. That measurement used a single code placement, which is
the methodology #631 and #633 exist to correct: the cache benchmark got an
alignment sweep and the interrupt handler got one, and this measurement never
did. It was noticed when #637 added two threads to the same image and the figure
moved -- both spreads came out near 6500 and the minima rose 15%.
The recursive body is now generated at four placements and all four are
measured, per placement, in one image.
placement BTCM min / spread DRAM0 min / spread
offset 0 41854 / 6850 42036 / 6880
offset 16 48670 / 1946 48792 / 1978
offset 32 42388 / 6914 42752 / 7018
offset 48 48914 / 1860 49198 / 6786
Reproducible across runs to within a few hundred cycles.
Spread is dominated by code placement rather than by the memory holding the
stack. It ranges from 1860 to 6914 depending on where the body falls in a cache
line, and placement also moves the minimum by 17%, from 41854 to 49214. Against
that, the memory contributes a consistent but small advantage: BTCM's minimum is
lower at all four placements, by 0.4% to 0.9%.
BTCM's spread beats DRAM0's decisively at one placement of the four, offset 48,
at 1860 against 6786. At the other three the two are within 2% of each other.
So the effect #636 reported is real where it occurs and is not a property of the
part: quoting it as one invited the reader to expect it everywhere.
#636's claim should be read as qualified by this. A stack in BTCM buys a small
consistent improvement in the best case and a large improvement in spread at
some code placements and not others. Anyone building a determinism argument on
it needs the placement sweep in the loop, not a single figure.
The pad nops that displace each placement execute on every recursion level
rather than once, so each placement carries a slightly different constant cost,
about 0.6% at the widest. That cancels in the BTCM against DRAM0 comparison,
which is made at the same placement, and does not affect spread within one.
Assisted-by: Claude Code (Opus 5) <noreply@anthropic.com>1 parent 1ef4933 commit ca62edd
1 file changed
Lines changed: 119 additions & 63 deletions
Lines changed: 119 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| |||
301 | 302 | | |
302 | 303 | | |
303 | 304 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
308 | 309 | | |
309 | 310 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
326 | 354 | | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
331 | 359 | | |
332 | | - | |
333 | | - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
334 | 364 | | |
335 | 365 | | |
336 | 366 | | |
| |||
345 | 375 | | |
346 | 376 | | |
347 | 377 | | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
348 | 384 | | |
349 | 385 | | |
350 | 386 | | |
351 | 387 | | |
352 | 388 | | |
353 | | - | |
| 389 | + | |
354 | 390 | | |
355 | 391 | | |
356 | 392 | | |
357 | 393 | | |
358 | 394 | | |
359 | | - | |
360 | | - | |
| 395 | + | |
| 396 | + | |
361 | 397 | | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | 398 | | |
371 | | - | |
| 399 | + | |
| 400 | + | |
372 | 401 | | |
373 | | - | |
| 402 | + | |
374 | 403 | | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
382 | 436 | | |
383 | 437 | | |
384 | 438 | | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
389 | 439 | | |
390 | 440 | | |
391 | 441 | | |
| |||
551 | 601 | | |
552 | 602 | | |
553 | 603 | | |
554 | | - | |
| 604 | + | |
555 | 605 | | |
556 | | - | |
557 | | - | |
| 606 | + | |
558 | 607 | | |
| 608 | + | |
559 | 609 | | |
560 | 610 | | |
561 | 611 | | |
562 | | - | |
563 | | - | |
564 | 612 | | |
565 | 613 | | |
| 614 | + | |
| 615 | + | |
566 | 616 | | |
| 617 | + | |
567 | 618 | | |
568 | | - | |
| 619 | + | |
| 620 | + | |
569 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
570 | 626 | | |
571 | | - | |
| 627 | + | |
572 | 628 | | |
573 | | - | |
| 629 | + | |
574 | 630 | | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
580 | 636 | | |
581 | 637 | | |
582 | 638 | | |
| |||
0 commit comments