Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
f6ac084
Feat: Added vulkan circular tiling support
Phylliida Nov 3, 2025
d7f5958
Feat: Added cpu circular
Phylliida Nov 3, 2025
1b62b49
Feat: Added cuda kernels
Phylliida Nov 3, 2025
60bed3b
Added tests
Phylliida Nov 3, 2025
5700a4e
Added tests
Phylliida Nov 3, 2025
a894631
Merge branch 'master' into master
Phylliida Nov 12, 2025
9861a3d
Removed non-pad operations
Phylliida Nov 15, 2025
38f8724
Removed unneded changes
Phylliida Nov 15, 2025
d4a664b
removed backend non pad tests
Phylliida Nov 15, 2025
a785537
Merge branch 'ggml-org:master' into master
Phylliida Nov 15, 2025
d9dc234
Merge branch 'ggml-org:master' into master
Phylliida Nov 18, 2025
552e5b2
Update test-backend-ops.cpp
Phylliida Nov 18, 2025
1c69e4e
Fixed comment on pad test
Phylliida Nov 19, 2025
3cd8167
Merge branch 'ggml-org:master' into master
Phylliida Nov 19, 2025
429854b
removed trailing whitespace
Nov 19, 2025
cf720e8
Removed unneded test in test-backend-ops
Nov 25, 2025
b65967a
Merge branch 'ggml-org:master' into master
Phylliida Nov 25, 2025
a0bbbc2
Removed removed test from calls
Nov 25, 2025
c9513b4
Update ggml/src/ggml-vulkan/vulkan-shaders/pad.comp
Phylliida Nov 29, 2025
df6635f
Fixed alignment
Phylliida Nov 29, 2025
893065d
Formatting
Phylliida Nov 29, 2025
3bfacc8
Format pad
Nov 30, 2025
4cdba9f
Format
Nov 30, 2025
606dd62
Clang format
Nov 30, 2025
6dc7169
format
Nov 30, 2025
c3b3ed0
format
Nov 30, 2025
d383a2c
don't change so much stuff
Nov 30, 2025
b794da8
clang format and update to bool
Nov 30, 2025
e315fcf
fix duplicates
Nov 30, 2025
80915a1
don't need to fix the padding
Nov 30, 2025
1721a2b
make circular bool
Nov 30, 2025
89559a1
duplicate again
Nov 30, 2025
af56c82
rename vulkan to wrap around
Nov 30, 2025
ec892ec
Don't need indent
Nov 30, 2025
f295d28
moved to const expr
Nov 30, 2025
bb8ecad
removed unneded extra line break
Nov 30, 2025
4d20856
More readable method calls
Nov 30, 2025
b850c04
Minor wording changes
Nov 30, 2025
801cd84
Added final newline
Nov 30, 2025
7fd9ea3
Update ggml/include/ggml.h
Phylliida Dec 2, 2025
b29544d
Update ggml/include/ggml.h
Phylliida Dec 2, 2025
2f3d4ba
Added circular pad ext tests
Dec 2, 2025
624433d
Gate non circular pad devices
Dec 4, 2025
8515811
Cleaned gating of non-circular pad devices
Dec 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions ggml/include/ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -1943,6 +1943,18 @@ extern "C" {
int d0, // dilation dimension 0
int d1); // dilation dimension 1


GGML_API struct ggml_tensor * ggml_conv_2d_circular(
struct ggml_context * ctx,
struct ggml_tensor * a, // convolution kernel
struct ggml_tensor * b, // data
int s0, // stride dimension 0
int s1, // stride dimension 1
int p0, // padding dimension 0
int p1, // padding dimension 1
int d0, // dilation dimension 0
int d1); // dilation dimension 1

GGML_API struct ggml_tensor * ggml_im2col_3d(
struct ggml_context * ctx,
struct ggml_tensor * a,
Expand Down Expand Up @@ -2016,6 +2028,19 @@ extern "C" {
int d0, // dilation dimension 0
int d1); // dilation dimension 1


// depthwise (via im2col and mul_mat)
GGML_API struct ggml_tensor * ggml_conv_2d_dw_circular(
struct ggml_context * ctx,
struct ggml_tensor * a, // convolution kernel
struct ggml_tensor * b, // data
int s0, // stride dimension 0
int s1, // stride dimension 1
int p0, // padding dimension 0
int p1, // padding dimension 1
int d0, // dilation dimension 0
int d1); // dilation dimension 1

// Depthwise 2D convolution
// may be faster than ggml_conv_2d_dw, but not available in all backends
// a: KW KH 1 C convolution kernel
Expand All @@ -2032,12 +2057,35 @@ extern "C" {
int dilation0,
int dilation1);

// Depthwise 2D convolution (on a torus)
// may be faster than ggml_conv_2d_dw, but not available in all backends
// a: KW KH 1 C convolution kernel
// b: W H C N input data
// res: W_out H_out C N
GGML_API struct ggml_tensor * ggml_conv_2d_dw_direct_circular(
struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b,
int stride0,
int stride1,
int pad0,
int pad1,
int dilation0,
int dilation1);

GGML_API struct ggml_tensor * ggml_conv_transpose_2d_p0(
struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b,
int stride);

// circular (on a torus)
GGML_API struct ggml_tensor * ggml_conv_transpose_2d_p0_circular(
struct ggml_context * ctx,
struct ggml_tensor * a,
struct ggml_tensor * b,
int stride);

GGML_API struct ggml_tensor * ggml_conv_2d_direct(
struct ggml_context * ctx,
struct ggml_tensor * a, // convolution kernel [KW, KH, IC, OC]
Expand All @@ -2048,6 +2096,17 @@ extern "C" {
int p1, // padding dimension 1
int d0, // dilation dimension 0
int d1); // dilation dimension 1

GGML_API struct ggml_tensor * ggml_conv_2d_direct_circular(
struct ggml_context * ctx,
struct ggml_tensor * a, // convolution kernel [KW, KH, IC, OC]
struct ggml_tensor * b, // input data [W, H, C, N]
int s0, // stride dimension 0
int s1, // stride dimension 1
int p0, // padding dimension 0
int p1, // padding dimension 1
int d0, // dilation dimension 0
int d1); // dilation dimension 1

GGML_API struct ggml_tensor * ggml_conv_3d_direct(
struct ggml_context * ctx,
Expand Down Expand Up @@ -2156,6 +2215,15 @@ extern "C" {
int p2,
int p3);

// pad each dimension with values on the other side of the torus (looping around)
GGML_API struct ggml_tensor * ggml_pad_circular(
struct ggml_context * ctx,
struct ggml_tensor * a,
int p0,
int p1,
int p2,
int p3);

GGML_API struct ggml_tensor * ggml_pad_ext(
struct ggml_context * ctx,
struct ggml_tensor * a,
Expand All @@ -2169,6 +2237,20 @@ extern "C" {
int rp3
);

// circular padding
GGML_API struct ggml_tensor * ggml_pad_ext_circular(
struct ggml_context * ctx,
struct ggml_tensor * a,
int lp0,
int rp0,
int lp1,
int rp1,
int lp2,
int rp2,
int lp3,
int rp3
);

// pad each dimension with reflection: [a, b, c, d] -> [b, a, b, c, d, c]
GGML_API struct ggml_tensor * ggml_pad_reflect_1d(
struct ggml_context * ctx,
Expand Down
Loading