Commit 24fddb4
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- arrayjit/lib
- test/operations
- config
8 files changed
+577
-246
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
| 108 | + | |
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
| |||
0 commit comments