UPSTREAM PR #16686: Vulkan: Add support for FLOOR,CEIL,ROUND and TRUNC unary operators #144
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.
Mirrored from ggml-org/llama.cpp#16686
This PR introduces comprehensive support for the FLOOR, CEIL, ROUND, and TRUNC unary operations within the Vulkan backend. The implementation includes new compute shaders, pipeline integration, and corresponding test coverage to ensure robust functionality.
Key Changes:
floor.comp,ceil.comp,round.comp, andtrunc.compwith proper GLSL implementationsggml-vulkan.cppwith:pipeline_floor_f32,pipeline_ceil_f32,pipeline_round_f32,pipeline_trunc_f32)GGML_OP_FLOOR,GGML_OP_CEIL,GGML_OP_ROUND, andGGML_OP_TRUNCvulkan-shaders-gen.cppto include the new shader compilation targetsdocs/ops.mdanddocs/ops/Vulkan.csvtests/test-backend-ops.cppfor all four operationsTesting & Validation:
./tests/test-backend-opsor project-specific test runners)Modified Files:
ggml/src/ggml-vulkan/ggml-vulkan.cppggml/src/ggml-vulkan/vulkan-shaders/*.comp(floor, ceil, round, trunc)ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cppdocs/ops.mddocs/ops/Vulkan.csvtests/test-backend-ops.cppAdditional Notes:
This implementation maintains consistency with existing unary operation patterns within the Vulkan backend. The changes are focused and minimize potential impact on existing functionality while providing robust support for the requested mathematical operations.
I remain available for any clarifications, additional testing, or modifications that may be requested during the review process.