-
Couldn't load subscription status.
- Fork 13.4k
ggml: add ops for WAN video model (cuda && cpu) #15669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+754
−85
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
c92f9b4
add conv3d support
leejet 93c7e77
add ggml_pad_ext for cpu & cuda backend
leejet f7a12f9
cuda/cpu: add im2col_3d support
leejet 85c8e1e
cuda: make im2col a little faster
leejet ae47cac
fix cuda pad/scale/im2col3d
leejet dd745ba
make im2col_3d faster
leejet d8377a0
gguf: support loading tensors which n_dims > GGML_MAX_DIMS
leejet d30e07d
fix cuda get_rows
leejet df05913
avoid ggml_conv_3d conflict
leejet 9d035c4
correct GGML_OP_COUNT assertion
leejet d11a729
avoid build failure
leejet f6a874c
avoid build failure on MacOS
leejet f6278c8
cuda: remove unnecessary MIN define
leejet c9b9fab
fix cpu im2col_3d
leejet 131ae2d
adjust the code style
leejet 0d5eb51
cuda: use simpler loop in get_rows
leejet aafa79a
add test_im2col_3d to test-backend-ops
leejet 3f901e3
test-backend-ops.cpp: remove trailing whitespace
leejet e66bf6e
cpu: im2col_3d support non continuous src
leejet b4c50be
fix test_im2col_3d
leejet 8f5e7b0
remove unused variables
leejet 21e9338
cuda: get_rows: dfloat2 -> float2
leejet 36f2215
add test_pad_ext to test-backend-ops.cpp
leejet d9f1d13
add gguf_init_from_file_ext impl
leejet 6b71242
Merge branch 'master' into wan
leejet 9b365e8
Revert "gguf: support loading tensors which n_dims > GGML_MAX_DIMS"
leejet 6b6eede
Revert "add gguf_init_from_file_ext impl"
leejet 2412bb0
update ggml_backend_vk_device_supports_op
leejet b38bfbb
fix ggml_backend_vk_device_supports_op
leejet 457f186
update other backend supports op for ggml_pad_ext
leejet 1618844
metal/opencl/sycl/vulkan: fix GGML_OP_PAD check in supports_op
leejet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ideally there should be only one
conv_3doperation, and the backend can decide on an implementation (direct, im2col, tiled im2col, or choose one depending on inputs & hardware).The reason there are two versions for
conv_2dis because historically the im2col version was there first, and it coded im2col into the graph. This means the backend cannot optimize it or choose a better implementation, and the huge memory requirements of full tensor im2col or baked into the graph. This was difficult to change without breaking backends, hence the "direct" workaround. But IMO we should avoid this situation for newly introduced conv ops.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the ultimate goal. However, currently the support for each backend is not yet complete, and conv_2d_direct cannot fully replace im2col + gemm at present. In some backends such as CUDA, conv_2d_direct is much slower than im2col + gemm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree there's no solution for conv_2d right away. My point is, this PR now creates the same problem for 3d. I don't think new code should be introduced that repeats the issue and bakes im2col as the default way to do conv_3d.
My suggestion would be to either implement im2col+mul_mat behind OP_CONV_3D in the CUDA backend. Or only expose im2col_3d on the API, and move im2col+mul_mat calls into the application (simpler but not as nice).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For CUDA one of my long-term goals is to write convolution kernels, particularly ones that can make use of quantized data. But I should stress that I have so many other things I want to do that realistically I would start working on it in a year at the absolute earliest.