IPUToolkit.jl icon indicating copy to clipboard operation
IPUToolkit.jl copied to clipboard

Linking julia to Graphcore's LLVM

Open giordano opened this issue 1 year ago • 6 comments

Graphcore recently open-sourced their LLVM backend. This hasn't been upstreamed yet, but we can try to link julia to a libllvm built supporting the Colossus target. In this ticket I'll collect the steps I'm following to try and build Julia with Graphcore's LLVM.

Note: graphcore's LLVM fork currently is built on top of LLVM 15, which means we have to use it with current (as of 2023-06-12) Julia's master branch, what will become Julia v1.10 in the next few months. Following instructions are updated as of today, if you attempt to replicate this in the future, you may have to do something else.


Clone Julia's repository

git clone https://github.com/JuliaLang/julia
cd julia

Inside this directory create a file called Make.user with the following content

# -*- makefile -*-

USE_BINARYBUILDER_LLVM = 0
DEPS_GIT = llvm
LLVM_GIT_URL = https://github.com/graphcore/llvm-project-fork
LLVM_BRANCH = standalone_rel_15_x
LLVM_SHA1 = $(LLVM_BRANCH)
LLVM_TARGETS = host;NVPTX;AMDGPU;WebAssembly;BPF;AVR;Colossus
# Apply Julia's patches to LLVM
LLVM_APPLY_JULIA_PATCHES = 1
# Clang is currently needed by Graphcore's LLVM, otherwise we don't really need it
BUILD_LLVM_CLANG = 1
# For faster re-compilation in case something fails, it requires `ccache` in `PATH`
USECCACHE = 1

Then run the build with

make -j24

replacing 24 with an appropriate number of parallel jobs you want to use on your machine.

giordano avatar Jun 12 '23 18:06 giordano