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

[LLVM][RUNTIME] Fix RISC-V CodeModel propagation to ORCJIT runtime executor #17347

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

cbalint13
Copy link
Contributor

@cbalint13 cbalint13 commented Sep 8, 2024

This PR fixes ORCJIT link failures for RISC-V targets by properly setting the code model on the executor.


Initial bug report is here: https://discuss.tvm.apache.org/t/run-tvm-software-stack-on-risc-v/17683

Rationale

  • RISC-V recommended and required code model was set already here, but was ignored:
    // RISCV code model
    auto arch = llvm::Triple(triple_).getArch();
    if (arch == llvm::Triple::riscv32 || arch == llvm::Triple::riscv64) {
    code_model_ = llvm::CodeModel::Medium;
    }
  • RISC-V targets will work only with the newer ORCJIT engine as described in PR#15964
  • This PR adds missing code model settings for the ORCJIT engine.

In case of RISC-V, by not setting the code model to explicit Medium may give ralocation R_RISCV_HI20 errors.

Cc: @Lunderberg , @ekalda , @lhutton1 , @quic-sanirudh , @tqchen
Cc: @katebern-grovety , @PhilippvK


LATER UPDATE (due to unexpected i386 failure):

  • This PR propagates explicit code/reloc model only for RISC-V arches.
  • Just as before, by default will leave the ORCJIT to decide the best code/reloc
  • Same JIT setup, and RISCV case handling can be seen in the Halide ORCJIT

Copy link
Contributor

@quic-sanirudh quic-sanirudh left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks.

@cbalint13 cbalint13 force-pushed the llvm-orcjit-codemodel branch from 5836db4 to 3bb26f9 Compare September 9, 2024 08:28
@cbalint13 cbalint13 force-pushed the llvm-orcjit-codemodel branch from 3bb26f9 to f30297a Compare September 9, 2024 17:32
@cbalint13 cbalint13 changed the title [LLVM][RUNTIME] Fix CodeModel propagation to ORCJIT runtime executor [LLVM][RUNTIME] Fix RISC-V CodeModel propagation to ORCJIT runtime executor Sep 9, 2024
@cbalint13 cbalint13 merged commit d7e0af2 into apache:main Sep 10, 2024
17 of 20 checks passed
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