Projects
Factory:RISC-V:ROCm
rocMLIR
_service:tar_scm:0001-Fix-build-on-riscv64.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0001-Fix-build-on-riscv64.patch of Package rocMLIR
From 6bdfbddb00d5550902970c05c512c46c2fe5862e Mon Sep 17 00:00:00 2001 From: misaka00251 <liuxin@iscas.ac.cn> Date: Tue, 26 Nov 2024 15:15:37 +0800 Subject: [PATCH] Fix build on riscv64 diff --git a/external/llvm-project/clang/lib/Basic/Targets/RISCV.h b/external/llvm-project/clang/lib/Basic/Targets/RISCV.h index 78580b5b1..720ee6989 100644 --- a/external/llvm-project/clang/lib/Basic/Targets/RISCV.h +++ b/external/llvm-project/clang/lib/Basic/Targets/RISCV.h @@ -49,6 +49,7 @@ public: MCountName = "_mcount"; HasFloat16 = true; HasStrictFP = true; + HasFloat128 = true; } bool setCPU(const std::string &Name) override { diff --git a/external/llvm-project/clang/lib/CodeGen/BackendUtil.cpp b/external/llvm-project/clang/lib/CodeGen/BackendUtil.cpp index 22c3f8642..a1d160411 100644 --- a/external/llvm-project/clang/lib/CodeGen/BackendUtil.cpp +++ b/external/llvm-project/clang/lib/CodeGen/BackendUtil.cpp @@ -302,6 +302,7 @@ getCodeModel(const CodeGenOptions &CodeGenOpts) { .Case("kernel", llvm::CodeModel::Kernel) .Case("medium", llvm::CodeModel::Medium) .Case("large", llvm::CodeModel::Large) + .Case("extreme", llvm::CodeModel::Large) .Case("default", ~1u) .Default(~0u); assert(CodeModel != ~0u && "invalid code model!"); diff --git a/external/llvm-project/clang/lib/Driver/ToolChains/HIPUtility.cpp b/external/llvm-project/clang/lib/Driver/ToolChains/HIPUtility.cpp index 08c647dfc..42f91a4e1 100644 --- a/external/llvm-project/clang/lib/Driver/ToolChains/HIPUtility.cpp +++ b/external/llvm-project/clang/lib/Driver/ToolChains/HIPUtility.cpp @@ -36,7 +36,7 @@ using llvm::dyn_cast; #endif namespace { -const unsigned HIPCodeObjectAlign = 4096; +const unsigned HIPCodeObjectAlign = 65536; } // namespace // Constructs a triple string for clang offload bundler. @@ -227,7 +227,12 @@ void HIP::constructHIPFatbinCommand(Compilation &C, const JobAction &JA, // ToDo: Remove the dummy host binary entry which is required by // clang-offload-bundler. +#if defined(__x86_64) std::string BundlerTargetArg = "-targets=host-x86_64-unknown-linux"; +#elif (defined(__riscv) && __riscv_xlen == 64) + std::string BundlerTargetArg = "-targets=host-riscv64-unknown-linux"; +#else +#endif // AMDGCN: // For code object version 2 and 3, the offload kind in bundle ID is 'hip' // for backward compatibility. For code object version 4 and greater, the diff --git a/external/llvm-project/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/external/llvm-project/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index dda7a7d74..dfbf86e25 100644 --- a/external/llvm-project/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/external/llvm-project/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -461,7 +461,12 @@ fatbinary(ArrayRef<std::pair<StringRef, StringRef>> InputFiles, SmallVector<StringRef, 16> CmdArgs; CmdArgs.push_back(*OffloadBundlerPath); CmdArgs.push_back("-type=o"); +#if defined(__x86_64) CmdArgs.push_back("-bundle-align=4096"); +#elif (defined(__riscv) && __riscv_xlen == 64) + CmdArgs.push_back("-bundle-align=65536"); +#else +#endif if (Args.hasArg(OPT_compress)) CmdArgs.push_back("-compress"); @@ -469,7 +474,12 @@ fatbinary(ArrayRef<std::pair<StringRef, StringRef>> InputFiles, CmdArgs.push_back( Args.MakeArgString(Twine("-compression-level=") + Arg->getValue())); +#if defined(__x86_64) SmallVector<StringRef> Targets = {"-targets=host-x86_64-unknown-linux"}; +#elif (defined(__riscv) && __riscv_xlen == 64) + SmallVector<StringRef> Targets = {"-targets=host-riscv64-unknown-linux"}; +#else +#endif for (const auto &[File, Arch] : InputFiles) Targets.push_back(Saver.save("hip-amdgcn-amd-amdhsa--" + Arch)); CmdArgs.push_back(Saver.save(llvm::join(Targets, ","))); diff --git a/mlir/tools/xmir-runner/CMakeLists.txt b/mlir/tools/xmir-runner/CMakeLists.txt index 81f484a51..bc88a0a7f 100644 --- a/mlir/tools/xmir-runner/CMakeLists.txt +++ b/mlir/tools/xmir-runner/CMakeLists.txt @@ -14,6 +14,10 @@ if(MLIR_ENABLE_ROCM_RUNNER) ${rocmlir_conversion_libs} ${rocmlir_test_libs} LLVMX86AsmParser + LLVMX86Desc + LLVMX86CodeGen + LLVMX86Info + LLVMRISCVArchAsmParser MLIRMHAL MLIRMHALTransforms MLIRMHALPipeline -- 2.47.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2