Commit 790db13
Refactor LeafNodeRank: split DLRM functions, async DLRM, Silesia response generator (facebookresearch#709)
Summary:
Pull Request resolved: facebookresearch#709
Several cleanups in LeafNodeRank, all motivated by the leaf-only hot-func breakdown which surfaced ~15% of CPU on server-side response RNG and the misleading-named dlrmInferenceServerSideDataGeneration:
1. Split DLRM inference into two functions, both async (return folly::Future<int>):
- dlrmInferenceServerSide: inference path where features are generated inside DLRM::infer (server-side)
- dlrmInferenceClientSide: inference path that uses DLRM::inferWithFeatures with client-provided dense+sparse features
The old name dlrmInferenceServerSideDataGeneration hid the actual ML inference call (this_thread.dlrm_ranker->infer) inside a function whose name suggested it was just generating feature data. The new names are honest. A shared shardInferences() helper distributes work across cpu_threads_arg.
2. Rewrite DLRMRequestHandler to be fully async with a single future chain (DLRM inference -> I/O sleep -> compression -> pointer chase -> generate+send response). The previous code blocked synchronously on the inference future via .get() before starting the rest of the pipeline. Now the handler thread returns immediately after kicking off the chain.
3. Pick the right inference function based on what the client sent: if request.dlrm_features() is set, use dlrmInferenceClientSide (no server RNG for inputs); otherwise dlrmInferenceServerSide.
4. Remove the dead `else if (g_workload_type == DLRM)` branches from PageRankRequestHandler and AsyncPageRankRequestHandler. DLRM workload requests use kDLRMRequestType, which routes to DLRMRequestHandler (registered separately in main()), so the DLRM branch in PageRank handlers was unreachable.
5. New Silesia-backed server response generator (generators/SilesiaResponseGenerator.h). When the server is started with --silesia_dir, response RankingObjects/RankingStorys are populated by slicing bytes out of the mmap'd Silesia corpus instead of running xor128() RNG. Replaces ~15% of leaf CPU previously spent on RNG (mersenne_twister, generateRandomString, xor128) with cheap memcpy from a hot mmap. The bytes have realistic entropy for downstream ZSTD compression.
6. Added LeafNodeRank --silesia_dir option and plumbed through run.sh. The same --silesia-dir flag now provides bytes both to DriverNodeRank's story_batch and to the server's response generator.
Reviewed By: charles-typ
Differential Revision: D1031001251 parent 1b1c8a2 commit 790db13
5 files changed
Lines changed: 476 additions & 139 deletions
File tree
- packages/feedsim
- third_party/src/workloads/ranking
- generators
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
653 | 653 | | |
654 | 654 | | |
655 | 655 | | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
656 | 668 | | |
657 | 669 | | |
658 | 670 | | |
| |||
663 | 675 | | |
664 | 676 | | |
665 | 677 | | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
666 | 685 | | |
667 | 686 | | |
668 | 687 | | |
| |||
686 | 705 | | |
687 | 706 | | |
688 | 707 | | |
| 708 | + | |
689 | 709 | | |
690 | 710 | | |
691 | 711 | | |
| |||
731 | 751 | | |
732 | 752 | | |
733 | 753 | | |
734 | | - | |
| 754 | + | |
| 755 | + | |
735 | 756 | | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
| 757 | + | |
744 | 758 | | |
745 | 759 | | |
746 | 760 | | |
| |||
0 commit comments