Add profilingSampleCount to decouple profiler sampling source from opCount (#2067)#2067
Open
mlunar-meta wants to merge 2 commits intometa-pytorch:mainfrom
Open
Add profilingSampleCount to decouple profiler sampling source from opCount (#2067)#2067mlunar-meta wants to merge 2 commits intometa-pytorch:mainfrom
mlunar-meta wants to merge 2 commits intometa-pytorch:mainfrom
Conversation
Contributor
|
@mlunar-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D100730174. |
be63eea to
270ec30
Compare
mlunar-meta
added a commit
to mlunar-meta/torchcomms
that referenced
this pull request
Apr 14, 2026
…Count (meta-pytorch#2067) Summary: Add a `profilingSampleCount_` pointer on `CtranComm` that allows callers to control which counter the profiler uses for sampling decisions. When set, the profiler samples based on the pointed-to counter instead of opCount. When null (default), existing behavior is preserved — opCount is used. MCCL uses this to sample based on a new `collectiveCount_` counter (incremented per allReduce call) rather than opCount, enabling independent sampling control. Changes: - Add `uint64_t* profilingSampleCount_` to CtranComm (nullptr = use opCount) - Add `uint64_t collectiveCount_` to McclComm, incremented in allReduce - Wire `profilingSampleCount_` to `collectiveCount_` in McclComm::finishInit - Profiler::initForEachColl uses profilingSampleCount when set, else opCount - Add AUTODEPS fix for profiler_test BUCK (ncclx-cvars dep) - Add 2 test cases: override via profilingSampleCount, nullptr fallback to opCount Differential Revision: D100730174
mlunar-meta
added a commit
to mlunar-meta/torchcomms
that referenced
this pull request
Apr 14, 2026
…Count (meta-pytorch#2067) Summary: Pull Request resolved: meta-pytorch#2067 Add a `profilingSampleCount_` pointer on `CtranComm` that allows callers to control which counter the profiler uses for sampling decisions. When set, the profiler samples based on the pointed-to counter instead of opCount. When null (default), existing behavior is preserved — opCount is used. MCCL uses this to sample based on a new `collectiveCount_` counter (incremented per allReduce call) rather than opCount, enabling independent sampling control. Changes: - Add `uint64_t* profilingSampleCount_` to CtranComm (nullptr = use opCount) - Add `uint64_t collectiveCount_` to McclComm, incremented in allReduce - Wire `profilingSampleCount_` to `collectiveCount_` in McclComm::finishInit - Profiler::initForEachColl uses profilingSampleCount when set, else opCount - Add AUTODEPS fix for profiler_test BUCK (ncclx-cvars dep) - Add 2 test cases: override via profilingSampleCount, nullptr fallback to opCount Differential Revision: D100730174
270ec30 to
77bf57d
Compare
Summary: Introduce a SamplingRegistry class in ctran/profiler/ that encapsulates the sampling decision (shouldTrace based on opCount % samplingWeight). The Profiler now reads the sampling weight from ctranConfig at construction instead of receiving it as a parameter at every initForEachColl() call. This decouples the profiler sampling from the hardcoded NCCL_CTRAN_ALGO_PROFILING_SAMPLING_WEIGHT CVAR, allowing MCCL to control its sampling rate independently via a new MCCL_CTRAN_ALGO_PROFILING_SAMPLING_WEIGHT CVAR set on ctranConfig before ctranInit(). Changes: - Add SamplingRegistry class (SamplingRegistry.h/.cc) with shouldTrace(opCount) method - Add profilingSamplingWeight field to ctranConfig (default: NCCL_CTRAN_ALGO_PROFILING_SAMPLING_WEIGHT) - Add MCCL_CTRAN_ALGO_PROFILING_SAMPLING_WEIGHT CVAR (int, default: 1) - Profiler::initForEachColl() no longer takes samplingWeight parameter - Update all 7 algorithm call sites to use simplified initForEachColl(opCount) - MCCL sets profilingSamplingWeight on ctranConfig before ctranInit() - Add SamplingRegistryTest with 5 test cases - Update ProfilerTest to construct Profiler with config-based sampling weight Differential Revision: D100706980
mlunar-meta
added a commit
to mlunar-meta/torchcomms
that referenced
this pull request
Apr 14, 2026
…Count (meta-pytorch#2067) Summary: Add a `profilingSampleCount_` pointer on `CtranComm` that allows callers to control which counter the profiler uses for sampling decisions. When set, the profiler samples based on the pointed-to counter instead of opCount. When null (default), existing behavior is preserved — opCount is used. MCCL uses this to sample based on a new `collectiveCount_` counter (incremented per allReduce call) rather than opCount, enabling independent sampling control. Changes: - Add `uint64_t* profilingSampleCount_` to CtranComm (nullptr = use opCount) - Add `uint64_t collectiveCount_` to McclComm, incremented in allReduce - Wire `profilingSampleCount_` to `collectiveCount_` in McclComm::finishInit - Profiler::initForEachColl uses profilingSampleCount when set, else opCount - Add AUTODEPS fix for profiler_test BUCK (ncclx-cvars dep) - Add 2 test cases: override via profilingSampleCount, nullptr fallback to opCount Differential Revision: D100730174
77bf57d to
6a70f4d
Compare
…Count (meta-pytorch#2067) Summary: Pull Request resolved: meta-pytorch#2067 Add a `profilingSampleCount_` pointer on `CtranComm` that allows callers to control which counter the profiler uses for sampling decisions. When set, the profiler samples based on the pointed-to counter instead of opCount. When null (default), existing behavior is preserved — opCount is used. MCCL uses this to sample based on a new `collectiveCount_` counter (incremented per allReduce call) rather than opCount, enabling independent sampling control. Changes: - Add `uint64_t* profilingSampleCount_` to CtranComm (nullptr = use opCount) - Add `uint64_t collectiveCount_` to McclComm, incremented in allReduce - Wire `profilingSampleCount_` to `collectiveCount_` in McclComm::finishInit - Profiler::initForEachColl uses profilingSampleCount when set, else opCount - Add AUTODEPS fix for profiler_test BUCK (ncclx-cvars dep) - Add 2 test cases: override via profilingSampleCount, nullptr fallback to opCount Differential Revision: D100730174
6a70f4d to
236824f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Add a
profilingSampleCount_pointer onCtranCommthat allows callers to control which counter the profiler uses for sampling decisions. When set, the profiler samples based on the pointed-to counter instead of opCount. When null (default), existing behavior is preserved — opCount is used.MCCL uses this to sample based on a new
collectiveCount_counter (incremented per allReduce call) rather than opCount, enabling independent sampling control.Changes:
uint64_t* profilingSampleCount_to CtranComm (nullptr = use opCount)uint64_t collectiveCount_to McclComm, incremented in allReduceprofilingSampleCount_tocollectiveCount_in McclComm::finishInitDifferential Revision: D100730174