Skip to content

add gtest for conv gpu SAME_UPPER autopad#35

Open
harz05 wants to merge 1 commit into
ML4EP:gpu/alpakafrom
harz05:feat/conv-autopad-upper-test
Open

add gtest for conv gpu SAME_UPPER autopad#35
harz05 wants to merge 1 commit into
ML4EP:gpu/alpakafrom
harz05:feat/conv-autopad-upper-test

Conversation

@harz05

@harz05 harz05 commented Jun 9, 2026

Copy link
Copy Markdown

Closes #33.

Adds a GPU test for the SAME_UPPER autopad branch, which the alpaka tests didn't cover (only SAME_LOWER was tested).

SAME_UPPER and SAME_LOWER only differ when the total padding is odd, so the test uses x[1,1,4,4], kernel 3, stride 2 (total pad 1): SAME_UPPER puts the extra pad at the end (begin 0), SAME_LOWER at the start (begin 1). The output differs from what SAME_LOWER gives, and the generated im2col confirms the begin pad (- 0 vs - 1), so the test actually exercises the upper split rather than just the code path.

Tested on Colab T4: ConvWithAutopadSameUpper passes and all existing Conv tests still pass.

@harz05

harz05 commented Jun 9, 2026

Copy link
Copy Markdown
Author

While working on this PR, I noticed SAME_UPPER and SAME_LOWER only differ when the total padding is odd and for even padding they resolve to the same pads. ROOT's SameUpper model (input 5, k3, s1) is an even case, so it's effectively identical to SameLower.

The odd case would something be like having a 3x3 stride-2 conv on an even-sized input(this gives odd padding) and the TF/Keras "SAME" maps to SAME_UPPER. So it kinda seemed worth covering to me.

Does this odd-split path actually come up in the models SOFIE targets or is the even case all we really need here? Any thoughts or guidance would be helpful. @sanjibansg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant