Skip to content

Add llvm linker tool for RISCV target - #5348

Merged
hcindyl merged 3 commits into
iree-org:mainfrom
hcindyl:riscv-linker
Apr 19, 2021
Merged

hcindyl merged 3 commits into
iree-org:mainfrom
hcindyl:riscv-linker

Conversation

@hcindyl

@hcindyl hcindyl commented Apr 8, 2021 •

Copy link
Copy Markdown
Contributor

It pretty much follows the Unix setup. However, the user need to set
the RISCV_TOOLCHAIN_ROOT for RISC-V cross-compilation. The original
IREE_LLVMAOT_LINKER_PATH still works but could cause problems in native
compile.

Update the doc and bootstrap script accordingly.

This also removes the following noisy clang warning of:

warning: argument unused during compilation: '-undefined suppress' [-Wunused-command-line-argument]
as it is not supported by RISCV toolchain

@hcindyl hcindyl added the codegen/llvm LLVM code generation compiler backend label Apr 8, 2021
@google-cla google-cla Bot added the cla: yes label Apr 8, 2021
@hcindyl

hcindyl commented Apr 8, 2021

Copy link
Copy Markdown
Contributor Author

Context: This is the followup patch for the discussion in #5199 (comment)

hcindyl added 2 commits April 8, 2021 09:28
It pretty much follows the Unix settup. However, the user need to set
the IREE_LLVMAOT_LINKER_PATH explicitly with the clang built for RISCV.

This also removes the following noisy clang warning of:

> warning: argument unused during compilation: '-undefined suppress' [-Wunused-command-line-argument]
auto toolPath = LinkerTool::getToolPath();
if (!toolPath.empty()) return toolPath;

llvm::errs() << "IREE_LLVMAOT_LINKER_PATH environment variable must be set"

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.

This is just enforcing setting the env linker path, You can follow Android linker https://github.com/google/iree/blob/main/iree/compiler/Dialect/HAL/Target/LLVM/internal/AndroidLinkerTool.cpp#L84
and query one of the environment variables you use to build the runtime for RISK-V. In the android linker for example we set ANDRID_NDK to build the android runtime then the same variable is used again in linker.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. For RISC-V the toolchain was defined in a custom cmake file so originally there's no environment variable to be set. I followed Android's example and set one for RISC-V. Also update the doc and the bootstrap script to reflect that. Please take a look.

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.

Thanks @hcindyl

@MaheshRavishankar
MaheshRavishankar removed their request for review April 16, 2021 16:08
@MaheshRavishankar

Copy link
Copy Markdown
Collaborator

Ahmed has more context on this than me.

ADD RISCV_TOOLCHAIN_ROOT for RISC-V cross-compilation. The original
IREE_LLVMAOT_LINKER_PATH still works but could cause problems in native
compile.

Update the doc and bootstrap script accordingly.
@hcindyl
hcindyl merged commit f02a32f into iree-org:main Apr 19, 2021
copybara-service Bot pushed a commit that referenced this pull request Apr 20, 2021
* f02a32f Add llvm linker tool for RISCV target (#5348)
* 2e43671 Merge google -> main (#5526)
* 289c43c Update objectives.md (#5525)
* a6cc962 Use --first-parent when summarizing branch merge changes (#5527)
* be2ff17 Added tests for tosa.reduce_* (#5471)

COPYBARA_INTEGRATE_REVIEW=#5530 from GMNGeoffrey:main-to-google f02a32f
PiperOrigin-RevId: 369354317
iree-github-actions-bot pushed a commit that referenced this pull request Apr 20, 2021
* f02a32f Add llvm linker tool for RISCV target (#5348)
* 2e43671 Merge google -> main (#5526)
* 289c43c Update objectives.md (#5525)
* a6cc962 Use --first-parent when summarizing branch merge changes (#5527)
* be2ff17 Added tests for tosa.reduce_* (#5471)

PiperOrigin-RevId: 369354317
@hcindyl
hcindyl deleted the riscv-linker branch April 22, 2021 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codegen/llvm LLVM code generation compiler backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants