Skip to content

Add getHint helper to CommOptions#994

Open
pavanbalaji wants to merge 6 commits intometa-pytorch:mainfrom
pavanbalaji:export-D95748622
Open

Add getHint helper to CommOptions#994
pavanbalaji wants to merge 6 commits intometa-pytorch:mainfrom
pavanbalaji:export-D95748622

Conversation

@pavanbalaji
Copy link
Contributor

Summary:
Add a templated getHint() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Differential Revision: D95748622

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 9, 2026
@meta-codesync
Copy link
Contributor

meta-codesync bot commented Mar 9, 2026

@pavanbalaji has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95748622.

pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 9, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Differential Revision: D95748622
pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 9, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Differential Revision: D95748622
@pavanbalaji pavanbalaji force-pushed the export-D95748622 branch 3 times, most recently from 7a84b5d to 40e2462 Compare March 10, 2026 07:08
pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 10, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Reviewed By: kapilsh

Differential Revision: D95748622
pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 10, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Reviewed By: kapilsh

Differential Revision: D95748622
pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 10, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Reviewed By: kapilsh

Differential Revision: D95748622
pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 10, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Reviewed By: kapilsh

Differential Revision: D95748622
Summary:
Move StoreManager.hpp/cpp from the top-level directory to
utils/ to reflect its internal utility status. Update all
include paths across backend bootstrap files and BUCK. Remove
unused includes from utils/Utils.cpp.

Differential Revision: D94889993
Summary:
Move the internal logging utility header from the top-level
torchcomms directory into utils/ alongside other utility files
(Utils.hpp, StoreManager.hpp), and rename it to Logging.hpp
for consistency with the project's naming conventions.

Update all source files that include the header to use the
new path, preserving the existing include style (double-quote,
angle-bracket, and manual tag variants).

Also remove unused caffe2:torch-cpp-cpu dep from
tests/integration/cpp/BUCK (linter fix).

Differential Revision: D94889992
Summary:
Move TorchCommTracingGuard from TorchCommTracing.hpp/.cpp to
utils/TracingGuard.hpp/.cpp and rename the class to TracingGuard.
This matches the existing utils pattern (utils/Logging.hpp,
utils/Utils.hpp, utils/StoreManager.hpp) and reflects that
the class is an internal utility, not a public API.

Updated include paths and class references across all backends
(nccl, ncclx, rccl, rcclx, xccl, gloo, hccl, mccl). The BUCK
target name torchcomms-tracing-cpp is unchanged so downstream
deps are unaffected.

Differential Revision: D95017391
Summary:
A CommOptions always goes to exactly one backend, so the
torchcomm::<backend>:: prefix on hint keys is unnecessary
and overly verbose. This change simplifies all hint keys to
bare names (e.g., "high_priority_stream" instead of
"torchcomm::nccl::high_priority_stream").

The prefix-based filtering loop (starts_with + throw on
unrecognized) was also a latent bug: only high_priority_stream
was handled, so passing both high_priority_stream and
max_event_pool_size would throw on the second key.

Replace the starts_with loops in NCCL/NCCLX/RCCL/RCCLX/XCCL
with direct contains() lookups, matching the pattern already
used for max_event_pool_size and other keys. Add skip sets
in the bootstrap populateNcclConfigFromHints functions so the
TorchComm-layer keys don't trigger spurious "unsupported hint"
warnings. Update all tests and documentation accordingly.

No external callers use the torchcomm:: prefix -- the change
is fully contained within comms/torchcomms/.

Differential Revision: D95712701
Summary:
Move hint key string constants (e.g. kHintHighPriorityStream,
kHintMaxEventPoolSize) from anonymous namespaces in .cpp files
to their respective headers across all backends (NCCL, NCCLX,
RCCL, RCCLX, XCCL, MCCL). This makes the constants accessible
to tests and other translation units.

Update tests and bootstrap skip sets to use the named constants
instead of duplicated magic strings.

Differential Revision: D95748619
pavanbalaji added a commit to pavanbalaji/torchcomms-1 that referenced this pull request Mar 11, 2026
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Reviewed By: kapilsh

Differential Revision: D95748622
Summary:
Pull Request resolved: meta-pytorch#994

Add a templated getHint<T>() method on CommOptions that
handles hint lookup and type conversion in one call. This
replaces the repeated contains()/at()/stoull()/string_to_bool()
pattern across all backends with a single concise call.

Supports bool (via string_to_bool), size_t (via stoull),
and std::string return types with explicit template
instantiations.

Reviewed By: kapilsh

Differential Revision: D95748622
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant