Skip to content

[ROCm] Fix feature tile offset in coalesceValuesKernel - #199484

Closed
avbokovoy wants to merge 1 commit into
pytorch:mainfrom
avbokovoy:fix-rocm-coalesce-feature-offset
Closed

avbokovoy wants to merge 1 commit into
pytorch:mainfrom
avbokovoy:fix-rocm-coalesce-feature-offset

Conversation

@avbokovoy

@avbokovoy avbokovoy commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Issue being fixed

Fixes #199483

BC-breaking?

No

Summary (human written only)

This PR fixes the ROCm path of coalesceValuesKernel described in #199483. In #158281, feature tile offset relied on nsegments instead of blockDim.x, so dense sizes wider than 256 (on CDNA) were never written. This PR restores the same offset logic as in CUDA, cleans-up unused arguments and adds regression test.

Agent details (if applicable)

Prepared with Claude Code (AI assistant) and reviewed by me:

Restores the ROCm tile offset to blockIdx.z * blockDim.x * SZ, matching the CUDA branch, in both coalesceValuesKernel overloads. Drops the now unused nsegments kernel argument and merges the ROCm and CUDA dispatch blocks, which became identical. The grid split for large inputs from #158281 is unchanged. Adds test_coalesce_wide_dense_dims to test/test_sparse.py, which compares accelerator and CPU coalesce for dense sizes spanning several tiles. On gfx950 it fails on nightly 2.15.0.dev20260930 and passes with this change. A 1794 case fuzz against CPU coalesce (11 dtypes, nnz up to 70000 including the batched grid path) also passes. Lint: lintrunner reports no issues on the changed files.

cc @jeffdaily @sunway513 @jithunnair-amd @pruthvistony @ROCmSupport @jataylo @hongxiayang @naromero77amd @pragupta @jerrymannil @xinyazhang

@pytorch-bot

