@@ -1921,7 +1921,7 @@ std::string CodegenCVisitor::process_verbatim_text(std::string text) {
1921
1921
name = " &" + name;
1922
1922
}
1923
1923
if (token == " _STRIDE" ) {
1924
- name = (layout == LayoutType::soa) ? " pnodecount+id" : " 1 " ;
1924
+ name = " pnodecount+id" ;
1925
1925
}
1926
1926
result += name;
1927
1927
}
@@ -2024,18 +2024,6 @@ void CodegenCVisitor::print_nmodl_constants() {
2024
2024
}
2025
2025
2026
2026
2027
- void CodegenCVisitor::print_memory_layout_getter () {
2028
- printer->add_newline (2 );
2029
- printer->add_line (" static inline int get_memory_layout() {" );
2030
- if (layout == LayoutType::aos) {
2031
- printer->add_line (" return 1; //aos" );
2032
- } else {
2033
- printer->add_line (" return 0; //soa" );
2034
- }
2035
- printer->add_line (" }" );
2036
- }
2037
-
2038
-
2039
2027
void CodegenCVisitor::print_first_pointer_var_index_getter () {
2040
2028
printer->add_newline (2 );
2041
2029
print_device_method_annotation ();
@@ -2093,14 +2081,6 @@ void CodegenCVisitor::print_memb_list_getter() {
2093
2081
}
2094
2082
2095
2083
2096
- void CodegenCVisitor::print_post_channel_iteration_common_code () {
2097
- if (layout == LayoutType::aos) {
2098
- printer->add_line (" data = ml->data + id*{};" _format (float_variables_size ()));
2099
- printer->add_line (" indexes = ml->pdata + id*{};" _format (int_variables_size ()));
2100
- }
2101
- }
2102
-
2103
-
2104
2084
void CodegenCVisitor::print_namespace_start () {
2105
2085
printer->add_newline (2 );
2106
2086
printer->start_block (" namespace coreneuron" );
@@ -2182,18 +2162,14 @@ std::string CodegenCVisitor::float_variable_name(const SymbolType& symbol,
2182
2162
// clang-format off
2183
2163
if (symbol->is_array ()) {
2184
2164
if (use_instance) {
2185
- auto stride = (layout == LayoutType::soa) ? dimension : num_float;
2186
- return " (inst->{}+id*{})" _format (name, stride);
2165
+ return " (inst->{}+id*{})" _format (name, dimension);
2187
2166
}
2188
- auto stride = (layout == LayoutType::soa) ? " {}*pnodecount+id*{}" _format (position, dimension) : " {}" _format (position);
2189
- return " (data+{})" _format (stride);
2167
+ return " (data + {}*pnodecount + id*{})" _format (position, dimension);
2190
2168
}
2191
2169
if (use_instance) {
2192
- auto stride = (layout == LayoutType::soa) ? " id" : " id*{}" _format (num_float);
2193
- return " inst->{}[{}]" _format (name, stride);
2170
+ return " inst->{}[id]" _format (name);
2194
2171
}
2195
- auto stride = (layout == LayoutType::soa) ? " {}*pnodecount+id" _format (position) : " {}" _format (position);
2196
- return " data[{}]" _format (stride);
2172
+ return " data[{}*pnodecount + id]" _format (position);
2197
2173
// clang-format on
2198
2174
}
2199
2175
@@ -2203,29 +2179,24 @@ std::string CodegenCVisitor::int_variable_name(const IndexVariableInfo& symbol,
2203
2179
bool use_instance) const {
2204
2180
auto position = position_of_int_var (name);
2205
2181
auto num_int = int_variables_size ();
2206
- std::string offset;
2207
2182
// clang-format off
2208
2183
if (symbol.is_index ) {
2209
- offset = std::to_string (position);
2210
2184
if (use_instance) {
2211
- return " inst->{}[{}]" _format (name, offset );
2185
+ return " inst->{}[{}]" _format (name, position );
2212
2186
}
2213
- return " indexes[{}]" _format (offset );
2187
+ return " indexes[{}]" _format (position );
2214
2188
}
2215
2189
if (symbol.is_integer ) {
2216
2190
if (use_instance) {
2217
- offset = (layout == LayoutType::soa) ? " {}*pnodecount+id" _format (position) : " id*{}+{}" _format (num_int, position);
2218
- return " inst->{}[{}]" _format (name, offset);
2191
+ return " inst->{}[{}*pnodecount+id]" _format (name, position);
2219
2192
}
2220
- offset = (layout == LayoutType::soa) ? " {}*pnodecount+id" _format (position) : " id" ;
2221
- return " indexes[{}]" _format (offset);
2193
+ return " indexes[{}*pnodecount+id]" _format (position);
2222
2194
}
2223
- offset = (layout == LayoutType::soa) ? " {}*pnodecount+id" _format (position) : " {}" _format (position);
2224
2195
if (use_instance) {
2225
- return " inst->{}[indexes[{}]]" _format (name, offset );
2196
+ return " inst->{}[indexes[{}*pnodecount + id ]]" _format (name, position );
2226
2197
}
2227
2198
auto data = symbol.is_vdata ? " _vdata" : " _data" ;
2228
- return " nt->{}[indexes[{}]]" _format (data, offset );
2199
+ return " nt->{}[indexes[{}]]" _format (data, position );
2229
2200
// clang-format on
2230
2201
}
2231
2202
@@ -2622,8 +2593,6 @@ void CodegenCVisitor::print_global_variables_for_hoc() {
2622
2593
* - If nrn_get_mechtype is < -1 means that mechanism is not used in the
2623
2594
* context of neuron execution and hence could be ignored in coreneuron
2624
2595
* execution.
2625
- * - Each mechanism could have different layout and hence we register the
2626
- * layout with the simulator. In practice all mechanisms have same layout.
2627
2596
* - Ions are internally defined and their types can be queried similar to
2628
2597
* other mechanisms.
2629
2598
* - hoc_register_var may not be needed in the context of coreneuron
@@ -2646,7 +2615,7 @@ void CodegenCVisitor::print_mechanism_register() {
2646
2615
printer->add_line (" }" );
2647
2616
2648
2617
printer->add_newline ();
2649
- printer->add_line (" _nrn_layout_reg(mech_type, get_memory_layout()) ;" );
2618
+ printer->add_line (" _nrn_layout_reg(mech_type, 0) ;" ); // 0 for SoA
2650
2619
2651
2620
// register mechanism
2652
2621
auto args = register_mechanism_arguments ();
@@ -2999,7 +2968,7 @@ void CodegenCVisitor::print_global_variable_setup() {
2999
2968
value = *value_ptr;
3000
2969
}
3001
2970
// / use %g to be same as nocmodl in neuron
3002
- printer->add_line (" {} = {};" _format (name, " {:g} " _format ( value) ));
2971
+ printer->add_line (" {} = {:g };" _format (name, value));
3003
2972
}
3004
2973
}
3005
2974
@@ -3012,7 +2981,7 @@ void CodegenCVisitor::print_global_variable_setup() {
3012
2981
value = *value_ptr;
3013
2982
}
3014
2983
// / use %g to be same as nocmodl in neuron
3015
- printer->add_line (" {} = {};" _format (name, " {:g} " _format ( value) ));
2984
+ printer->add_line (" {} = {:g };" _format (name, value));
3016
2985
}
3017
2986
3018
2987
if (info.table_count > 0 ) {
@@ -3139,10 +3108,8 @@ void CodegenCVisitor::print_instance_variable_setup() {
3139
3108
}
3140
3109
3141
3110
std::string stride;
3142
- if (layout == LayoutType::soa) {
3143
- printer->add_line (" int pnodecount = ml->_nodecount_padded;" );
3144
- stride = " *pnodecount" ;
3145
- }
3111
+ printer->add_line (" int pnodecount = ml->_nodecount_padded;" );
3112
+ stride = " *pnodecount" ;
3146
3113
3147
3114
printer->add_line (" Datum* indexes = ml->pdata;" );
3148
3115
@@ -3317,8 +3284,6 @@ void CodegenCVisitor::print_nrn_init(bool skip_init_check) {
3317
3284
print_channel_iteration_tiling_block_begin (BlockType::Initial);
3318
3285
print_channel_iteration_block_begin (BlockType::Initial);
3319
3286
3320
- print_post_channel_iteration_common_code ();
3321
-
3322
3287
if (info.net_receive_node != nullptr ) {
3323
3288
printer->add_line (" {} = -1e20;" _format (get_variable_name (" tsave" )));
3324
3289
}
@@ -3411,7 +3376,6 @@ void CodegenCVisitor::print_watch_check() {
3411
3376
print_global_function_common_code (BlockType::Watch);
3412
3377
print_channel_iteration_tiling_block_begin (BlockType::Watch);
3413
3378
print_channel_iteration_block_begin (BlockType::Watch);
3414
- print_post_channel_iteration_common_code ();
3415
3379
3416
3380
if (info.is_voltage_used_by_watch_statements ()) {
3417
3381
printer->add_line (" int node_id = node_index[id];" );
@@ -3798,9 +3762,7 @@ void CodegenCVisitor::visit_for_netcon(const ast::ForNetcon& node) {
3798
3762
})->index ;
3799
3763
const auto num_int = int_variables_size ();
3800
3764
3801
- std::string offset = (layout == LayoutType::soa) ? " {}*pnodecount + id" _format (index )
3802
- : " {} + id*{}" _format (index , num_int);
3803
- printer->add_text (" const size_t offset = {};" _format (offset));
3765
+ printer->add_text (" const size_t offset = {}*pnodecount + id;" _format (index ));
3804
3766
printer->add_newline ();
3805
3767
printer->add_line (
3806
3768
" const size_t for_netcon_start = nt->_fornetcon_perm_indices[indexes[offset]];" );
@@ -3925,7 +3887,7 @@ void CodegenCVisitor::print_derivimplicit_kernel(Block* block) {
3925
3887
auto list_num = info.derivimplicit_list_num ;
3926
3888
auto block_name = block->get_node_name ();
3927
3889
auto primes_size = info.primes_size ;
3928
- auto stride = (layout == LayoutType::aos) ? " " : " *pnodecount+id" ;
3890
+ auto stride = " *pnodecount+id" ;
3929
3891
3930
3892
printer->add_newline (2 );
3931
3893
@@ -4037,7 +3999,6 @@ void CodegenCVisitor::print_nrn_state() {
4037
3999
print_global_function_common_code (BlockType::State);
4038
4000
print_channel_iteration_tiling_block_begin (BlockType::State);
4039
4001
print_channel_iteration_block_begin (BlockType::State);
4040
- print_post_channel_iteration_common_code ();
4041
4002
4042
4003
printer->add_line (" int node_id = node_index[id];" );
4043
4004
printer->add_line (" double v = voltage[node_id];" );
@@ -4252,7 +4213,6 @@ void CodegenCVisitor::print_nrn_cur() {
4252
4213
print_global_function_common_code (BlockType::Equation);
4253
4214
print_channel_iteration_tiling_block_begin (BlockType::Equation);
4254
4215
print_channel_iteration_block_begin (BlockType::Equation);
4255
- print_post_channel_iteration_common_code ();
4256
4216
print_nrn_cur_kernel (*info.breakpoint_node );
4257
4217
print_nrn_cur_matrix_shadow_update ();
4258
4218
if (!nrn_cur_reduction_loop_required ()) {
@@ -4300,7 +4260,6 @@ void CodegenCVisitor::print_namespace_end() {
4300
4260
4301
4261
void CodegenCVisitor::print_common_getters () {
4302
4262
print_first_pointer_var_index_getter ();
4303
- print_memory_layout_getter ();
4304
4263
print_net_receive_arg_size_getter ();
4305
4264
print_thread_getters ();
4306
4265
print_num_variable_getter ();
0 commit comments