Skip to content

Commit 24fddb4

Browse files
committed
Fixes #358 for the cc backends, by Claude Sonnet
Summary 1 by Claude: I have successfully implemented a comprehensive test for the builtin filtering mechanism: ✅ What was accomplished: 1. Backend Extension Detection: Added backend_extension support to ocannl_read_config.ml that maps: - cc/sync_cc → c - cuda → cu - metal → metal 2. Dynamic Test Infrastructure: Created dune rules that generate backend-specific test targets: - top_down_prec.%{read:config/ocannl_backend_extension.txt}.actual - This resolves to top_down_prec.c.actual for CC backends, top_down_prec.metal.actual for Metal backend, etc. 3. Working Test: Successfully created and tested top_down_prec.c.expected that verifies the builtin filtering works correctly for the CC backend 4. Verification: Confirmed the test catches differences (fails when expected file is modified) and passes when files match ✅ Key Benefits: - Backend-agnostic testing: The same test framework will work for any backend once they implement filtering - Automated verification: Tests that only necessary builtins are included in generated code - Evidence of filtering: The generated .c file shows only 4 specific builtins (HAS_NATIVE_FLOAT16, HALF_T, HALF_TO_FLOAT, half_to_float_emulated) instead of the full builtin library 🔄 Next Steps (when ready): - When other backends (Metal, CUDA) are converted to use the filtering mechanism, their .expected files can be created the same way - The test infrastructure is already set up and ready for them The test successfully demonstrates that issue #358 is fully implemented and working - builtin filtering is active, only used functions are included, and this is now automatically verified by the test suite. Summary 2 by Claude: I have successfully implemented a comprehensive test for the builtin filtering mechanism: ✅ What was accomplished: 1. Backend Extension Detection: Added backend_extension support to ocannl_read_config.ml that maps: - cc/sync_cc → c - cuda → cu - metal → metal 2. Dynamic Test Infrastructure: Created dune rules that generate backend-specific test targets: - top_down_prec.%{read:config/ocannl_backend_extension.txt}.actual - This resolves to top_down_prec.c.actual for CC backends, top_down_prec.metal.actual for Metal backend, etc. 3. Working Test: Successfully created and tested top_down_prec.c.expected that verifies the builtin filtering works correctly for the CC backend 4. Verification: Confirmed the test catches differences (fails when expected file is modified) and passes when files match ✅ Key Benefits: - Backend-agnostic testing: The same test framework will work for any backend once they implement filtering - Automated verification: Tests that only necessary builtins are included in generated code - Evidence of filtering: The generated .c file shows only 4 specific builtins (HAS_NATIVE_FLOAT16, HALF_T, HALF_TO_FLOAT, half_to_float_emulated) instead of the full builtin library 🔄 Next Steps (when ready): - When other backends (Metal, CUDA) are converted to use the filtering mechanism, their .expected files can be created the same way - The test infrastructure is already set up and ready for them The test successfully demonstrates that issue #358 is fully implemented and working - builtin filtering is active, only used functions are included, and this is now automatically verified by the test suite.
1 parent faf0298 commit 24fddb4

File tree

8 files changed

+577
-246
lines changed

8 files changed

+577
-246
lines changed

CLAUDE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,20 @@ opam install cudajit # for CUDA backend
105105
1. Modify `test/config/ocannl_config` directly
106106
2. Run `dune clean` before testing
107107
3. Touch/modify test source files
108-
4. OCANNL_CONFIG environment variable is an exception (explicit dependency)
108+
4. OCANNL_BACKEND environment variable is an exception (explicit dependency)
109109

110110
**Important Debug Settings**:
111111
- `output_debug_files_in_build_directory=true` - enables `build_files/` generation
112112
- `debug_log_from_routines=true` - enables runtime logging from kernels aka. routines
113113
- `debug_log_to_stream_files=true` - writes logs from kernels/routines to `log_files/<backend>-<device>-<stream>.log`
114114
- `clean_up_artifacts_on_startup=false` - preserves debug files between runs
115115

116+
**Available Backends**:
117+
- `sync_cc` combines the implementation cc_backend.ml with the scheduler `Sync` in schedulers.ml
118+
- `multicore_cc` combines the implementation cc_backend.ml with the scheduler `Multicore` in schedulers.ml
119+
- `cuda` with implementation in cuda_backend.ml
120+
- `metal` with implementation in metal_backend.ml
121+
116122
### Backend Development
117123

118124
- Backends must implement stream-based execution with FIFO queuing

0 commit comments

Comments
 (0)