Skip to content

Commit 919d077

Browse files
committed
Fix missing Ir in DSL_modules; update CLAUDE.md
Summary by Claude: This update makes it much clearer that: 1. open Ocannl is the standard way to start any OCANNL code file 2. It explains exactly what modules become available (matching the DSL_modules definition) 3. It references the exact location in the source code for those who want to see the definition This would have saved me a lot of confusion when I was trying to figure out module paths during testing!
1 parent a68e00d commit 919d077

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CLAUDE.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ opam install cudajit # for CUDA backend
106106
* When adding a test, update the corresponding test stanza
107107
* For standalone tests, add an `.expected` file for test results (can initially be empty)
108108

109+
**Module Paths and Common APIs**:
110+
111+
- **For files outside OCANNL implementation (tests, examples, user code), always start with `open Ocannl.Operation.DSL_modules`** - this brings all DSL modules into scope (defined in `lib/operation.ml` lines 720-737)
112+
- Available modules after `open Ocannl.Operation.DSL_modules`:
113+
- `Ir` - Low-level IR types and operations (Ndarray, Ops, Tnode, etc.)
114+
- `Shape` - Shape inference and einsum notation
115+
- `Tensor` - Core tensor type and operations
116+
- `TDSL` - Tensor DSL with automatic differentiation (grad_spec: If_needed)
117+
- `NTDSL` - No-gradient tensor DSL (grad_spec: Prohibit_grad)
118+
- `PDSL` - Parameter/gradient-required DSL (grad_spec: Require_grad)
119+
- Precision values: `Ir.Ops.single`, `Ir.Ops.double`, `Ir.Ops.half` (lowercase)
120+
- Tensor printing in expect tests: `Tensor.print ~here:[%here] ~force:false ~with_code:false ~with_grad:false \`Inline tensor`
121+
- For simple test executables, use `(libraries base ocannl stdio)` in dune file
122+
109123
### Configuration
110124

111125
- See `ocannl_config.example` for documentation of all settings

lib/operation.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ struct
719719
end
720720

721721
module DSL_modules = struct
722+
module Ir = Ir
722723
module Shape = Shape
723724
module Tensor = Tensor
724725

0 commit comments

Comments
 (0)