[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Enabling HIP in Blender Cycles



Hello,

I've been working with Étienne Mollier and others on the Debian AI team to enable ROCm in Debian. I believe it would now be possible to build Blender with HIP support for AMD GPUs using the HIP package in Debian Unstable. The Debian HIP package still has a few rough edges that need cleaning up, but is fully functional. The rocRAND package [1] is an example of a library that is built using HIP.

The CMake options to enable AMD HIP support in Blender [2] are:

-DWITH_CYCLES_HIP_BINARIES=ON
-DCYCLES_HIP_BINARIES_ARCH=gfx1030

There are a few environment variables that are (temporarily) required to compile HIP code using the Debian package.  Étienne and I are working towards eliminating the need for them [3], but they're required for the moment:

export HIP_CLANG_PATH=/usr/bin
export DEVICE_LIB_PATH=/usr/lib/${DEB_HOST_MULTIARCH}/amdgcn/bitcode
export ROCM_PATH=/usr

You will also need to add a few packages to the Build-Depends:

    hipcc
    libamd-comgr-dev
    libhsa-runtime-dev
    rocminfo

I'm not sure what tests there are for GPU functionality in Blender, but my understanding is that the Debian build and test system is not really set up to handle tests that require GPUs anyway. Christian Kastner has expressed interest in tackling that problem, though it sounds like a big job. HIP support would therefore need to be tested manually for the moment. If you don't have compatible hardware to test with, I believe there is going to be a porterbox available.

I'd be happy to answer any questions that folks may have about enabling HIP support in Blender (or other libraries and applications). I'm an AMD GPU libraries engineer and have been writing code in HIP for the past few years. My real job is the development of the ROCm mathlibs, but I'm a fan of both Blender and Debian and I like to help where I can. ROCm has historically been tricky to install and use, so I've made it a bit of a personal mission to try to facilitate its packaging and distribution.

I suppose I should probably file a bug on the blender package for this, but I figured this topic was probably broad enough to be of general interest for the mailing list. I'm still not very familiar with Debian etiquette, so please feel free to correct me if I make any mistakes. I'm still learning about the way you folks work.

Sincerely,
Cordell Bloor

[1]: https://salsa.debian.org/rocm-team/rocrand
[2]: gfx1030 is the ISA for Navi 21. You may want to expand that architecture list for the final package, but the initial building and testing of the package will be faster with a single architecture.
[3]: https://salsa.debian.org/rocm-team/rocm-hipamd/-/merge_requests/1


Reply to: