@@ -1023,6 +1023,50 @@ asm_parser::inject_hintmap_save_restore(int col,
10231023 for (const auto & hm : grp.hintmaps )
10241024 m_hintmap_labels[col_prefix + hm] = grp.labels ;
10251025
1026+ // When hint_bitmap is all-zero the scratchpad size is 0: no state needs to
1027+ // be saved or restored. Inject minimal dummy jobs so the PREEMPT opcode
1028+ // still has valid save/restore label targets, but skip all BD configuration
1029+ // and stream-switch routing that the full templates would generate.
1030+ if (grp.size == 0 ) {
1031+ const std::string& slabel = grp.labels .first ;
1032+ const std::string& rlabel = grp.labels .second ;
1033+ log_info () << " hint_bitmap is 0 for col " << col
1034+ << " : injecting dummy save/restore jobs (labels @"
1035+ << slabel << " / @" << rlabel << " )" << std::endl;
1036+
1037+ const std::string save_asm =
1038+ slabel + " :\n "
1039+ " START_JOB 0\n "
1040+ " NOP\n "
1041+ " END_JOB\n "
1042+ " EOF\n "
1043+ " \n .endl " + slabel + " \n " ;
1044+
1045+ const std::string restore_asm =
1046+ rlabel + " :\n "
1047+ " START_JOB 0\n "
1048+ " LOAD_LAST_PDI\n "
1049+ " END_JOB\n "
1050+ " EOF\n "
1051+ " \n .endl " + rlabel + " \n " ;
1052+
1053+ m_current_col = col;
1054+ std::string dummy_save_file = " 0_0_" + save_file;
1055+ std::string dummy_restore_file = " 0_0_" + restore_file;
1056+ log_info () << " Adding dummy save_file: " << dummy_save_file << " [size: " << save_asm.size ()
1057+ << " ], restore_file: " << dummy_restore_file << " [size: " << restore_asm.size () << " ]" << std::endl;
1058+ set_data_state (false );
1059+ parse_lines (std::vector<char >(save_asm.begin (), save_asm.end ()),
1060+ dummy_save_file);
1061+ pop_data_state ();
1062+
1063+ set_data_state (false );
1064+ parse_lines (std::vector<char >(restore_asm.begin (), restore_asm.end ()),
1065+ dummy_restore_file);
1066+ pop_data_state ();
1067+ return ;
1068+ }
1069+
10261070 // Modify save_file like {scratchaddress}_{size}_aie4_save_3c.asm / {scratchaddress}_{size}_aie4_restore_3c.asm
10271071 std::string save_file_mod = std::to_string (grp.scratchbase / CHUNK_SIZE) + " _" + std::to_string (grp.size / CHUNK_SIZE) + " _" + save_file;
10281072 std::string restore_file_mod = std::to_string (grp.scratchbase / CHUNK_SIZE) + " _" + std::to_string (grp.size / CHUNK_SIZE) + " _" + restore_file;
0 commit comments