pytorch-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/199484

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit af3e212 with merge base d0b8bbb (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot Bot added module: rocm AMD GPU support for Pytorch release notes: sparse release notes category labels Oct 2, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: avbokovoy / name: Andrey Bokovoy (af3e212)

soulitzer added a commit that referenced this pull request Oct 2, 2026
The first day of shadow runs on pytorch/pytorch (347 runs, 01:53-14:10 UTC on
2026-10-02) found three problems.

1. Ten eligible PRs were never analyzed. The labeler adds several labels to a
new PR in the same second, and every label event queued a run in the same
per-PR concurrency group. GitHub keeps one pending run per group, so a later
label's run replaced the pending `open source` run and then skipped itself.
For example, "Remove unused parameters in autograd" got five runs at
07:12:28: both eligible runs were cancelled and the other three skipped. Now
only entry events (the `open source` label and ready_for_review) share the
per-PR group; every other event gets its own group keyed by run id. Entry
events still run one at a time per PR.

2. Four runs (#199436, #199440, #199463, #199484) failed with Claude Code's
`error_max_structured_output_retries`: the worker produced no schema-valid
output within the default 5 attempts. Many successful runs also needed a retry
(4 turns instead of 2). MAX_STRUCTURED_OUTPUT_RETRIES is now 25. Every attempt
is a turn, so --max-turns goes from 5 to 30. A failed run cost about $0.02 per
attempt, so --max-budget-usd goes from 0.50 to 1.50. When the SDK errors like
this, the action writes no execution log and leaves `execution_file` empty.
Stage 2c then opened `Path("")`, which is `.`, and recorded
"IsADirectoryError" as the processing error. It now records "Claude action
wrote no execution log".

3. Eight runs failed the evidence-excerpt check. One cut a long line short (the
case that started this change, #199425). Five skipped lines
inside an excerpt (#197857, #199447, #199471, #199472, #199497). Two turned an
unchanged context line, which also appeared in the `@@` hunk header, into a
fake `-`/`+` pair (#199453, #199461). The worker prompt now says to keep
excerpts short by choosing a shorter run of adjacent lines, never by skipping
or cutting lines, and never to turn unchanged lines or hunk-header text into
changed lines. The validator stays strict: a mismatched excerpt can't be told
apart from an invented one, and a failed run falls back to human triage. The
replay below shows the wording fixes the hunk-header pattern but only partly
helps the other two, so a structural follow-up is still needed.

The same change is being made to pytorch/pytorch and pytorch/ciforge.

Test Plan:

```
cd scripts/auto_pr_triage && python -m unittest discover -p 'test_*.py'
actionlint .github/workflows/auto-pr-triage.yml
```

The worker was replayed locally (claude-sonnet-4-6, --effort low, the CI
flags and the old 5-attempt limits) on the exact inputs of three failed runs:
each run's patch at its analyzed head_sha and CODEOWNERS at its workflow_sha.
Outputs were checked with validate_result. Evidence-excerpt failures:

| PR (pattern)                         | old worker.md | new worker.md |
|--------------------------------------|---------------|---------------|
| #199461 (fake -/+ from hunk header)  | 2/3           | 0/3           |
| #197857 (skipped comment lines)      | 4/4           | 2/3           |
| #199425 (cut a long comment line)    | 2/5           | 3/5           |

The remaining failures still drop two comment lines from the middle of an
excerpt (#197857) or stop a long comment line at the end of a sentence
(#199425).

This PR was authored with an AI assistant (Claude Code).

ghstack-source-id: d937117
Pull-Request-resolved: #199428
soulitzer added a commit that referenced this pull request Oct 2, 2026
The first day of shadow runs on pytorch/pytorch (347 runs, 01:53-14:10 UTC on
2026-10-02) found three problems.

1. Ten eligible PRs were never analyzed. The labeler adds several labels to a
new PR in the same second, and every label event queued a run in the same
per-PR concurrency group. GitHub keeps one pending run per group, so a later
label's run replaced the pending `open source` run and then skipped itself.
For example, "Remove unused parameters in autograd" got five runs at
07:12:28: both eligible runs were cancelled and the other three skipped. Now
only entry events (the `open source` label and ready_for_review) share the
per-PR group; every other event gets its own group keyed by run id. Entry
events still run one at a time per PR.

2. Four runs (#199436, #199440, #199463, #199484) failed with Claude Code's
`error_max_structured_output_retries`: the worker produced no schema-valid
output within the default 5 attempts. Many successful runs also needed a retry
(4 turns instead of 2). MAX_STRUCTURED_OUTPUT_RETRIES is now 25. Every attempt
is a turn, so --max-turns goes from 5 to 30. A failed run cost about $0.02 per
attempt, so --max-budget-usd goes from 0.50 to 1.50. When the SDK errors like
this, the action writes no execution log and leaves `execution_file` empty.
Stage 2c then opened `Path("")`, which is `.`, and recorded
"IsADirectoryError" as the processing error. It now records "Claude action
wrote no execution log".

3. Eight runs failed the evidence-excerpt check. One cut a long line short (the
case that started this change, #199425). Five skipped lines inside an excerpt
(#197857, #199447, #199471, #199472, #199497). Two turned an unchanged line,
which also appeared in the `@@` hunk header, into a fake `-`/`+` pair (#199453,
#199461).

The worker prompt still asks for whole, adjacent lines, and now also says never
to cut or skip lines or to turn unchanged lines or hunk-header text into
changed lines. A local replay showed that wording alone does not stop the
model from dropping comment lines or stopping a long line at the end of a
sentence, so the validator is relaxed as a safety net. Every excerpt line must
still come from the file's patch, in patch order, but lines may be skipped in
between, and a line may stop early if it keeps some text after its marker.
Every character shown still comes from the patch, so the model still cannot
add text; what we give up is that an excerpt may show two lines without the
lines between them. A fake `-`/`+` pair is still rejected, because it claims an
unchanged line changed.

We also considered having the model cite patch line ranges and extracting the
excerpt in the controller, which removes these failures by construction. The
relaxed check fixes almost all of them with a much smaller change.

The same change is being made to pytorch/pytorch and pytorch/ciforge.

Test Plan:

```
cd scripts/auto_pr_triage && python -m unittest discover -p 'test_*.py'
actionlint .github/workflows/auto-pr-triage.yml
```

The worker was replayed locally (claude-sonnet-4-6, --effort low, the CI
flags and the old 5-attempt limits) on the exact inputs of the eight runs that
failed the excerpt check: each run's patch at its analyzed head_sha and
CODEOWNERS at its workflow_sha. Outputs were checked with validate_result.

| Prompt and check                     | Excerpt failures |
|--------------------------------------|------------------|
| old worker.md, old check (3 PRs)     | 8/12             |
| new worker.md, old check (3 PRs)     | 5/11             |
| new worker.md, relaxed check (8 PRs) | 1/21             |

Re-checking the eight original CI outputs with the relaxed check, six pass.
The two that still fail (#199453, #199461), and the one replay failure
(#199453), are all the fake `-`/`+` pair, which stays rejected. An extra
prompt example aimed at that pattern made it worse in a replay, so it is not
included.

This PR was authored with an AI assistant (Claude Code).

ghstack-source-id: 546c754
Pull-Request-resolved: #199428
pytorchmergebot pushed a commit that referenced this pull request Oct 2, 2026
…99428)

The first day of shadow runs on pytorch/pytorch (347 runs, 01:53-14:10 UTC on
2026-10-02) found three problems.

1. Ten eligible PRs were never analyzed. The labeler adds several labels to a
new PR in the same second, and every label event queued a run in the same
per-PR concurrency group. GitHub keeps one pending run per group, so a later
label's run replaced the pending `open source` run and then skipped itself.
For example, "Remove unused parameters in autograd" got five runs at
07:12:28: both eligible runs were cancelled and the other three skipped. Now
only entry events (the `open source` label and ready_for_review) share the
per-PR group; every other event gets its own group keyed by run id. Entry
events still run one at a time per PR.

2. Four runs (#199436, #199440, #199463, #199484) failed with Claude Code's
`error_max_structured_output_retries`: the worker produced no schema-valid
output within the default 5 attempts. Many successful runs also needed a retry
(4 turns instead of 2). MAX_STRUCTURED_OUTPUT_RETRIES is now 25. Every attempt
is a turn, so --max-turns goes from 5 to 30. A failed run cost about $0.02 per
attempt, so --max-budget-usd goes from 0.50 to 1.50. When the SDK errors like
this, the action writes no execution log and leaves `execution_file` empty.
Stage 2c then opened `Path("")`, which is `.`, and recorded
"IsADirectoryError" as the processing error. It now records "Claude action
wrote no execution log".

3. Eight runs failed the evidence-excerpt check. One cut a long line short (the
case that started this change, #199425). Five skipped lines inside an excerpt
(#197857, #199447, #199471, #199472, #199497). Two turned an unchanged line,
which also appeared in the `@@` hunk header, into a fake `-`/`+` pair (#199453,
#199461).

The worker prompt still asks for whole, adjacent lines, and now also says never
to cut or skip lines or to turn unchanged lines or hunk-header text into
changed lines. A local replay showed that wording alone does not stop the
model from dropping comment lines or stopping a long line at the end of a
sentence, so the validator is relaxed as a safety net. Every excerpt line must
still come from the file's patch, in patch order, but lines may be skipped in
between, and a line may stop early if it keeps some text after its marker.
Every character shown still comes from the patch, so the model still cannot
add text; what we give up is that an excerpt may show two lines without the
lines between them. A fake `-`/`+` pair is still rejected, because it claims an
unchanged line changed.

We also considered having the model cite patch line ranges and extracting the
excerpt in the controller, which removes these failures by construction. The
relaxed check fixes almost all of them with a much smaller change.

The same change is being made to pytorch/pytorch and pytorch/ciforge.

Test Plan:

```
cd scripts/auto_pr_triage && python -m unittest discover -p 'test_*.py'
actionlint .github/workflows/auto-pr-triage.yml
```

The worker was replayed locally (claude-sonnet-4-6, --effort low, the CI
flags and the old 5-attempt limits) on the exact inputs of the eight runs that
failed the excerpt check: each run's patch at its analyzed head_sha and
CODEOWNERS at its workflow_sha. Outputs were checked with validate_result.

| Prompt and check                     | Excerpt failures |
|--------------------------------------|------------------|
| old worker.md, old check (3 PRs)     | 8/12             |
| new worker.md, old check (3 PRs)     | 5/11             |
| new worker.md, relaxed check (8 PRs) | 1/21             |

Re-checking the eight original CI outputs with the relaxed check, six pass.
The two that still fail (#199453, #199461), and the one replay failure
(#199453), are all the fake `-`/`+` pair, which stays rejected. An extra
prompt example aimed at that pattern made it worse in a replay, so it is not
included.

This PR was authored with an AI assistant (Claude Code).
Pull Request resolved: #199428
Approved by: https://github.com/janeyx99

@jeffdaily jeffdaily left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The ROCm tile offset blockIdx.z * nsegments * SZ only matched the host grid (grid.z tiles of warp_size * SZ) when nsegments == warp_size; blockDim.x * SZ restores the CUDA indexing and is correct for both wave32 and wave64. I ran the new test's cases on gfx950 without the fix and 60 of 75 give wrong results, so the test covers it. Adding ciflow/trunk for GPU coverage before merge.

Drafted with AI assistance (Claude); reviewed by me.

@jeffdaily jeffdaily added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 2, 2026
@jeffdaily

Copy link
Copy Markdown
Collaborator

@pytorchbot merge

@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
…torch#199428)

The first day of shadow runs on pytorch/pytorch (347 runs, 01:53-14:10 UTC on
2026-10-02) found three problems.

1. Ten eligible PRs were never analyzed. The labeler adds several labels to a
new PR in the same second, and every label event queued a run in the same
per-PR concurrency group. GitHub keeps one pending run per group, so a later
label's run replaced the pending `open source` run and then skipped itself.
For example, "Remove unused parameters in autograd" got five runs at
07:12:28: both eligible runs were cancelled and the other three skipped. Now
only entry events (the `open source` label and ready_for_review) share the
per-PR group; every other event gets its own group keyed by run id. Entry
events still run one at a time per PR.

2. Four runs (pytorch#199436, pytorch#199440, pytorch#199463, pytorch#199484) failed with Claude Code's
`error_max_structured_output_retries`: the worker produced no schema-valid
output within the default 5 attempts. Many successful runs also needed a retry
(4 turns instead of 2). MAX_STRUCTURED_OUTPUT_RETRIES is now 25. Every attempt
is a turn, so --max-turns goes from 5 to 30. A failed run cost about $0.02 per
attempt, so --max-budget-usd goes from 0.50 to 1.50. When the SDK errors like
this, the action writes no execution log and leaves `execution_file` empty.
Stage 2c then opened `Path("")`, which is `.`, and recorded
"IsADirectoryError" as the processing error. It now records "Claude action
wrote no execution log".

3. Eight runs failed the evidence-excerpt check. One cut a long line short (the
case that started this change, pytorch#199425). Five skipped lines inside an excerpt
(pytorch#197857, pytorch#199447, pytorch#199471, pytorch#199472, pytorch#199497). Two turned an unchanged line,
which also appeared in the `@@` hunk header, into a fake `-`/`+` pair (pytorch#199453,
pytorch#199461).

The worker prompt still asks for whole, adjacent lines, and now also says never
to cut or skip lines or to turn unchanged lines or hunk-header text into
changed lines. A local replay showed that wording alone does not stop the
model from dropping comment lines or stopping a long line at the end of a
sentence, so the validator is relaxed as a safety net. Every excerpt line must
still come from the file's patch, in patch order, but lines may be skipped in
between, and a line may stop early if it keeps some text after its marker.
Every character shown still comes from the patch, so the model still cannot
add text; what we give up is that an excerpt may show two lines without the
lines between them. A fake `-`/`+` pair is still rejected, because it claims an
unchanged line changed.

We also considered having the model cite patch line ranges and extracting the
excerpt in the controller, which removes these failures by construction. The
relaxed check fixes almost all of them with a much smaller change.

The same change is being made to pytorch/pytorch and pytorch/ciforge.

Test Plan:

```
cd scripts/auto_pr_triage && python -m unittest discover -p 'test_*.py'
actionlint .github/workflows/auto-pr-triage.yml
```

The worker was replayed locally (claude-sonnet-4-6, --effort low, the CI
flags and the old 5-attempt limits) on the exact inputs of the eight runs that
failed the excerpt check: each run's patch at its analyzed head_sha and
CODEOWNERS at its workflow_sha. Outputs were checked with validate_result.

| Prompt and check                     | Excerpt failures |
|--------------------------------------|------------------|
| old worker.md, old check (3 PRs)     | 8/12             |
| new worker.md, old check (3 PRs)     | 5/11             |
| new worker.md, relaxed check (8 PRs) | 1/21             |

Re-checking the eight original CI outputs with the relaxed check, six pass.
The two that still fail (pytorch#199453, pytorch#199461), and the one replay failure
(pytorch#199453), are all the fake `-`/`+` pair, which stays rejected. An extra
prompt example aimed at that pattern made it worse in a replay, so it is not
included.

This PR was authored with an AI assistant (Claude Code).
Pull Request resolved: pytorch#199428
Approved by: https://github.com/janeyx99
cyyever pushed a commit to BakeLab/pytorch that referenced this pull request Oct 11, 2026
## Issue being fixed

Fixes pytorch#199483

## BC-breaking?

No

## Summary (human written only)

This PR fixes the ROCm path of `coalesceValuesKernel` described in pytorch#199483. In pytorch#158281, feature tile offset relied on `nsegments` instead of blockDim.x, so dense sizes wider than 256 (on CDNA) were never written. This  PR restores the same offset logic as in CUDA, cleans-up unused arguments and adds regression test.

## Agent details (if applicable)

> Prepared with Claude Code (AI assistant) and reviewed by me:
>
> Restores the ROCm tile offset to blockIdx.z * blockDim.x * SZ, matching the CUDA branch, in both coalesceValuesKernel overloads. Drops the now unused nsegments kernel argument and merges the ROCm and CUDA dispatch blocks, which became identical. The grid split for large inputs from pytorch#158281 is unchanged. Adds test_coalesce_wide_dense_dims to test/test_sparse.py, which compares accelerator and CPU coalesce for dense sizes spanning several tiles. On gfx950 it fails on nightly 2.15.0.dev20260930 and passes with this change. A 1794 case fuzz against CPU coalesce (11 dtypes, nnz up to 70000 including the batched grid path) also passes. Lint: lintrunner reports no issues on the changed files.

Pull Request resolved: pytorch#199484
Approved by: https://github.com/jeffdaily
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 15, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 16, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 16, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 17, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 19, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 19, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 19, 2026
…6472)

Summary:
Pull Request resolved: pytorch#6472

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.

Pull Request resolved: pytorch#6451

Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 19, 2026
…6472)

Summary:

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.


Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
q10 pushed a commit to q10/FBGEMM that referenced this pull request Oct 19, 2026
…6472)

Summary:
Pull Request resolved: pytorch#6472

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.

Pull Request resolved: pytorch#6451

Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10
meta-codesync Bot pushed a commit to pytorch/FBGEMM that referenced this pull request Oct 20, 2026
Summary:
Pull Request resolved: #6472

X-link: https://github.com/facebookresearch/FBGEMM/pull/3318

The skips on test_backward_none, test_backward_none_v1, test_backward_sgd_writeback, test_backward_sgd_writeback_first_feature_only and test_backward_sgd_writeback_nobag were meant to apply only to GitHub ROCm runners, but the condition used running_on_github, which is a tuple and therefore always true, so the tests were skipped on every ROCm run.

With the skips removed, four of these tests failed on ROCm because the reference gradients call sparse coalesce on the GPU, which returned garbage for dense sizes above 256 on ROCm. That PyTorch bug is fixed by pytorch/pytorch#199484 and the fix is in PyTorch nightlies from 2026-10-03 onward. FBGEMM kernels were not affected.

This removes the five skip decorators and the now unused running_on_github imports.

Pull Request resolved: #6451

Reviewed By: spcyppt

Differential Revision: D125069873

Pulled By: q10

fbshipit-source-id: 55d913da531fa66083c73cb5b61adf62c8c94236
torchxpubot pushed a commit to intel/torch-xpu-ops that referenced this pull request Nov 17, 2026
coalesce_values_kernel is launched with a work-group of 64 work-items
along
the feature dimension, each handling SZ=4 features, so a work-group owns
a
256-wide tile (startFeature already offsets by get_local_range(1) * SZ).
Within the tile, however, each work-item stepped by C10_WARP_SIZE, which
is
a hard-coded 32 on non-ROCm builds. The 64 work-items therefore covered
offsets 0-159 only, with 32-159 computed twice. The bug surfaced now
because
test_coalesce_wide_dense_dims (added upstream in
[#199484](pytorch/pytorch#199484) together with
the equivalent ROCm
fix) is the first test with dense sizes above 160.
    
Using item.get_local_range(1) instead matches the CUDA kernel's
blockDim.x. Reading the width from the item rather than hard-coding 64
keeps
the kernel correct if local_range is changed later.
   
Fixes [#6073](#6073)

Co-authored-by: Benedykt Bela <[email protected]>

This branch was previously deployed

1 inactive deployment
bedrock — af3e2121 Deployed Oct 2, 2026 by pytorchbot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged module: rocm AMD GPU support for Pytorch open source release notes: sparse release notes category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ROCm] Sparse COO coalesce returns garbage values when the dense size exceeds one tile

4 participants