Return an empty stack, not a blank frame, when no trace is available (#3855) - #3855
Open
Scusemua wants to merge 2 commits into
Open
Return an empty stack, not a blank frame, when no trace is available (#3855)#3855Scusemua wants to merge 2 commits into
Scusemua wants to merge 2 commits into
Conversation
Contributor
|
@Scusemua has exported this pull request. If you are a Meta employee, you can view the originating Diff in D117752032. |
Scusemua
force-pushed
the
export-D117752032
branch
from
August 28, 2026 15:01
bec9359 to
deaa02b
Compare
Scusemua
added a commit
to Scusemua/torchcomms
that referenced
this pull request
Aug 28, 2026
…eta-pytorch#3855) Summary: `captureNativeErrorStack()` promises "an empty vector when it is unavailable", but does not deliver it. `folly::split('\n', "", v)` yields a vector holding one empty string, so an unavailable trace is reported to Scuba as a single blank frame rather than as no frames. Two paths reach that empty string, and only one was considered. The header guarded on `__has_include(<dwarf.h>)`, treating a missing header as the only way capture can be unavailable. But `Symbolizer.h:292-293` documents that the **real** implementation also returns `""` when a trace is not available, so the bug is reachable in a build with a fully working symbolizer. Gating on a header was never the right test. This replaces the header probe with a test of the actual result. `Symbolizer.h` is now included unconditionally -- it already supplies an inline stub returning `""` in builds without a symbolizer, so duplicating folly's capability macros here served no purpose -- and the empty case is handled where it is observable. `folly::split` also now ignores empty tokens, so a trailing newline no longer contributes a blank trailing frame. The split/demangle/`skipInternalFrames` sequence is unchanged and moves intact into `detail::normalizeStackTrace`, which is exposed so the behaviour can be tested directly. Without that seam the empty case could only be reached by building against a folly without a symbolizer, which is not something a unit test can arrange. No behavioural change for a healthy capture: the same frames, in the same order, with the same plumbing frames stripped. Differential Revision: D117752032
Summary:
`build_mccl.sh` already converts `TORCH_CUDA_ARCH_LIST` into
`-DCMAKE_CUDA_ARCHITECTURES`, but only for wheel builds. The iterative and
feedstock paths leave it unset, CMake falls back to its own default of `75`,
and every ctran/mccl TU compiles -- and device-links -- for `sm_75` on top of
the requested arch. Visible in CI as:
-- prims CUDA_ARCHITECTURES: OFF (from CMAKE_CUDA_ARCHITECTURES=75)
"--generate-code=arch=compute_75,code=[compute_75,sm_75]" ... -gencode=arch=compute_90a,code=sm_90a
This drops the wheel-only gate. The inner guard is kept, so a caller-supplied
`-DCMAKE_CUDA_ARCHITECTURES` still wins.
**Measured, not assumed.** Two CI runs of the same source, differing only in
this setting, both reaching `[708/712]` and stopping at the same pre-existing
link error (T286255802):
arch=75 (today) 1h16m55s min free 15.62 GiB peak scratch 4.38 GiB
arch=90a 43m35s min free 16.34 GiB peak scratch 3.66 GiB
-43% +736 MiB -16%
The case for landing this is **build time**, not disk. 43% is large and
unambiguous. The scratch improvement is real but both arms finished with 15+
GiB free on a 26 GiB tmpfs, so this run does not demonstrate it prevents the
ENOSPC failures -- those occurred on smaller workers not reproduced here.
Two honest caveats:
- The measurement moves two things at once. `comms/prims/CMakeLists.txt`
filters only 5x-8x, so 90a survives and prims goes from
`CUDA_ARCHITECTURES: OFF` to `90a`. The experiment therefore ADDS prims
codegen while removing ctran/mccl's sm_75, which biases against the change:
the 43% is a lower bound, not an inflated figure.
- n=1 per arm.
Also deletes the dead architecture filters in `comms/ctran/CMakeLists.txt`.
All four (`compute_50/60/70/75`) were inert for three independent reasons:
`CMAKE_CUDA_FLAGS` is a string not a list, so `list(FILTER)` could only drop
the whole element; the regexes do not match CMake's actual
`arch=compute_NN,code=[compute_NN,sm_NN]` emission; and the architecture comes
from the `CUDA_ARCHITECTURES` target property rather than the flags string. The
trailing `message(status ...)` used a lowercase mode string, so it never
printed as a status line and existed only to show the deleted filters' result.
**Blast radius.** `conda/feedstock/mccl/build.sh:20` invokes `build_mccl.sh`
with no wheel flag, so this changes feedstock behavior for the first time.
Reviewed By: saifhhasan, shr
Differential Revision: D117526986
…eta-pytorch#3855) Summary: `captureNativeErrorStack()` promises "an empty vector when it is unavailable", but does not deliver it. `folly::split('\n', "", v)` yields a vector holding one empty string, so an unavailable trace is reported to Scuba as a single blank frame rather than as no frames. Two paths reach that empty string, and only one was considered. The header guarded on `__has_include(<dwarf.h>)`, treating a missing header as the only way capture can be unavailable. But `Symbolizer.h:292-293` documents that the **real** implementation also returns `""` when a trace is not available, so the bug is reachable in a build with a fully working symbolizer. Gating on a header was never the right test. This replaces the header probe with a test of the actual result. `Symbolizer.h` is now included unconditionally -- it already supplies an inline stub returning `""` in builds without a symbolizer, so duplicating folly's capability macros here served no purpose -- and the empty case is handled where it is observable. `folly::split` also now ignores empty tokens, so a trailing newline no longer contributes a blank trailing frame. The split/demangle/`skipInternalFrames` sequence is unchanged and moves intact into `detail::normalizeStackTrace`, which is exposed so the behaviour can be tested directly. Without that seam the empty case could only be reached by building against a folly without a symbolizer, which is not something a unit test can arrange. No behavioural change for a healthy capture: the same frames, in the same order, with the same plumbing frames stripped. Differential Revision: D117752032
Scusemua
force-pushed
the
export-D117752032
branch
from
August 28, 2026 15:40
deaa02b to
de8b685
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:
captureNativeErrorStack()promises "an empty vector when it is unavailable",but does not deliver it.
folly::split('\n', "", v)yields a vector holding oneempty string, so an unavailable trace is reported to Scuba as a single blank
frame rather than as no frames.
Two paths reach that empty string, and only one was considered. The header
guarded on
__has_include(<dwarf.h>), treating a missing header as the only waycapture can be unavailable. But
Symbolizer.h:292-293documents that thereal implementation also returns
""when a trace is not available, so thebug is reachable in a build with a fully working symbolizer. Gating on a header
was never the right test.
This replaces the header probe with a test of the actual result.
Symbolizer.his now included unconditionally -- it already supplies an inline stub returning
""in builds without a symbolizer, so duplicating folly's capability macroshere served no purpose -- and the empty case is handled where it is observable.
folly::splitalso now ignores empty tokens, so a trailing newline no longercontributes a blank trailing frame.
The split/demangle/
skipInternalFramessequence is unchanged and moves intactinto
detail::normalizeStackTrace, which is exposed so the behaviour can betested directly. Without that seam the empty case could only be reached by
building against a folly without a symbolizer, which is not something a unit
test can arrange.
No behavioural change for a healthy capture: the same frames, in the same order,
with the same plumbing frames stripped.
Differential Revision: D117752032