Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REQUEST] Add support for handling comments generated by fcc compiler at the beginning of instruction code. #103

Open
adityauj opened this issue Feb 2, 2024 · 0 comments

Comments

@adityauj
Copy link

adityauj commented Feb 2, 2024

Is your feature request related to a problem? Please describe.
OSACA is able to parse the asm file generated by fcc compiler. If fcc compiler generates comment at the beginning of each line of asm code, OSACA fails to parse those instructions and throws exception.

Describe the solution you'd like
Request to handle such asm files in OSACA. If it would be possible to remove those comments from asm file before parsing begins.

Describe alternatives you've considered
Manually removing those comments from asm file.

Additional context
Attaching the sample problematic asm file generated by fcc compiler.

Sample ASM
.LFB0:
.cfi_startproc
/* 1 / sub sp, sp, 64
.cfi_def_cfa_offset 64
/
??? / stp x29, x30, [sp, 48] // ()
.cfi_offset 29, -16
.cfi_offset 30, -8
/* ??? / str x19, [sp, 40] // ()
.cfi_offset 19, -24
.loc 1 3 0

Error
Executing (compile_kernel): fcc .heat.c_kerncraft/kernel.c -c -I../.local/lib/python3.6/site-packages/kerncraft/headers -o .heat.c_kerncraft/A64FX.yml/fcc/-Kfast_-DTOFU/kernel.s -Kfast -DTOFU -S -std=c99
Traceback (most recent call last):
File "/redacted/.local/lib/python3.6/site-packages/osaca/parser/parser_AArch64.py", line 320, in parse_line
result = self.parse_instruction(line)
File "/redacted/.local/lib/python3.6/site-packages/osaca/parser/parser_AArch64.py", line 338, in parse_instruction
result = self.instruction_parser.parseString(instruction, parseAll=True).asDict()
File "/redacted/.local/lib/python3.6/site-packages/pyparsing/util.py", line 256, in _inner
return fn(self, *args, **kwargs)
File "/redacted/.local/lib/python3.6/site-packages/pyparsing/core.py", line 1197, in parse_string
raise exc.with_traceback(None)
pyparsing.exceptions.ParseException: Expected W:(.0-9A-Za-z), found '/' (at char 0), (line:1, col:1)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/redacted/.local/bin/kerncraft", line 11, in
load_entry_point('kerncraft==0.8.12', 'console_scripts', 'kerncraft')()
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/kerncraft.py", line 402, in main
run(parser, args)
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/kerncraft.py", line 371, in run
model.analyze()
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/models/ecm.py", line 445, in analyze
self._CPU.analyze()
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/models/ecm.py", line 300, in analyze
verbose=self.verbose > 2)
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/kernel.py", line 1767, in incore_analysis
isa=self._machine['isa'])
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/incore_model.py", line 558, in asm_instrumentation
asm_lines = parse_asm(input_file.read(), isa)
File "/redacted/.local/lib/python3.6/site-packages/kerncraft/incore_model.py", line 530, in parse_asm
asm_lines = asm_parser.parse_file(code)
File "/redacted/.local/lib/python3.6/site-packages/osaca/parser/base_parser.py", line 58, in parse_file
asm_instructions.append(self.parse_line(line, i + 1 + start_line))
File "/redacted/.local/lib/python3.6/site-packages/osaca/parser/parser_AArch64.py", line 324, in parse_line
) from e
ValueError: Unable to parse '/* 1 */\tsub\tsp, sp, 64' on line 15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant