Skip to content

Test support for alternative conv layout - #25617

Merged
am17an merged 8 commits into
ggml-org:masterfrom
pmaybank:dev-conv-2
Jul 30, 2026
Merged

am17an merged 8 commits into
ggml-org:masterfrom
pmaybank:dev-conv-2

Conversation

@pmaybank

@pmaybank pmaybank commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Overview

  • currently bool cwhn = false in conv_2d test cases

  • this PR adds bool cwhn = true cases

  • to resolve the test failures introduced by extending the test suite,

    • the ggml_backend_cuda_device_supports_op function now returns unsupported if input or kernel layout is not contiguous.
    • the ggml_cuda_op_conv2d function tests that input layout is contiguous (previously only kernel layout was tested)
  • as a result of these changes the number of CONV_2D tests goes up from 1,570 to 2,002

  • ./bin/test-backend-ops test -o CONV_2D -j 1 passes with the changes.

Additional information

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure: This code was not generated autonomously by AI.

@pmaybank
pmaybank requested review from a team and ggerganov as code owners July 13, 2026 09:15
@github-actions github-actions Bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning CUDA Related to the CUDA backend labels Jul 13, 2026
@ggml-gh-bot

ggml-gh-bot Bot commented Jul 13, 2026

Copy link
Copy Markdown

Hi @pmaybank, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

@pmaybank

Copy link
Copy Markdown
Contributor Author

Hi @pmaybank, thanks for your contribution!

Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:

  • PR Template not respected: Please respect the template when creating a new pull request. Make sure to fill out all required sections.

Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below.

I modified the Requirements section / AI Disclosure. Let me know if any other specific checks are failing re. the PR Template.

@jeffbolznv

Copy link
Copy Markdown
Contributor

I looked at this briefly to see if it would run on vulkan. It asserts, which is fixable, but it seems like a lot of the tests are also not supported in the CPU backend, and this makes it hard to verify the other backends. Is there a plan for this?

@pmaybank

pmaybank commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor Author

I looked at this briefly to see if it would run on vulkan. It asserts, which is fixable, but it seems like a lot of the tests are also not supported in the CPU backend, and this makes it hard to verify the other backends. Is there a plan for this?

Thanks for taking the time to take a brief look.

I would be happy to write some CPU reference code if there are tests that, for example, are supported on Vulkan back-end but not supported in the CPU back-end. Was there anything specific you had in mind?

In the work to date, my goal is to get parity of support between CUDA / ROCm back-end and the CPU back-end. So if there is a test that is Not Supported on CPU back-end, this does not necessarily cause a problem if that test is Not Supported on CUDA / ROCm.

As this is my first contribution to llama.cpp I would value any feedback on process. I understand that if a larger piece of work is undertaken then there should be some RFC / design work done ahead of requesting review for large code changes.

@pmaybank
pmaybank requested a review from a team as a code owner July 14, 2026 14:12
@github-actions github-actions Bot added the Vulkan Issues specific to the Vulkan backend label Jul 14, 2026
@pmaybank

Copy link
Copy Markdown
Contributor Author

Could someone with write access please approve the GitHub Actions workflow runs for this PR?

I have not modified workflow files. I have done some local testing with test-backend-ops .

@JohannesGaessler @IMbackK @am17an - this is my first PR. I am from AMD. I can see that @JohannesGaessler and @IMbackK have been active on PRs from other AMD contributors.

Is this something you have bandwidth to review? Can you tag anyone else who may be able to support?

…graph build-time check in ggml_backend_vk_device_supports_op
@pmaybank

Copy link
Copy Markdown
Contributor Author

@0cc4m - I see you are a Vulkan code owner along with @jeffbolznv . I pushed another commit that is intended to fix the issue Jeff pointed out.

Thanks for triggering 1st CI run. Could you trigger next run to validate fix? Happy to address any further comments from either of you.

@pmaybank

Copy link
Copy Markdown
Contributor Author

@0cc4m - thanks for triggering 2nd CI run! Could you trigger next run to validate fix? This time I have built Vulkan backend locally, reproduced CI failure, and checked that it passes after fix. @jeffbolznv - FYI - I am guessing this solves the issue that you were first to point out.

@pmaybank

pmaybank commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor Author

From the CI logs, it looks like test-backend-ops is passing on all back-ends now (including previously failing Vulkan). From what I can see, CI failures (on gpu-webgpu-nvidia, gpu-webgpu-apple, ubuntu, ubuntu-22-hip-quality-check ) are unrelated to the changes that I introduced.

@0cc4m - thanks for supporting the CI checks.
@0cc4m , @JohannesGaessler , @am17an - do you see anything else that needs to be addressed? Or can this PR now be merged?

FYI - I have more convolution-related work in progress. This small PR is to help get me started with process for making contributions. And hopefully adds some value by increasing code coverage in your test suite.

@am17an am17an left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure why the tests are failing but looks ok

@pmaybank

Copy link
Copy Markdown
Contributor Author

@jeffbolznv - is this something you have bandwidth to check / approve?

@pmaybank

Copy link
Copy Markdown
Contributor Author

@am17an - thanks for approving / commenting yesterday. We have 2 approvals now. Are we good to go with merge? Or are some additional check needed?

@pmaybank

Copy link
Copy Markdown
Contributor Author

@am17an , @0cc4m - do you have write access to ggml-org:master ? If so, can you merge this PR? If not, can you give me any pointers who I should reach out to, as it is my first PR on this project? Thanks again for your reviews.

@am17an

am17an commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Test failures look unrelated

@am17an
am17an merged commit 958d9c0 into ggml-org:master Jul 30, 2026
27 of 34 checks passed
huaxel pushed a commit to huaxel/strix-llama.cpp that referenced this pull request Aug 2, 2026
* add  bool cwhn = true to conv_2d test cases

* add layout check at graph building time

* extend layout checks for conv2d.cu kernel

* in CPU back-end kernel needs to be stored contiguously to prevent test failures with cwhn=1

* trim white space

* do op support check in vulkan backend

* fix CI failure and vulkan run-time assert failure by introducing new graph build-time check in ggml_backend_vk_device_supports_op

* add additional check in support_op function for Vulkan to fix run-time assert failure
satindergrewal pushed a commit to satindergrewal/llama.cpp that referenced this pull request Aug 12, 2026
* add  bool cwhn = true to conv_2d test cases

* add layout check at graph building time

* extend layout checks for conv2d.cu kernel

* in CPU back-end kernel needs to be stored contiguously to prevent test failures with cwhn=1

* trim white space

* do op support check in vulkan backend

* fix CI failure and vulkan run-time assert failure by introducing new graph build-time check in ggml_backend_vk_device_supports_op

* add additional check in support_op function for Vulkan to fix run-time assert failure
wanghqc added a commit to qualcomm/llama.cpp that referenced this pull request Aug 29, 2026
The OpenCL CONV_2D kernel walks both operands as if they were contiguous WHCN.
A channel-most-contiguous (CWHN) input or kernel reaches the backend as a
permuted, non-contiguous tensor with unchanged ne, so it is read with the wrong
strides. supports_op accepted it on type alone, so instead of falling back the
backend returned garbage.

test-backend-ops -o CONV_2D on an Adreno 840: 2014/2026, with 12 cwhn=1 cases
failing at ERR ~= 2.0 against a 5e-4 tolerance, e.g.
CONV_2D(ne_input=[141,133,25,2],ne_kernel=[1,1,25,1],cwhn=1).

Require contiguous src0/src1/dst, matching what the CUDA and Vulkan backends
already do for this layout (ggml-org#25617). The affected shapes now report
"not supported" and fall back instead of computing a wrong result.

Adreno 840, test-backend-ops -o CONV_2D: 2014/2026 -> 2002/2002, 0 FAIL.
thecodacus pushed a commit to thecodacus/llama.cpp that referenced this pull request Sep 7, 2026
* add  bool cwhn = true to conv_2d test cases

* add layout check at graph building time

* extend layout checks for conv2d.cu kernel

* in CPU back-end kernel needs to be stored contiguously to prevent test failures with cwhn=1

* trim white space

* do op support check in vulkan backend

* fix CI failure and vulkan run-time assert failure by introducing new graph build-time check in ggml_backend_vk_device_supports_op

* add additional check in support_op function for Vulkan to fix run-time assert failure
lhez pushed a commit to qualcomm/llama.cpp that referenced this pull request Sep 9, 2026
The OpenCL CONV_2D kernel walks both operands as if they were contiguous WHCN.
A channel-most-contiguous (CWHN) input or kernel reaches the backend as a
permuted, non-contiguous tensor with unchanged ne, so it is read with the wrong
strides. supports_op accepted it on type alone, so instead of falling back the
backend returned garbage.

test-backend-ops -o CONV_2D on an Adreno 840: 2014/2026, with 12 cwhn=1 cases
failing at ERR ~= 2.0 against a 5e-4 tolerance, e.g.
CONV_2D(ne_input=[141,133,25,2],ne_kernel=[1,1,25,1],cwhn=1).

Require contiguous src0/src1/dst, matching what the CUDA and Vulkan backends
already do for this layout (ggml-org#25617). The affected shapes now report
"not supported" and fall back instead of computing a wrong result.

Adreno 840, test-backend-ops -o CONV_2D: 2014/2026 -> 2002/2002, 0 FAIL.
zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Sep 10, 2026
* add  bool cwhn = true to conv_2d test cases

* add layout check at graph building time

* extend layout checks for conv2d.cu kernel

* in CPU back-end kernel needs to be stored contiguously to prevent test failures with cwhn=1

* trim white space

* do op support check in vulkan backend

* fix CI failure and vulkan run-time assert failure by introducing new graph build-time check in ggml_backend_vk_device_supports_op

* add additional check in support_op function for Vulkan to fix run-time assert failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CUDA Related to the CUDA backend ggml changes relating to the ggml tensor library for machine learning testing Everything test related Vulkan Issues specific to the Vulkan backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants