Skip to content

Commit

Permalink
Rename print_parallel_iteration_hint. (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Nov 1, 2024
1 parent 3df34b9 commit 095fc75
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
3 changes: 1 addition & 2 deletions src/codegen/codegen_acc_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ namespace codegen {
* for(int id=0; id<nodecount; id++) {
*
*/
void CodegenAccVisitor::print_channel_iteration_block_parallel_hint(BlockType type,
const ast::Block* block) {
void CodegenAccVisitor::print_parallel_iteration_hint(BlockType type, const ast::Block* block) {
if (info.artificial_cell) {
return;
}
Expand Down
3 changes: 1 addition & 2 deletions src/codegen/codegen_acc_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class CodegenAccVisitor: public CodegenCoreneuronCppVisitor {


/// ivdep like annotation for channel iterations
void print_channel_iteration_block_parallel_hint(BlockType type,
const ast::Block* block) override;
void print_parallel_iteration_hint(BlockType type, const ast::Block* block) override;


/// atomic update pragma for reduction statements
Expand Down
12 changes: 6 additions & 6 deletions src/codegen/codegen_coreneuron_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ void CodegenCoreneuronCppVisitor::print_nrn_init(bool skip_init_check) {
print_dt_update_to_device();
}

print_channel_iteration_block_parallel_hint(BlockType::Initial, info.initial_node);
print_parallel_iteration_hint(BlockType::Initial, info.initial_node);
printer->push_block("for (int id = 0; id < nodecount; id++)");

if (info.net_receive_node != nullptr) {
Expand Down Expand Up @@ -1902,7 +1902,7 @@ void CodegenCoreneuronCppVisitor::print_before_after_block(const ast::Block* nod
printer->fmt_line("/** {} of block type {} # {} */", ba_type, ba_block_type, block_id);
print_global_function_common_code(BlockType::BeforeAfter, function_name);

print_channel_iteration_block_parallel_hint(BlockType::BeforeAfter, node);
print_parallel_iteration_hint(BlockType::BeforeAfter, node);
printer->push_block("for (int id = 0; id < nodecount; id++)");

printer->add_line("int node_id = node_index[id];");
Expand Down Expand Up @@ -2031,7 +2031,7 @@ void CodegenCoreneuronCppVisitor::print_watch_check() {
// net_receive function we already check if it contains any MUTEX/PROTECT
// constructs. As WATCH is not a top level block but list of statements,
// we don't need to have ivdep pragma related check
print_channel_iteration_block_parallel_hint(BlockType::Watch, nullptr);
print_parallel_iteration_hint(BlockType::Watch, nullptr);

printer->push_block("for (int id = 0; id < nodecount; id++)");

Expand Down Expand Up @@ -2345,7 +2345,7 @@ void CodegenCoreneuronCppVisitor::print_get_memb_list() {

void CodegenCoreneuronCppVisitor::print_net_receive_loop_begin() {
printer->add_line("int count = nrb->_displ_cnt;");
print_channel_iteration_block_parallel_hint(BlockType::NetReceive, info.net_receive_node);
print_parallel_iteration_hint(BlockType::NetReceive, info.net_receive_node);
printer->push_block("for (int i = 0; i < count; i++)");
}

Expand Down Expand Up @@ -2647,7 +2647,7 @@ void CodegenCoreneuronCppVisitor::print_nrn_state() {
printer->add_newline(2);
printer->add_line("/** update state */");
print_global_function_common_code(BlockType::State);
print_channel_iteration_block_parallel_hint(BlockType::State, info.nrn_state_block);
print_parallel_iteration_hint(BlockType::State, info.nrn_state_block);
printer->push_block("for (int id = 0; id < nodecount; id++)");

printer->add_line("int node_id = node_index[id];");
Expand Down Expand Up @@ -2860,7 +2860,7 @@ void CodegenCoreneuronCppVisitor::print_nrn_cur() {
printer->add_newline(2);
printer->add_line("/** update current */");
print_global_function_common_code(BlockType::Equation);
print_channel_iteration_block_parallel_hint(BlockType::Equation, info.breakpoint_node);
print_parallel_iteration_hint(BlockType::Equation, info.breakpoint_node);
printer->push_block("for (int id = 0; id < nodecount; id++)");
print_nrn_cur_kernel(*info.breakpoint_node);
print_nrn_cur_matrix_shadow_update();
Expand Down
4 changes: 2 additions & 2 deletions src/codegen/codegen_cpp_visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,8 @@ std::string CodegenCppVisitor::breakpoint_current(std::string current) const {
* for(int id = 0; id < nodecount; id++) {
* \endcode
*/
void CodegenCppVisitor::print_channel_iteration_block_parallel_hint(BlockType /* type */,
const ast::Block* block) {
void CodegenCppVisitor::print_parallel_iteration_hint(BlockType /* type */,
const ast::Block* block) {
// ivdep allows SIMD parallelisation of a block/loop but doesn't provide
// a standard mechanism for atomics. Also, even with openmp 5.0, openmp
// atomics do not enable vectorisation under "omp simd" (gives compiler
Expand Down
3 changes: 1 addition & 2 deletions src/codegen/codegen_cpp_visitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,7 @@ class CodegenCppVisitor: public visitor::ConstAstVisitor {
*
* \param type The block type
*/
virtual void print_channel_iteration_block_parallel_hint(BlockType type,
const ast::Block* block);
virtual void print_parallel_iteration_hint(BlockType type, const ast::Block* block);


/****************************************************************************************/
Expand Down

0 comments on commit 095fc75

Please sign in to comment.