Skip to content

Linking julia to Graphcore's LLVM #13

@giordano

Description

@giordano

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code generationRelated to GPUCompiler code generation infrastructure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions