Skip to content

Conversation

@DajanaV
Copy link
Contributor

@DajanaV DajanaV commented Nov 9, 2025

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:

  • New Compute Shaders: Added floor.comp, ceil.comp, round.comp, and trunc.comp with proper GLSL implementations
  • Pipeline Integration: Extended ggml-vulkan.cpp with:
    • New pipeline definitions (pipeline_floor_f32, pipeline_ceil_f32, pipeline_round_f32, pipeline_trunc_f32)
    • Operation handlers for GGML_OP_FLOOR, GGML_OP_CEIL, GGML_OP_ROUND, and GGML_OP_TRUNC
    • Support for dry-run validation and debugging workflows
  • SPIR-V Generation: Updated vulkan-shaders-gen.cpp to include the new shader compilation targets
  • Documentation Updates: Refreshed operation support matrices in docs/ops.md and docs/ops/Vulkan.csv
  • Test Coverage: Added comprehensive unit tests in tests/test-backend-ops.cpp for all four operations

Testing & Validation:

  • Standard project compilation with Vulkan backend enabled
  • Execution of newly added test suites (via ./tests/test-backend-ops or project-specific test runners)
  • Verification of shader compilation to SPIR-V without errors
  • Runtime validation of pipeline creation and execution

Modified Files:

  • ggml/src/ggml-vulkan/ggml-vulkan.cpp
  • ggml/src/ggml-vulkan/vulkan-shaders/*.comp (floor, ceil, round, trunc)
  • ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp
  • docs/ops.md
  • docs/ops/Vulkan.csv
  • tests/test-backend-ops.cpp

Additional 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.

@DajanaV DajanaV force-pushed the main branch 21 times, most recently from 87bfdb3 to a14857a Compare November 11, 2025 19:07
@DajanaV DajanaV force-pushed the main branch 15 times, most recently from 24733fb to 4b4bb7c Compare November 13, 2025 12:15
@DajanaV DajanaV closed this Nov 13, 2025
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.

3 participants