Commit 56d811b
chunk the loop in hazptr_domain::load_hazptr_vals
Summary:
In `hazptr_domain::load_hazptr_vals` there is a loop over the hprecs array. When the hprecs array is small, the cost is immaterial. When it is large but sparse, there are two costs:
* The loop-carried dependency on the loop counter. The loop body is too large for automatic unrolling.
* The interleaving of the hazard pointer loads and the branches, which check whether the loaded values is null.
Reduce both costs by
* Chunking the loop. Use `kNumShards` for this.
* In each chunk, loading all of the hzard pointers first and then checking them all.
Reviewed By: DenisYaroshevskiy
Differential Revision: D88280358
fbshipit-source-id: 432f8fef7a0d3fa5414b792eb6bd26682c14b2f51 parent 7868b4b commit 56d811b
1 file changed
Lines changed: 30 additions & 4 deletions
Lines changed: 30 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
486 | 512 | | |
487 | 513 | | |
488 | 514 | | |
| |||
0 commit comments