[debug] option to disable validation#334
Merged
Merged
Conversation
ALWAYS_VALIDATE now supports three modes: 0 disables validation, 1 validates once at the end (new default), and 2 validates after each iteration. Updates the client help/print text and SmokeTest preset to match the new semantics. Co-authored-by: Cursor <cursoragent@cursor.com>
When USE_INTERACTIVE=1, validation now runs as a distinct stage that requires an <Enter> keypress instead of running as part of the transfer stage. The interactive validation stage respects ALWAYS_VALIDATE: it is skipped when validation is disabled (0), triggered by <Enter> for validate-at-end (1), and skipped for validate-each-iteration (2) since that mode already validates inline every iteration. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reworks the ALWAYS_VALIDATE setting from a boolean into a 3-mode validation control to better isolate initialization/transfer performance from validation overhead, including updated interactive-mode behavior.
Changes:
- Redefined
ALWAYS_VALIDATEsemantics to:0=disabled,1=validate once at end (default),2=validate each iteration. - Updated backend validation gating logic to match the new semantics and adjusted interactive-mode flow to make validation an explicit, Enter-triggered stage for mode
1. - Updated client defaults/help text and adjusted the SmokeTest preset default to preserve prior validate-each-iteration behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/header/TransferBench.hpp | Implements new validation-mode gating and interactive-mode validation stage behavior. |
| src/client/EnvVars.hpp | Updates ALWAYS_VALIDATE defaults/documentation and runtime display text for the 3 modes. |
| src/client/Presets/SmokeTest.hpp | Changes SmokeTest’s default ALWAYS_VALIDATE to 2 to preserve validate-each-iteration behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Restore the original ALWAYS_VALIDATE semantics and add a disable option: -1 = disable validation entirely (init + transfers only) 0 = validate once after all iterations (default) 1 = validate after each iteration This keeps the previous 0/1 behavior intact while adding -1 as a performance-debug option that skips validation. Interactive mode runs the Enter-gated validation stage only for mode 0; mode 1 validates inline each iteration and mode -1 skips validation. SmokeTest preset now defaults to 1 to preserve its validate-each-iteration behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
- Normalize ALWAYS_VALIDATE on read: warn and clamp values outside
{-1, 0, 1} so runtime behavior matches the documented modes, instead
of silently disabling validation for out-of-range values.
- Avoid validating twice in interactive mode: the interactive stage now
records failures into errResults and the end-of-run ValidateAllTransfers
is skipped for ranks already validated by that stage.
Co-authored-by: Cursor <cursoragent@cursor.com>
scanf("%*c") returns 0 on success and EOF on failure, so the previous
!= 0 check was effectively an EOF check with a misleading message.
Replace with getchar() and report EOF explicitly.
Co-authored-by: Cursor <cursoragent@cursor.com>
In interactive mode, the per-transfer validation summary is now displayed for mode 1 (validate each iteration) as well, without requiring an <Enter> keypress since validation already ran inline. Mode 0 keeps its <Enter>-gated validation path and remains the authoritative validation for its rank; mode 1 only displays results and does not re-record errors (already captured inline). Mode -1 still shows nothing. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
gilbertlee-amd
requested changes
Jul 14, 2026
gilbertlee-amd
left a comment
Collaborator
There was a problem hiding this comment.
With alwaysValidate=0, we can speed things up even more and skip prepare the dstReference arrays.
For now, let's have:
< 0 = no validation
0 = validate at end (default)
0 = validate per iteration
Per maintainer review, switch to range-based semantics: <0 = disable validation 0 = validate once at end (default) >0 = validate after each iteration Any positive value now enables per-iteration validation (preserving the original truthy behavior), so the explicit clamp/normalize helper is removed. When validation is disabled (<0), the dstReference expected-result arrays are no longer allocated or computed, saving setup time. Co-authored-by: Cursor <cursoragent@cursor.com>
- Print "Validation disabled (ALWAYS_VALIDATE < 0)" in the interactive stage (in place of results) and in Utils::PrintResults for SHOW_DETAILS. - Show the "Transfers complete." prefix for per-iteration mode (>0) in interactive output, matching the validate-at-end (0) path. Co-authored-by: Cursor <cursoragent@cursor.com>
Suppress the PrintResults "validation disabled" message when interactive mode is active, since the interactive stage already prints it. Co-authored-by: Cursor <cursoragent@cursor.com>
- Replace exit(1) on rank-0 EOF at the validation prompt with a broadcast so all ranks abort together (return ERR_FATAL) instead of leaving other ranks hung at the following Barrier. - Correct the interactive-block comment: it performs its own comparison pass to display PASS/FAIL, not merely display. Co-authored-by: Cursor <cursoragent@cursor.com>
gilbertlee-amd
approved these changes
Jul 15, 2026
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.
Motivation
Adds a performance debug option that disables validation, so only the initialization and actual transfers execute.
Previously,
ALWAYS_VALIDATEwas a boolean (0 = validate once at the end, 1 = validate every iteration), with no way to skip validation entirely. This makes it difficult to isolate pure transfer/initialization cost from validation overhead.Technical Details
Adds a "disable" option to
ALWAYS_VALIDATEwhile preserving the existing 0/1 behavior (backward compatible):ALWAYS_VALIDATE=-1— validation disabled (init + transfers only)ALWAYS_VALIDATE=0— validate once at the end (default, unchanged)ALWAYS_VALIDATE=1— validate after each iteration (unchanged)Changes:
src/header/TransferBench.hpp: per-iteration validation gated on== 1; end-of-run validation gated on== 0; disabled when== -1.src/client/EnvVars.hpp: updated field comment, help text, and runtime print description for the three modes.src/client/Presets/SmokeTest.hpp: continues to default to1(validate each iteration).USE_INTERACTIVE=1): validation is now a separate stage requiring an<Enter>keypress rather than running as part of the transfer stage. It respectsALWAYS_VALIDATE— skipped for-1,<Enter>-gated for0, and skipped for1(which already validates inline each iteration).Test Plan
make clean && make -j../TransferBench cmdline 1K "1 1 g0 d0 g1"acrossALWAYS_VALIDATE={-1,0,1}andUSE_INTERACTIVE={0,1}.Test Result
ALWAYS_VALIDATE=-1— no validation output; only init + transfers execute (including underUSE_INTERACTIVE=1). Confirmed withAMD_LOG_LEVELthat there's no CopyDeviceToHost at the end.ALWAYS_VALIDATE=0(default) — single validation at end; in interactive mode it waits for<Enter>before validating and printing PASS/FAIL results.ALWAYS_VALIDATE=1— validates each iteration inline; no extra Enter-gated stage in interactive mode.PASS; builds clean with no new warnings.Submission Checklist