Skip to content

AIESW-36100: fix 'default' as filename in dtrace probe for config elfs#306

Open
HimanshuChoudhary-Xilinx wants to merge 1 commit into
Xilinx:main-gefrom
HimanshuChoudhary-Xilinx:default_name
Open

AIESW-36100: fix 'default' as filename in dtrace probe for config elfs#306
HimanshuChoudhary-Xilinx wants to merge 1 commit into
Xilinx:main-gefrom
HimanshuChoudhary-Xilinx:default_name

Conversation

@HimanshuChoudhary-Xilinx

Copy link
Copy Markdown
Collaborator

Problem solved by the commit

fix: https://jira.xilinx.com/browse/AIESW-36100
aiebu dont know the filename for asm passed in buffer, so it put "default" as file in dump section.
But in case of full elf, user pass config.json in buffer. ASM filename is there in config.json which aiebu reads, so it knows the file name and should use this in dump section.

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

How problem was solved, alternative solutions (if any) and why they were rejected

Risks (if any) associated the changes in the commit

What has been tested and how, request additional testing if necessary

Documentation impact (if any)

TEST Added/fixed

  1. "aie2ps_ctrlcode_filename_config_assemble" which generate full elf with -f fulldump flag. It generate debug_map.json which should have actual filename instead of "default"
  2. "aie2ps_ctrlcode_filename_target_assemble" which generate legacy elf with -f fulldump flag. It generate debug_map.json which should have "default" as filename
  3. "move_ddr_to_memtile_ctrlpkt": which generate dtrace probe files which has actual filename instead of default

Signed-off-by: Himanshu Choudhary <Himanshu.Choudhary@amd.com>
Copilot AI review requested due to automatic review settings June 17, 2026 08:15

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread src/cpp/common/utils.h
constexpr uint32_t byte_to_bits = 8;
constexpr uint32_t shim_bd_len = 9;
constexpr opcode_type align_opcode = 0xA5;
const std::string default_source_filename = "default";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initialization of 'default_source_filename' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp]

const std::string default_source_filename = "default";
                  ^
Additional context

/usr/include/c++/13/bits/basic_string.h:640: possibly throwing constructor declared here

      basic_string(const _CharT* __s, const _Alloc& __a = _Alloc())
      ^

const file_artifact* m_artifacts = nullptr;
uint32_t m_control_packet_index = 0xFFFFFFFF;
uint32_t m_control_packet_offset_correction = 8;
std::string m_source_filename = default_source_filename;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: member variable 'm_source_filename' has protected visibility [cppcoreguidelines-non-private-member-variables-in-classes]

  std::string m_source_filename = default_source_filename;
              ^

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes debug/dtrace metadata so that when building aie2ps_config (full ELF) inputs, the generated dump/debug map uses the actual ASM filename from ctrl_code_file (instead of the placeholder "default"). It threads a “source filename” through the aie2ps preprocessor into the ASM parser, and updates golden test artifacts accordingly.

Changes:

  • Add a source_filename field to aie2ps preprocessor inputs (populated from ctrl_code_file for config flows) and pass it into asm_parser::parse_lines(...).
  • Track the current parse file index in asm_parser and use it when inserting synthetic eof entries so dumps map back to the correct file.
  • Add/adjust tests and golden outputs for both config and target flows (config should show real file path; target remains "default").

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/aie4-ctrlcode/move_ddr_to_memtile_ctrlpkt/gold.md5 Update golden hash for changed probe output.
test/aie4-ctrlcode/move_ddr_to_memtile_ctrlpkt/gold_trace_probe.txt Golden probe output now shows actual filename (test.asm) instead of default.
test/aie4-ctrlcode/move_ddr_to_memtile_ctrlpkt/gold_opcode_info.txt Golden opcode metadata updated to expected filename.
test/aie2ps-ctrlcode/ctrlcode_filename/target/gold_debug_map.json New golden: target flow expects "default" filenames.
test/aie2ps-ctrlcode/ctrlcode_filename/target/CMakeLists.txt New ctest targets for target-flow filename behavior.
test/aie2ps-ctrlcode/ctrlcode_filename/ml_asm/merged_control.asm New minimal ASM source used by filename tests.
test/aie2ps-ctrlcode/ctrlcode_filename/config/gold_debug_map.json New golden: config flow expects ctrl_code_file path in "file".
test/aie2ps-ctrlcode/ctrlcode_filename/config/config.json New config fixture providing ctrl_code_file.
test/aie2ps-ctrlcode/ctrlcode_filename/config/CMakeLists.txt New ctest targets for config-flow filename behavior.
test/aie2ps-ctrlcode/ctrlcode_filename/CMakeLists.txt Adds config/target subdirectories to tests.
test/aie2ps-ctrlcode/CMakeLists.txt Registers the new ctrlcode_filename test suite.
src/cpp/preprocessor/asm/asm_parser.h API updates: pass source filename into parse_lines, store current parse file index.
src/cpp/preprocessor/asm/asm_parser.cpp Implements parse_lines(source_filename) and uses current file idx for synthetic eof.
src/cpp/preprocessor/aie2ps/aie2ps_preprocessor.h Passes input source filename into parser; updates pager default file idx.
src/cpp/preprocessor/aie2ps/aie2ps_preprocessor_input.h Adds source_filename to inputs; populates it from config ctrl_code_file.
src/cpp/common/utils.h Defines default_source_filename constant used as the fallback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 356 to 358
const uint32_t parse_file_idx = intern_filename(file);
m_current_parse_file_idx = parse_file_idx;
// Scan str for newlines directly instead of copying it into an istringstream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants