Giter Site home page Giter Site logo

vortexgpgpu / pocl Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 14.0 59.45 MB

a clone of POCL that includes RISC-V newlib devices support and Vortex

License: MIT License

CMake 2.32% C 56.83% Shell 0.29% C++ 14.87% Python 0.80% LLVM 24.51% Ruby 0.24% Cuda 0.05% Dockerfile 0.05% Gnuplot 0.04%

pocl's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pocl's Issues

.../Clang No such file or directory

Hello,
I am using Ubuntu 20.04. I applied all the steps in this readme.riscv-linux.
At this line I am having such an error:

omerguzel@omerguzel-HP-Pro:~/Projects/pocl_example/riscv-gnu-toolchain/build/llvm/build$ $RISCV_TOOLCHAIN_PATH/clang hello.c
bash: /home/omerguzel/Projects/pocl_example/riscv-gnu-toolchain/build/../drops/clang: No such file or directory

Why does this happen? did I make a mistake during the building?

When I change it to this

omerguzel@omerguzel-HP-Pro:~/Projects/pocl_example/riscv-gnu-toolchain/build/llvm/build$ clang hello.c
hello.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.

It gives such an error. Could you help me with that, please?

Edit: I used the last version of the llvm because the version 10.x caused such an error:

0  lib/libLLVMBinaryFormat.so.10  lib/libLLVMSupport.so.10  -Wl,-rpath-link,/home/omerguzel/Projects/pocl_example/riscv-gnu-toolchain/build/llvm/build/lib && :
/usr/bin/ld: lib/Object/CMakeFiles/LLVMObject.dir/ArchiveWriter.cpp.o: in function `llvm::writeArchive(llvm::StringRef, llvm::ArrayRef<llvm::NewArchiveMember>, bool, llvm::object::Archive::Kind, bool, bool, std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer> >)':
ArchiveWriter.cpp:(.text._ZN4llvm12writeArchiveENS_9StringRefENS_8ArrayRefINS_16NewArchiveMemberEEEbNS_6object7Archive4KindEbbSt10unique_ptrINS_12MemoryBufferESt14default_deleteIS8_EE+0x1ab6): undefined reference to `llvm::raw_string_ostream::current_pos() const'
/usr/bin/ld: ArchiveWriter.cpp:(.text._ZN4llvm12writeArchiveENS_9StringRefENS_8ArrayRefINS_16NewArchiveMemberEEEbNS_6object7Archive4KindEbbSt10unique_ptrINS_12MemoryBufferESt14default_deleteIS8_EE+0x1ae9): undefined reference to `llvm::raw_string_ostream::current_pos() const'
/usr/bin/ld: ArchiveWriter.cpp:(.text._ZN4llvm12writeArchiveENS_9StringRefENS_8ArrayRefINS_16NewArchiveMemberEEEbNS_6object7Archive4KindEbbSt10unique_ptrINS_12MemoryBufferESt14default_deleteIS8_EE+0x1b16): undefined reference to `llvm::raw_string_ostream::current_pos() const'
/usr/bin/ld: ArchiveWriter.cpp:(.text._ZN4llvm12writeArchiveENS_9StringRefENS_8ArrayRefINS_16NewArchiveMemberEEEbNS_6object7Archive4KindEbbSt10unique_ptrINS_12MemoryBufferESt14default_deleteIS8_EE+0x1b41): undefined reference to `llvm::raw_string_ostream::current_pos() const'
/usr/bin/ld: ArchiveWriter.cpp:(.text._ZN4llvm12writeArchiveENS_9StringRefENS_8ArrayRefINS_16NewArchiveMemberEEEbNS_6object7Archive4KindEbbSt10unique_ptrINS_12MemoryBufferESt14default_deleteIS8_EE+0x1b6e): undefined reference to `llvm::raw_string_ostream::current_pos() const'
/usr/bin/ld: lib/Object/CMakeFiles/LLVMObject.dir/ArchiveWriter.cpp.o:ArchiveWriter.cpp:(.text._ZN4llvm12writeArchiveENS_9StringRefENS_8ArrayRefINS_16NewArchiveMemberEEEbNS_6object7Archive4KindEbbSt10unique_ptrINS_12MemoryBufferESt14default_deleteIS8_EE+0x1bad): more undefined references to `llvm::raw_string_ostream::current_pos() const' follow
collect2: error: ld returned 1 exit status
[1478/2985] Building CXX object lib/Passes/CMakeFiles/LLVMPasses.dir/PassBuilder.cpp.o
ninja: build stopped: subcommand failed.

atomic_add is not found on Vortex GPU

Hello,
I'm having a kernel that has atomic_add and It can't find it

[2022-08-02 10:27:08.178407820]POCL: in fn void appendToProgramBuildLog(cl_program, unsigned int, std::__cxx11::string&) at line 141:
  |     ERROR |  Error(s) while linking: 
Cannot find symbol _Z10atomic_addPU8CLglobalVjj in kernel library
Cannot find symbol _Z10atomic_incPU8CLglobalVj in kernel library
Cannot find symbol _Z10atomic_minPU8CLglobalVii in kernel library
[2022-08-02 10:27:08.182772764]POCL: in fn compile_and_link_program at line 641:
  |     ERROR | build_error_code pocl_llvm_build_program() failed

Error when run "dogfood/vecadd3/prebuilt.sh"

hi all:
I want to use pocl to build a spirv file, and i thought the script "dogfood/vecadd3/prebuilt.sh" was what i need。
However some error occurs when running the "dogfood/vecadd3/prebuilt.sh" script。
-------------------------------------------
Error Info:
Final POCL_DEBUG flags: FFFFFFFFFFFFFFFF
[2022-11-12 08:02:43.826648145]POCL: in fn pocl_init_devices at line 503:
| GENERAL | Installing SIGFPE handler...
[2022-11-12 08:02:43.826727399]POCL: in fn cl_int pocl_vortex_init(unsigned int, cl_device_id, const char*) at line 236:
| WARNING | INIT dlcache DOTO delete
[2022-11-12 08:02:43.827492932]POCL: in fn POclCreateProgramWithIL at line 66:
| LLVM | SPIR-V binary detected, converting to LLVM SPIR
[2022-11-12 08:02:43.828395629]POCL: in fn pocl_run_command at line 1107:
| GENERAL | Launching: /opt/vortex/llvm-riscv/bin/llvm-spirv
[2022-11-12 08:02:43.844885781]POCL: in fn POclCreateProgramWithIL at line 118:
| GENERAL | Creating context from IL for 1 devices
[2022-11-12 08:02:43.844915612]POCL: in fn compile_and_link_program at line 571:
| LLVM | building program with options (null)
[2022-11-12 08:02:43.845069770]POCL: in fn compile_and_link_program at line 662:
| LLVM | LLVM-SPIR binary detected
[2022-11-12 08:02:43.845093391]POCL: in fn compile_and_link_program at line 679:
| WARNING | SPIR binary provided, but no spir in build options
[2022-11-12 08:02:43.845510064]POCL: in fn llvm::Module* getKernelLibrary(cl_device_id) at line 894:
| LLVM | Using /opt/vortex/pocl/compiler/lib/../share/pocl/kernel-riscv32.bc as the built-in lib.
[2022-11-12 08:02:44.050439298]POCL: in fn int pocl_llvm_link_program(cl_program, unsigned int, char*, cl_uint, unsigned char**, size_t*, void**, int, int) at line 675:
| ERROR | CL_LINK_PROGRAM_FAILURE Device address bits != SPIR binary triple address bits, device: riscv32 / module: @�g�^U
[2022-11-12 08:02:44.050488262]POCL: in fn compile_and_link_program at line 688:
| ERROR | CL_LINK_PROGRAM_FAILURE Failed to link SPIR program.bc
CL_LINK_PROGRAM_FAILURE in main on line 395


About my environment:
vortexgpgpu/pocl repo: commit-id 778ef49 @ master (newest)
vortexgpgpu/vortex-toolchain-prebuilt: commit-id c411fbb@master (about 2month ago)

I only change some tool path in the dogfood/vecadd3/prebuilt.sh, no others changes to your code。
The diff is as follows:

compile_riscv_lx_spv()
{
-RISCV_TOOLCHAIN_PATH=/home/blaise/dev/riscv-gnu-toolchain/release_linux64
-LLVM_PREFIX=/home/blaise/dev/llvm-riscv/releaseRV64
-POCL_CC_PATH=/home/blaise/dev/pocl/drops_rvlx64_cc
-POCL_RT_PATH=/home/blaise/dev/pocl/drops_rvlx64_rt
+RISCV_TOOLCHAIN_PATH=/opt/vortex/riscv-gnu-toolchain
+LLVM_PREFIX=/opt/vortex/llvm-riscv
+POCL_CC_PATH=/opt/vortex/pocl/compiler
+POCL_RT_PATH=/opt/vortex/pocl/runtime

Build problem in LLVM

Hi all,

I have a problem in building LLVM with these parameter.

cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" -DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DBUILD_SHARED_LIBS=True -DCMAKE_INSTALL_PREFIX=$LLVM_PREFIX -DLLVM_BUILD_TESTS=False -DDEFAULT_SYSROOT=$RISCV_TOOLCHAIN_PATH/riscv32-unknown-elf -DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-elf" -DLLVM_TARGETS_TO_BUILD="RISCV" ../llvm

riscv-toolchain-path is build by this project.

The problem that I face during build process is that it can not link library lib/libLLVMObject.so. The error log is:

[0/5] Performing configure step for 'runtimes'
-- Could NOT find Terminfo (missing: Terminfo_LIBRARIES Terminfo_LINKABLE) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
-- Could NOT find Terminfo (missing: Terminfo_LIBRARIES Terminfo_LINKABLE) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
CMake Warning at /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/cmake/modules/HandleLLVMOptions.cmake:277 (message):
  -fPIC is not supported.
Call Stack (most recent call first):
  /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/cmake/modules/HandleLLVMOptions.cmake:324 (add_flag_or_print_warning)
  CMakeLists.txt:149 (include)


-- Using libunwind testing configuration: /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/libunwind/test/configs/llvm-libunwind-shared.cfg.in
CMake Error at /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/libunwind/src/CMakeLists.txt:109 (message):
  Compiler doesn't support generation of unwind tables if exception support
  is disabled.  Building libunwind DSO with runtime dependency on C++ ABI
  library is not supported.


-- Configuring incomplete, errors occurred!
See also "/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins/CMakeFiles/CMakeOutput.log".
See also "/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins/CMakeFiles/CMakeError.log".
FAILED: runtimes/runtimes-stamps/runtimes-configure 
cd /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-bins && /usr/bin/cmake -DCMAKE_C_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang -DCMAKE_CXX_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang++ -DCMAKE_ASM_COMPILER=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/clang -DCMAKE_AR=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-ar -DCMAKE_RANLIB=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-ranlib -DCMAKE_NM=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-nm -DCMAKE_OBJDUMP=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-objdump -DCMAKE_OBJCOPY=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-objcopy -DCMAKE_STRIP=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-strip -DCMAKE_READELF=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/./bin/llvm-readelf -DCMAKE_C_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_CXX_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_ASM_COMPILER_TARGET=riscv32-unknown-elf -DCMAKE_INSTALL_PREFIX=/home/homidi/Desktop/research/projects/llvm-riscv -DLLVM_BINARY_DIR=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build -DLLVM_CONFIG_PATH=/home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/bin/llvm-config -DLLVM_ENABLE_WERROR=OFF -DLLVM_HOST_TRIPLE=x86_64-unknown-linux-gnu -DLLVM_HAVE_LINK_VERSION_SCRIPT=1 -DLLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO=OFF -DLLVM_USE_RELATIVE_PATHS_IN_FILES=OFF -DLLVM_LIT_ARGS=-sv -DLLVM_SOURCE_PREFIX= -DPACKAGE_VERSION=15.0.4 -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/usr/bin/ninja -DCMAKE_C_COMPILER_LAUNCHER= -DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCOMPILER_RT_BUILD_BUILTINS=Off -DLLVM_INCLUDE_TESTS=OFF -DLLVM_DEFAULT_TARGET_TRIPLE=riscv32-unknown-elf -DLLVM_ENABLE_PROJECTS_USED=ON -DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON -DLLVM_BUILD_TOOLS=ON -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_CXX_COMPILER_WORKS=ON -DCMAKE_ASM_COMPILER_WORKS=ON -DHAVE_LLVM_LIT=ON "-DLLVM_ENABLE_RUNTIMES=libcxx;libcxxabi;libunwind" -GNinja /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/llvm/runtimes/../../runtimes && /usr/bin/cmake -E touch /home/homidi/Desktop/research/projects/llvm-project-llvmorg-15.0.4/build/runtimes/runtimes-stamps//runtimes-configure
ninja: build stopped: subcommand failed.

I do not have any idea about the problem and how solve this because everything seems to be ok. Is there anybody who has an idea how I can solve this issue?

can't link double-float modules with soft-float modules

Hello,

First off, Merry Christmas and big thanks for bringing out this great project to enhance OpenCL support in riscv.

I was trying to compile natively on a Hifive Unmatched board with a few patches from main pocl/pocl repo to allow compilation on llvm 11+. I defined -DLLC_HOST_CPU=sifive-u74. But when I run poclcc -o kernel.pocl kernel.cl to compile the kernel, I got linker errors can't link double-float modules with soft-float modules. readelf reports the generated tempfile-xx-xx.so.o in kcache is indeed soft float. My whole machine is running on -march=rv64gc -mabi=lp64d.

I have tried specifying CFLAGS="-mabi=lp64d" -DEXTRA_HOST_LLC_FLAGS="-target-abi lp64d -mattr=+d"
and add ss << "-target-abi lp64d -target-feature +d -mattr=+d"; to lib/CL/pocl_llvm_build.cc, but the error is still there.

Do you have any idea how I can get around this issue?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.