Repository navigation
Test support for alternative conv layout - #25617
Conversation
|
Hi @pmaybank, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
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. |
…t failures with cwhn=1
|
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. |
|
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
|
@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. |
|
@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. |
|
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 @0cc4m - thanks for supporting the CI checks. 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
left a comment
There was a problem hiding this comment.
Not sure why the tests are failing but looks ok
|
@jeffbolznv - is this something you have bandwidth to check / approve? |
|
@am17an - thanks for approving / commenting yesterday. We have 2 approvals now. Are we good to go with merge? Or are some additional check needed? |
|
Test failures look unrelated |
* 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
* 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
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.
* 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
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.
* 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
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,
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