Skip to content

Commit 69d7854

Browse files
fix actor id's
Signed-off-by: HimanshuChoudhary-Xilinx <Himanshu.Choudhary@amd.com>
1 parent 11d81c5 commit 69d7854

2 files changed

Lines changed: 87 additions & 35 deletions

File tree

src/cpp/common/assembler_state.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,15 @@ uint32_t assembler_state::parse_num_arg(const std::string& str) {
150150
return it->second->get_pos();
151151
throw error(error::error_code::invalid_asm, "Label " + key + " not present in label map\n");
152152
}},
153-
{"s2mm_", [this](const std::string& s) -> uint32_t { return get_actor("s2mm", s); }},
154-
{"mm2s_", [this](const std::string& s) -> uint32_t { return get_actor("mm2s", s); }},
155-
{"mem_s2mm_", [this](const std::string& s) -> uint32_t { return get_actor("mem_s2mm", s); }},
156-
{"mem_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor("mem_mm2s", s); }},
157-
{"shim_s2mm_", [this](const std::string& s) -> uint32_t { return get_actor("shim_s2mm", s); }},
158-
{"shim_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor("shim_mm2s", s); }},
159-
{"tile_s2mm_", [this](const std::string& s) -> uint32_t { return get_actor("tile_s2mm", s); }},
160-
{"tile_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor("tile_mm2s", s); }},
161-
{"shim_ctrl_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor("shim_ctrl_mm2s", s); }}
153+
{"s2mm_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
154+
{"mm2s_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
155+
{"mem_s2mm_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
156+
{"mem_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
157+
{"shim_s2mm_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
158+
{"shim_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
159+
{"tile_s2mm_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
160+
{"tile_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor(s); }},
161+
{"shim_ctrl_mm2s_", [this](const std::string& s) -> uint32_t { return get_actor(s); }}
162162
};
163163

164164
// check if its pad/label/actor

src/cpp/common/assembler_state.h

Lines changed: 78 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,11 @@ class assembler_state : public std::enable_shared_from_this<assembler_state>
130130

131131
//std::unordered_map<std::string, ActionId> actor_id;
132132

133-
virtual std::unordered_map<std::string, ActionId>& get_actor_id_map() const = 0;
134-
uint32_t get_actor(const std::string& prefix, const std::string& s) const
133+
virtual std::unordered_map<std::string, uint32_t>& get_actor_id_map() const = 0;
134+
uint32_t get_actor(const std::string& s) const
135135
{
136-
std::unordered_map<std::string, ActionId>& actor_id = get_actor_id_map();
137-
uint32_t actor = std::stoi(s.substr(actor_id.at(prefix).actor_start));
138-
return actor_id.at(prefix).base_actor_offset + actor;
136+
std::unordered_map<std::string, uint32_t>& actor_id = get_actor_id_map();
137+
return actor_id.at(s);
139138
}
140139

141140
assembler_state(std::shared_ptr<std::map<std::string, std::shared_ptr<isa_op>>> isa,
@@ -207,21 +206,45 @@ class assembler_state : public std::enable_shared_from_this<assembler_state>
207206

208207
class assembler_state_aie2ps : public assembler_state
209208
{
210-
std::unordered_map<std::string, ActionId>&
209+
std::unordered_map<std::string, uint32_t>&
211210
get_actor_id_map() const override
212211
{
213-
static std::unordered_map<std::string, ActionId> actor_id = {
214-
{"mm2s", {5, 6}}, //NOLINT
215-
{"s2mm", {5, 0}}, //NOLINT
216-
{"tile_mm2s", {10, 6}}, //NOLINT
217-
{"tile_s2mm", {10, 0}}, //NOLINT
218-
{"shim_mm2s", {10, 6}}, //NOLINT
219-
{"shim_s2mm", {10, 0}}, //NOLINT
220-
{"mem_mm2s", {9, 6}}, //NOLINT
221-
{"mem_s2mm", {9, 0}} //NOLINT
212+
static std::unordered_map<std::string, uint32_t> actor_id = {
213+
//{"s2mm_0", 0}, //NOLINT
214+
//{"s2mm_1", 1}, //NOLINT
215+
216+
//{"mm2s_0", 6}, //NOLINT
217+
//{"mm2s_1", 7}, //NOLINT
218+
219+
{"shim_s2mm_0", 0}, //NOLINT
220+
{"shim_s2mm_1", 1}, //NOLINT
221+
222+
{"shim_mm2s_0", 6}, //NOLINT
223+
{"shim_mm2s_1", 7}, //NOLINT
224+
225+
{"mem_s2mm_0", 0}, //NOLINT
226+
{"mem_s2mm_1", 1}, //NOLINT
227+
{"mem_s2mm_2", 2}, //NOLINT
228+
{"mem_s2mm_3", 3}, //NOLINT
229+
{"mem_s2mm_4", 4}, //NOLINT
230+
{"mem_s2mm_5", 5}, //NOLINT
231+
232+
{"mem_mm2s_0", 6}, //NOLINT
233+
{"mem_mm2s_1", 7}, //NOLINT
234+
{"mem_mm2s_2", 8}, //NOLINT
235+
{"mem_mm2s_3", 9}, //NOLINT
236+
{"mem_mm2s_4", 10}, //NOLINT
237+
{"mem_mm2s_5", 11}, //NOLINT
238+
239+
{"tile_s2mm_0", 0}, //NOLINT
240+
{"tile_s2mm_1", 1}, //NOLINT
241+
{"tile_mm2s_0", 6}, //NOLINT
242+
{"tile_mm2s_1", 7}, //NOLINT
243+
{"tile_core", 15}, //NOLINT
222244
};
223245
return actor_id;
224246
}
247+
225248
public:
226249
assembler_state_aie2ps(std::shared_ptr<std::map<std::string, std::shared_ptr<isa_op>>> isa,
227250
std::vector<std::shared_ptr<asm_data>>& data,
@@ -239,19 +262,48 @@ class assembler_state_aie2ps : public assembler_state
239262

240263
class assembler_state_aie4 : public assembler_state
241264
{
242-
std::unordered_map<std::string, ActionId>&
265+
std::unordered_map<std::string, uint32_t>&
243266
get_actor_id_map() const override
244267
{
245-
static std::unordered_map<std::string, ActionId> actor_id = {
246-
{"mm2s", {5, 6}}, //NOLINT
247-
{"s2mm", {5, 0}}, //NOLINT
248-
{"tile_mm2s", {10, 6}}, //NOLINT
249-
{"tile_s2mm", {10, 0}}, //NOLINT
250-
{"shim_mm2s", {10, 6}}, //NOLINT
251-
{"shim_s2mm", {10, 0}}, //NOLINT
252-
{"mem_mm2s", {9, 16}}, //NOLINT
253-
{"mem_s2mm", {9, 0}}, //NOLINT
254-
{"shim_ctrl_mm2s", {15, 16}} //NOLINT
268+
static std::unordered_map<std::string, uint32_t> actor_id = {
269+
{"shim_s2mm_0", 0}, //NOLINT
270+
{"shim_trace_s2mm", 1}, //NOLINT
271+
{"shim_s2mm_1", 2}, //NOLINT
272+
273+
{"shim_mm2s_0", 6}, //NOLINT
274+
{"shim_mm2s_1", 7}, //NOLINT
275+
{"shim_mm2s_2", 8}, //NOLINT
276+
{"shim_mm2s_3", 9}, //NOLINT
277+
278+
{"shim_ctrl_mm2s_0", 16}, //NOLINT
279+
{"shim_ctrl_mm2s_1", 17}, //NOLINT
280+
281+
{"mem_s2mm_0", 0}, //NOLINT
282+
{"mem_s2mm_1", 1}, //NOLINT
283+
{"mem_s2mm_2", 2}, //NOLINT
284+
{"mem_s2mm_3", 3}, //NOLINT
285+
{"mem_s2mm_4", 4}, //NOLINT
286+
{"mem_s2mm_5", 5}, //NOLINT
287+
{"mem_s2mm_6", 6}, //NOLINT
288+
{"mem_s2mm_7", 7}, //NOLINT
289+
290+
{"mem_mm2s_0", 16}, //NOLINT
291+
{"mem_mm2s_1", 17}, //NOLINT
292+
{"mem_mm2s_2", 18}, //NOLINT
293+
{"mem_mm2s_3", 19}, //NOLINT
294+
{"mem_mm2s_4", 20}, //NOLINT
295+
{"mem_mm2s_5", 22}, //NOLINT
296+
{"mem_mm2s_6", 23}, //NOLINT
297+
{"mem_mm2s_7", 24}, //NOLINT
298+
{"mem_mm2s_8", 25}, //NOLINT
299+
{"mem_mm2s_9", 26}, //NOLINT
300+
301+
{"tile_s2mm_0", 0}, //NOLINT
302+
{"tile_s2mm_1", 1}, //NOLINT
303+
304+
{"tile_mm2s_0", 6}, //NOLINT
305+
306+
{"tile_core", 15}, //NOLINT
255307
};
256308
return actor_id;
257309
}

0 commit comments

Comments
 (0)