Skip to content

Reuse forward histograms in Triton TBE backward (#4491) - #4491

Closed
stashuk-olek wants to merge 8 commits into
meta-pytorch:mainfrom
stashuk-olek:export-D114284800
Closed

Reuse forward histograms in Triton TBE backward (#4491)#4491
stashuk-olek wants to merge 8 commits into
meta-pytorch:mainfrom
stashuk-olek:export-D114284800

Conversation

@stashuk-olek

@stashuk-olek stashuk-olek commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary:

Reuse exact counts from an eligible leading, unique small-table feature during exact rowwise Adagrad backward. Immutable plans carry actual table geometry, compensated FP16 high/residual matrix products preserve FP32 accuracy, and scalar validity enables safe fallback for long bags, aliases, graph capture, weighted inputs, and VBE.

Reviewed By: axeisghost

Differential Revision: D114284800

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 5, 2026
@meta-codesync

meta-codesync Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

@stashuk-olek has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114284800.

@meta-codesync meta-codesync Bot changed the title BWD TBE histogram approach BWD TBE histogram approach (#4491) Aug 5, 2026
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 5, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 5, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 5, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 5, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
@stashuk-olek
stashuk-olek force-pushed the export-D114284800 branch 2 times, most recently from 06409a7 to a30dc3f Compare August 6, 2026 16:19
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
@stashuk-olek
stashuk-olek force-pushed the export-D114284800 branch 2 times, most recently from 35adc7e to 72eee9c Compare August 6, 2026 20:11
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
@stashuk-olek
stashuk-olek force-pushed the export-D114284800 branch 2 times, most recently from 9f3125e to 5e540b8 Compare August 6, 2026 23:04
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 6, 2026
Summary:

Same histogram/count idea from fwd, but this time for bwd.

Reviewed By: axeisghost

Differential Revision: D114284800
@meta-codesync meta-codesync Bot changed the title BWD TBE histogram approach (#4491) Reuse forward histograms in Triton TBE backward Aug 7, 2026
Summary:

Use BoundsCheckMode.V2 for Triton TBE standalone index validation. This preserves the existing warning and offset-repair behavior while reducing validation overhead before Triton forward.

Reviewed By: axeisghost, TroyGarden

Differential Revision: D114279989
Summary:

Validate and repair indices inside supported unweighted, non-VBE Triton forward kernels. Unsupported configurations retain the CUDA v2 fallback, while fused checked loads preserve warning accumulation without a separate full-index pass.

Reviewed By: TroyGarden, axeisghost

Differential Revision: D114284802
)

Summary:

Convert long bags over small tables into per-bag row histograms followed by a tensor-core dot. Generic row, dimension, and bag-size predicates select the route, and checked loads preserve fused bounds behavior.

Reviewed By: axeisghost

Differential Revision: D114273027
Summary:

Restructure short- and long-run gradient accumulation to reduce serialized reduction pressure. The new reduction schedule exposes more independent work while preserving the existing exact rowwise optimizer update.

Reviewed By: axeisghost

Differential Revision: D114273026
)

Summary:

Reduce the dout reduction tile from 16 to 8 in the unweighted short-run, separate long-run accumulation, and fused long-run kernels. The smaller tile reduces live vector state and register pressure on B200 while retaining FP32 accumulation and the existing rowwise optimizer update. Weighted kernels remain unchanged.

Reviewed By: axeisghost

Differential Revision: D114403703
Summary:

Process multiple bags per Triton program where the workload has enough parallelism. This amortizes program overhead and exposes independent loads without changing the embedding reduction.

Reviewed By: axeisghost

Differential Revision: D114280197
Summary:

Issue up to eight independent index gathers per loop iteration on profitable long-bag shapes. The wider loop increases memory-level parallelism while retaining the four-wide path for shapes where register pressure dominates.

Reviewed By: axeisghost

Differential Revision: D114280947
Summary:

Reuse exact counts from an eligible leading, unique small-table feature during exact rowwise Adagrad backward. Immutable plans carry actual table geometry, compensated FP16 high/residual matrix products preserve FP32 accuracy, and scalar validity enables safe fallback for long bags, aliases, graph capture, weighted inputs, and VBE.

Reviewed By: axeisghost

Differential Revision: D114284800
stashuk-olek added a commit to stashuk-olek/torchrec that referenced this pull request Aug 8, 2026
Summary:

Reuse exact counts from an eligible leading, unique small-table feature during exact rowwise Adagrad backward. Immutable plans carry actual table geometry, compensated FP16 high/residual matrix products preserve FP32 accuracy, and scalar validity enables safe fallback for long bags, aliases, graph capture, weighted inputs, and VBE.

Reviewed By: axeisghost

Differential Revision: D114284800
@meta-codesync meta-codesync Bot changed the title Reuse forward histograms in Triton TBE backward Reuse forward histograms in Triton TBE backward (#4491) Aug 8, 2026
@meta-codesync meta-codesync Bot closed this in 170d6e4 Aug 8, 2026
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 Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant