NEURON
codegen.yaml
Go to the documentation of this file.
1 # Copyright 2023 Blue Brain Project, EPFL.
2 # See the top-level LICENSE file for details.
3 #
4 # SPDX-License-Identifier: Apache-2.0
5 
6 ######################### NMODL Abstract Language Definition ##############################
7 #
8 # PURPOSE
9 # =======
10 #
11 # NMODL language specification in nmod.yaml takes care of representing NMODL language
12 # AST generation. This AST is sufficient for NMODL level analysis and optimizations.
13 # In order to perform code generation transformations, we need to perform various
14 # transoformations on AST and add new node types. For example, PROCEDURE and FUNCTION
15 # nodes in NMODL doesn't have return type (double by default). Also, we can't represent
16 # code generation specific information (e.g. variable or function qualifiers) with the
17 # existing AST nodes. This yaml specification describe additional node types that can
18 # be used for code generation purpose. Note that they are using same inheritance
19 # hierarchy because we would like to use single AST to represent the NMODL with and
20 # without code generation transformations.
21 
22 - AST:
23  children:
24  - Node:
25  children:
26  - Expression:
27  children:
28  - Number:
29  - Identifier:
30  - Block:
31  children:
32  - NrnStateBlock:
33  nmodl: "NRN_STATE "
34  brief: "Represents the coreneuron nrn_state callback function"
35  members:
36  - solve_statements:
37  brief: "solve blocks to be called or generated"
38  type: Statement
39  vector: true
40  - EigenNewtonSolverBlock:
41  brief: "Represent newton solver solution block based on Eigen"
42  nmodl: "EIGEN_NEWTON_SOLVE"
43  members:
44  - n_state_vars:
45  brief: "number of state vars used in solve"
46  type: Integer
47  prefix: {value: "["}
48  suffix: {value: "]"}
49  - variable_block:
50  brief: "Statements to be declared in the functor"
51  type: StatementBlock
52  - initialize_block:
53  brief: "Statement block to be executed before calling newton solver"
54  type: StatementBlock
55  - setup_x_block:
56  brief: "update X from states"
57  type: StatementBlock
58  - functor_block:
59  brief: "odes as functor for eigen"
60  type: StatementBlock
61  - update_states_block:
62  brief: "update back states from X"
63  type: StatementBlock
64  - finalize_block:
65  brief: "Statement block to be executed after calling newton solver"
66  type: StatementBlock
67  - EigenLinearSolverBlock:
68  brief: "Represent linear solver solution block based on Eigen"
69  nmodl: "EIGEN_LINEAR_SOLVE"
70  members:
71  - n_state_vars:
72  brief: "number of state vars used in solve"
73  type: Integer
74  prefix: {value: "["}
75  suffix: {value: "]"}
76  - variable_block:
77  brief: "Statements to be declared in the functor"
78  type: StatementBlock
79  - initialize_block:
80  brief: "Statement block to be executed before calling linear solver"
81  type: StatementBlock
82  - setup_x_block:
83  brief: "update X from states"
84  type: StatementBlock
85  - update_states_block:
86  brief: "update back states from X"
87  type: StatementBlock
88  - finalize_block:
89  brief: "Statement block to be executed after calling linear solver"
90  type: StatementBlock
91  - CvodeBlock:
92  nmodl: "CVODE_BLOCK "
93  members:
94  - name:
95  brief: "Name of the block"
96  type: Name
97  node_name: true
98  suffix: {value: " "}
99  - n_odes:
100  brief: "number of ODEs to solve"
101  type: Integer
102  prefix: {value: "["}
103  suffix: {value: "]"}
104  - non_stiff_block:
105  brief: "Block with statements of the form Dvar = f(var), used for updating non-stiff systems"
106  type: StatementBlock
107  - stiff_block:
108  brief: "Block with statements of the form Dvar = Dvar / (1 - dt * J(f)), used for updating stiff systems"
109  type: StatementBlock
110  brief: "Represents a block used for variable timestep integration (CVODE) of DERIVATIVE blocks"
111  - LongitudinalDiffusionBlock:
112  brief: "Extracts information required for LONGITUDINAL_DIFFUSION for each KINETIC block."
113  nmodl: "LONGITUDINAL_DIFFUSION_BLOCK"
114  members:
115  - name:
116  brief: "Name of the longitudinal diffusion block"
117  type: Name
118  node_name: true
119  prefix: { value: " "}
120  suffix: { value: " "}
121  - longitudinal_diffusion_statements:
122  brief: "All LONGITUDINAL_DIFFUSION statements in the KINETIC block."
123  type: StatementBlock
124  - compartment_statements:
125  brief: "All (required) COMPARTMENT statements in the KINETIC block."
126  type: StatementBlock
127 
128  - WrappedExpression:
129  brief: "Wrap any other expression type"
130  members:
131  - expression:
132  brief: "Expression that is being wrapped"
133  type: Expression
134  - DerivimplicitCallback:
135  brief: "Represent a callback to NEURON's derivimplicit solver"
136  members:
137  - node_to_solve:
138  brief: "Block to be solved (typically derivative)"
139  type: Block
140  - SolutionExpression:
141  brief: "Represent solution of a block in the AST"
142  members:
143  - solve_block:
144  type: SolveBlock
145  - node_to_solve:
146  brief: "Block to be solved (callback node or solution node itself)"
147  type: Expression
148  - Statement:
149  brief: "Statement base class"
150  children:
151  - UpdateDt:
152  nmodl: "dt"
153  members:
154  - value:
155  brief: "Value of new timestep"
156  type: Double
157  prefix: {value: " = "}
158  brief: "Statement to indicate a change in timestep in a given block"