Skip to content

refactor(bindings): split ops_bindings.cpp into modular files (#131)#135

Merged
m96-chan merged 1 commit intomainfrom
feature/issue-131-bindings-refactor
Dec 30, 2025
Merged

refactor(bindings): split ops_bindings.cpp into modular files (#131)#135
m96-chan merged 1 commit intomainfrom
feature/issue-131-bindings-refactor

Conversation

@m96-chan
Copy link
Copy Markdown
Owner

Summary

  • Split monolithic ops_bindings.cpp (~3000 lines) into 39 organized binding files
  • Created bindings_common.hpp with shared includes and forward declarations
  • Organized by operation category with consistent naming convention
  • ops_bindings.cpp now only ~77 lines (init function calls)

New Directory Structure

native/bindings/
├── bindings_common.hpp      # Common header
├── ops_bindings.cpp         # Main entry (calls init_* functions)
├── elementwise/             # binary, inplace, compare
├── unary/                   # math, trig
├── reduction/               # basic, argmax, softmax
├── tensor/                  # cast, transpose, reshape, repeat
├── embedding/               # lookup, kv_cache
├── nn/                      # activation, norm, attention, rope
├── gemm/                    # generic, fp8x*, nvf4x*, grouped, int
├── gemv/                    # generic, fp8x*, nvf4x*
├── sampling/                # basic, topk, seed
└── [other]                  # quantize, paged_attention, etc.

Test plan

  • Build passes (SM120a, CUDA 13.1)
  • 238 tests passing
  • Pre-commit checks pass (ruff lint, ruff format, mypy)

Closes #131

🤖 Generated with Claude Code

Split the monolithic ops_bindings.cpp (~3000 lines) into 39 organized
binding files for better maintainability and navigation.

Directory structure:
- elementwise/: binary, inplace, compare operations
- unary/: math, trig operations
- reduction/: basic, argmax, softmax operations
- tensor/: cast, transpose, reshape, repeat operations
- embedding/: lookup, kv_cache operations
- nn/: activation, norm, attention, rope operations
- gemm/: generic, fp8, nvf4, grouped, int operations
- gemv/: generic, fp8, nvf4 operations
- sampling/: basic, topk, seed operations
- Other: quantize, paged_attention, continuous_batching, audio, cublaslt, moe

Changes:
- ops_bindings.cpp reduced from ~3000 to ~77 lines (init calls only)
- bindings_common.hpp with shared includes and forward declarations
- CMakeLists.txt updated with all new source files
- Build verified: 238 tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@m96-chan m96-chan merged commit ea09659 into main Dec 30, 2025
13 checks passed
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.

refactor(native): Split ops_bindings.cpp into modular files

1 participant