Skip to content

Testing ​

To ensure that everything is working you can run tests for the package with:

julia
pkg> test AMDGPU

Advanced testing options ​

AMDGPU tests use ParallelTestRunner.jl which allow for running tests with various (command line) options and on multiple runners in parallel.

To, e.g., launch a subset of tests core and kernelabstractions on 4 runners in parallel:

julia
julia> using Pkg

julia> Pkg.test("AMDGPU"; test_args=`--jobs=4 core kernelabstractions`)

The full list of tests to run can be obtained with --list argument:

julia
julia> Pkg.test("AMDGPU"; test_args=`--list`)

Testing categories ​

Although tests can be run in a custom fashion upon exploring the output of listing (using the --list test argument), tests are organised such that grouping by relevant categories is possible:

core device hip external gpuarrays kernelabstractions wmma enzyme

which allows to, e.g., run all gpuarrays related tests as:

julia
julia> Pkg.test("AMDGPU"; test_args=`gpuarrays`)

Large memory tests

Some tests such as HIP and GPUArrays tests may use > 20GB of host RAM. It is recommended to use fewer workers (<= 4) on machines that have < 32Gb of host RAM in case running tests would result in out of memory errors.

Building the documentation ​

The documentation is built with Documenter.jl and DocumenterVitepress.jl. To build it locally:

julia --project=docs -e 'using Pkg; Pkg.instantiate()'
julia --project=docs docs/make.jl
julia --project=docs -e 'using LiveServer; serve(dir="docs/build/1")'

The last command serves the built site locally; open the printed URL in a browser.

Doctests need a GPU

make.jl runs with doctest=true, so every block opening with

```jldoctest

is executed on a real device. Building the docs therefore requires a functional AMD GPU, and a clean build means all examples still produce their documented output. When writing examples, prefer showing Array(x) rather than a raw ROCArray so the output does not depend on internal buffer types.

Continuous integration ​

Pull requests are tested on Buildkite, and by external CI providers. The step selection below applies to Buildkite only.

Pull requests ​

To save CI time on the shared GPU runners, pull requests are only tested on the oldest and the newest supported Julia release, plus one release with a local ROCm installation instead of the artifacts. An intermediate release, the upcoming release and nightly are tested on branch builds (e.g. after merging), or can be requested explicitly with [only julia] or [only nightly] (see below).

Draft pull requests ​

Draft pull requests are only tested on the newest Julia release. The other steps (the oldest Julia release, the local ROCm installation, Enzyme, the GPU-less environment, the documentation and the benchmarks) run once the pull request is marked ready for review.

Marking a pull request ready does not start a build

Buildkite does not start a new build when a draft is marked ready for review. Push a new commit afterwards to run the remaining steps, otherwise the pull request can show a green status with only the newest release tested. An empty commit is enough:

git commit --allow-empty -m "Run full CI"
git push

Selecting steps ​

Tags in the message of the most recently pushed commit select which steps run: [only X] runs only the listed steps, and [skip X] skips them, where X is a comma-separated list of:

TagSteps
testsall tests, i.e. julia, nightly, enzyme and special
juliatests on Julia releases and the upcoming release
nightlytests on Julia nightly
enzymeEnzyme tests
specialtests in a GPU-less environment
docsdocumentation build
benchmarksbenchmarks

For example, [only nightly] runs only the nightly tests, and [skip enzyme, docs] runs everything but Enzyme and the documentation. Selecting steps with [only X] also lifts the draft restriction, so [only tests, docs] tests a draft pull request like a ready one, minus the benchmarks.

The build that starts when a pull request is opened reads the tags from the pull request title, not from the commit message. Builds for later pushes read them from the pushed commit.

Tags are matched anywhere in the message, so quoting one, e.g. when describing a CI change, applies it too. Squash and merge commits on main carry the pull request title, and a squash commit also lists the titles of the commits it combines, so a tag in any of these also applies to the build on main, and to the build of a release tagged on that commit. Remove such tags from the commit message when merging. GPUCompiler.jl uses the same tags.

Releasing ​

AMDGPU.jl and its subpackages, ROCm_Runtime and ROCm_Runtime_Discovery, are registered separately with Registrator, the subpackages with subdir=<name>. When several are bumped together, register the subpackages first, and AMDGPU once they are in the General registry. TagBot creates the tags.

AMDGPU.jl is bound to one ROCm minor release of ROCm_Runtime, which uses the newest ROCm release it ships. A pull request that adds a ROCm minor release therefore also raises that bound and bumps the version of AMDGPU.jl, and both packages are registered. For the same reason AMDGPU.jl is bound to one version of AMDGPU_LLVM_Backend_jll, whose version is the LLVM version: a new one is adopted by a pull request that changes that bound, rebuilds of the same version are not held back.