Skip to content

Conversation

@SS-JIA
Copy link
Contributor

@SS-JIA SS-JIA commented Dec 22, 2025

Summary:
The tensor_no_copy_transpose_test was crashing with a segmentation fault when
testing matrix multiplication with a virtually transposed tensor. The test
helper function record_matmul_texture3d() always used the matmul_naive shader
variant, even when mat2 was transposed, causing a shader variant mismatch that
led to invalid descriptor bindings and a crash in the NVIDIA Vulkan driver.

This change adds a mat2_is_transposed parameter (default=false) to
record_matmul_texture3d() to properly select between matmul_naive and
matmul_transposed_naive shader variants. The implementation now mirrors the
production code logic in MatMul.cpp which correctly handles this case.

Changes:

  • Added mat2_is_transposed parameter to record_matmul_texture3d() declaration
  • Rewrote record_matmul_texture3d() to select correct shader variant based on
    transpose flag and properly construct push constants
  • Updated test call to pass mat2_is_transposed=true when needed

Impact:

  • Eliminates the segmentation fault crash (SIGSEGV)
  • Test suite now progresses 13 tests further (31 vs 18 tests before crash)
  • Buffer storage path passes all assertions
  • Texture3D storage completes without crash (numerical accuracy issues remain
    and require separate investigation)

Test Plan:
./cmake-out/backends/vulkan/test/vulkan_compute_api_test
--gtest_filter=VulkanComputeAPITest.tensor_no_copy_transpose_test

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 22, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 3 New Failures, 1 Unrelated Failure

As of commit 348b371 with merge base 0ee2f49 (image):

NEW FAILURES - The following jobs have failed:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

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

@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 Dec 22, 2025
@github-actions
Copy link

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

…nsposed matmul

Summary:
The tensor_no_copy_transpose_test was crashing with a segmentation fault when
testing matrix multiplication with a virtually transposed tensor. The test
helper function record_matmul_texture3d() always used the matmul_naive shader
variant, even when mat2 was transposed, causing a shader variant mismatch that
led to invalid descriptor bindings and a crash in the NVIDIA Vulkan driver.

This change adds a mat2_is_transposed parameter (default=false) to
record_matmul_texture3d() to properly select between matmul_naive and
matmul_transposed_naive shader variants. The implementation now mirrors the
production code logic in MatMul.cpp which correctly handles this case.

Changes:
- Added mat2_is_transposed parameter to record_matmul_texture3d() declaration
- Rewrote record_matmul_texture3d() to select correct shader variant based on
  transpose flag and properly construct push constants
- Updated test call to pass mat2_is_transposed=true when needed

Impact:
- Eliminates the segmentation fault crash (SIGSEGV)
- Test suite now progresses 13 tests further (31 vs 18 tests before crash)
- Buffer storage path passes all assertions
- Texture3D storage completes without crash (numerical accuracy issues remain
  and require separate investigation)

Test Plan:
./cmake-out/backends/vulkan/test/vulkan_compute_api_test \
    --gtest_filter=VulkanComputeAPITest.tensor_no_copy_transpose_test
@meta-codesync
Copy link

meta-codesync bot commented Dec 22, 2025

@SS-JIA has imported this pull request. If you are a Meta employee, you can view this in D89687461.

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants