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

HPC ASIC requires -mstrict-align #95

Closed
hegza opened this issue Dec 12, 2024 · 2 comments
Closed

HPC ASIC requires -mstrict-align #95

hegza opened this issue Dec 12, 2024 · 2 comments

Comments

@hegza
Copy link
Contributor

hegza commented Dec 12, 2024

As per topic. I made #94 to try and address this but I couldn't quickly think of a way to prove or disprove if that actually works.

@hegza
Copy link
Contributor Author

hegza commented Dec 12, 2024

A surefire way to fix this would be to force a rebuild of the standard library (might require nightly) and define our own "target.json". We should do the latter anyway:

rustc +nightly -Z unstable-options --target=riscv64imac-unknown-none-elf --print target-spec-json > hpc.json

then edit this file to have +mstrict-align where appropriate.

Finally, we should make sure our compiler is building against this target specification instead of the built-in one.

@hegza
Copy link
Contributor Author

hegza commented Dec 12, 2024

Apparently the RISC-V compilers don't support the codegen option for -mstrict-align. Instead there are options such as:

unaligned-scalar-mem - Has reasonably performant unaligned scalar loads and stores. (supported by rustc)
zicclsm - 'Zicclsm' (Main Memory Supports Misaligned Loads/Stores). (supported by LLVM but not rustc)

This leads me to believe that perhaps strict alignment is the RISC-V default. I guess @andstepan was right 😃

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

No branches or pull requests

1 participant