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

Add Linear ASM compiler #13989

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Freed-Wu
Copy link
Contributor

@Freed-Wu Freed-Wu commented Dec 9, 2024

Fix #13670

PS:

  • same feature for cmake
  • feature request for xmake

@Freed-Wu Freed-Wu force-pushed the linearasm branch 7 times, most recently from dcaaab8 to 5c74747 Compare December 9, 2024 17:02
@Freed-Wu
Copy link
Contributor Author

Freed-Wu commented Dec 9, 2024

Now it works for me 😄

Copy link
Member

@dcbaker dcbaker left a comment

Choose a reason for hiding this comment

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

This deserves a release snippet, otherwise this all looks good to me.

@Freed-Wu
Copy link
Contributor Author

Freed-Wu commented Dec 9, 2024

What is a release snippet?

BTW, I use name TILinearAsmCompiler for *.sa. because cmake want to use ASM_LINEAR.

Currently, only c6000 support linear assemble *.sa. see cl6x --help | grep linear asm can find it.
other TI compilers for chip cl2000, cl430, armcl, tiarmcl don't support it. so we check it in sanity_check()

@dcbaker
Copy link
Member

dcbaker commented Dec 9, 2024

A release snippet is a small markdown description of the feature that will be put into the release notes when we cut 1.7.0, they go in docs/markdown/snippets, you can look at the existing snippets to see what they should look like.

Comment on lines +268 to +269
for_machine: 'MachineChoice', info: 'MachineInfo',
linker: T.Optional['DynamicLinker'] = None,
Copy link
Member

Choose a reason for hiding this comment

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

Avoid quoting type annotations in newly introduced code. It is an older style and unnecessary since we now require a minimum python >=3.7 and started using from __future__ import annotations.

def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]:
return []

def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

@@ -1353,6 +1354,26 @@ def detect_masm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
_handle_exceptions(popen_exceptions, [comp])
raise EnvironmentException('Unreachable code (exception to make mypy happy)')

def detect_linearasm_compiler(env: 'Environment', for_machine: MachineChoice) -> Compiler:
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Comment on lines +1359 to +1368
comp = ['cl6x']
comp_class: T.Type[Compiler] = TILinearAsmCompiler
arg = '-h'
info = env.machines[for_machine]
cc = detect_c_compiler(env, for_machine)
is_cross = env.is_cross_build(for_machine)

popen_exceptions: T.Dict[str, Exception] = {}
try:
output = Popen_safe(comp + [arg])[2]
Copy link
Member

Choose a reason for hiding this comment

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

We are hardcoding the compiler as cl6x instead of looking it up via the machine info. This seems suboptimal...

Copy link
Member

Choose a reason for hiding this comment

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

On the other hand, it looks like masm handling already does that too. @dcbaker what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Sigh... We need to fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How to fix that?

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.

[feature] Support linear assembly of TI DSP
3 participants