Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 882645 - media-gfx/blender-3.3.0: Add Intel "OneAPI" support
Summary: media-gfx/blender-3.3.0: Add Intel "OneAPI" support
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Adrian
Depends on:
Reported: 2022-11-24 07:05 UTC by Cursed Silicon
Modified: 2023-03-05 17:30 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Cursed Silicon 2022-11-24 07:05:22 UTC
Add Intel "OneAPI" support to Blender 3.3 to accelerate rendering using new Intel ARC "Alchemist" graphics cards

Reproducible: Always
Comment 1 Cursed Silicon 2022-11-24 07:07:22 UTC
Blender has stated that the 3.3 "LTS" release supports these new GPU's for both datacenter and consumer "ARC Alchemist" graphics cards

Reading through the build documentation, it looks like this can be added fairly trivially by adding something like "oneapi" as a USE flag and adding the following lines to the configure flags, similar to Nvidia CUDA or AMD ROCM

Comment 2 Sebastian Parborg 2022-11-24 13:06:27 UTC
Do you have any Intel GPUs you can test this with?

I don't personally have any so I can't really test if things are working correctly.
Because of this, I don't really want to add in support for it into the ebuild without having anyone actually test if it works first.
Comment 3 Cursed Silicon 2022-11-24 17:14:56 UTC
I do have an Intel "ARC" A380 GPU. They're about $140 USD online. Happy to test or provide a VM with the card for verifying the feature works

It may end up similar to where there's still pieces of the kernel stack waiting to be implemented in 6.2, but the Blender 3.3 nightly builds seem to offer the feature in the list of Rendering engines
Comment 4 Sebastian Parborg 2022-11-24 17:54:38 UTC
I've talked to one of the Cycles developers.
He is not 100% sure, but he told me that the official build should just work with OneAPI out of the box on intel hardware on linux without needing any extra libraries installed on the system.

For building it is a bit more involved, but should be doable.

I'm unsure if everything we need is in the main portage tree, but we need:
OpenAPI (SyCL), LevelZero, and Ocloc.
Ocloc needs to be pointed to with `OCLOC_INSTALL_DIR`.
I think all of these might be provided by the `dev-libs/intel-compute-runtime` package?

If so, could you try to add the cmake flags and deps to the ebuild and test?

If you compile blender without `WITH_CYCLES_ONEAPI_BINARIES`, then you do not need ocloc as compile time, but it is then needed at run time as Blender will then try to build the cycles kernels on demand.
Comment 5 Cursed Silicon 2022-11-24 18:16:55 UTC
I'll take a swing at it either today or tomorrow (whee, busy thanksgiving! :( )

OCLOC_INSTALL_DIR is something I hadn't seen before and might be the missing piece to get everything together. I did install the dev-libs/intel-compute-runtime and enabled the oneapi method, but in the configuration it spits out 

"oneAPI or Level Zero not found, disabling WITH_CYCLES_DEVICE_ONEAPI"

I'll need to see where it's looking for those components with respect to the compute-runtime

If I can get it working I'll post a basic edited ebuild and any makefile patch if needed. 

May also be worth version bumping it to 3.3.1 as well? That seems to be the current LTS release
Comment 6 Sebastian Parborg 2022-11-24 18:52:58 UTC
I guess it might be missing Sycl.
The error message is from intern/cycles/cmake/external_libs.cmake 

The "find sycl" command runs build_files/cmake/Modules/FindSYCL.cmake and that seems to look for dpcpp.

If you look for `DPCPP` in build_files/build_environment/cmake/versions.cmake, you can see that the official builds seems to get it from (the sycl branch).

The versions.cmake file is what Blender uses to build the libraries for the official builds. So the versions of libraries listed in there is not a hard requirement.

I don't know if sycl is already provided with some other package in gentoo or you might already have it installed and need to modify the "Find" cmake scripts.
Comment 7 Sebastian Parborg 2022-11-24 18:55:24 UTC
And yes, bumping to 3.3.1 would be good as well :)

I haven't had time to get around to that yet, so that is why we are a bit behind.
Comment 8 Sebastian Parborg 2022-12-14 11:07:07 UTC
Did you have any luck?
Comment 9 Cursed Silicon 2022-12-16 18:31:55 UTC
>Did you have any luck?

I've not yet had time to tackle it unfortunately. Holiday period + work and such :( 

I'll try to tackle it either toward the end of the year or early in the new year if I can
Comment 10 Cursed Silicon 2023-01-11 01:42:57 UTC
I took a swing at it for a bit yesterday. Commenting out some old patches was enough to make the latest 3.4.1 Blender release merge and build without issue 

I'm completely out of my depth on getting SyCL/Ocloc/DPC++ configured correctly however. Intel's documentation for all that seems to be scattered marketing and not much else at this time. 

If someone more skilled than I am would like to get the relevant pieces together for testing I'd be happy to provide a VM or something with the Intel ARC card passed through to test with.
Comment 11 Sebastian Parborg 2023-01-11 15:42:02 UTC
What exactly do you have issues with regarding SyCL/Ocloc/DPC++ ?

I'm guessing you get Blender to compile with openapi support, but then it fails during runtime?
Comment 12 Cursed Silicon 2023-01-12 00:16:10 UTC
>What exactly do you have issues with regarding SyCL/Ocloc/DPC++ ?

I could not make heads-or-tails of how Intel expects one to *install* the software. The Github repo for it is not very forthcoming unfortunately

>I'm guessing you get Blender to compile with openapi support, but then it fails during runtime?

I was able to version bump Blender to 3.4 as-is, but was not able to get OneAPI support to enable during the build configuration. 

I assume SyCL/Ocloc/DPC++ needs to be installed into the system and passed to the configuration during build time but I could not find any relevant documentation for getting that software to install correctly. 

Intel does seemingly ship it for Ubuntu LTS 22.04 but does not provide build instructions for other distributions
Comment 13 Sebastian Parborg 2023-01-17 15:54:37 UTC
Do you not get those binaries when building the source code of the llvm fork?

The build instruction seems to be here:

To convert that into an ebuild it seems like you might just have to look at what the python scripts are doing and do the same in the ebuild.
Comment 14 Cursed Silicon 2023-01-20 06:02:15 UTC
I ended up installing the whole Intel oneapi suite into /opt/intel

After that I asked a friend more versed in C++ (and especially cmake) to help me figure out Blender's..."interesting" build system :) 

A whole lot of LD_LIBRARY_PATH-ing later and I eventually got it to *build* with OneAPI enabled, but attempting to render anything just seems to quit without any error messages (and I'm unclear of how to enable debugging via the command line)

I took one final swing at it and attached strace to it only to have it print out a 1MB~ stack trace from that silent quit operation. 

After that point the both of us gave up for now. But we were able to get it to *build* the git version of Blender at least
Comment 15 Andrew Ammerlaan gentoo-dev 2023-03-05 17:30:54 UTC
> I don't know if sycl is already provided with some other package in gentoo or you might already have it installed and need to modify the "Find" cmake scripts.

> I could not make heads-or-tails of how Intel expects one to *install* the software. The Github repo for it is not very forthcoming unfortunately 

Btw, there is a working ebuild for DPC++/SYCL in the ::science repository: dev-lang/DPC++. With the latest version of this and related packages I finally got the whole stack working to the extent where I can actually use dpnp (which is like numpy but on the GPU).

This is *not* ready for ::gentoo though. Adding this to ::gentoo should probably be coordinated with the toolchain project. But from what I understand Intel still intends to upstream this into main llvm/clang, so maybe it is not worth the effort to add the DPC++ ebuild to ::gentoo at this time.

As we speak I am also working on a rpm-wrapper approach over at ::natinst. Basically I have adapted my script there to run on intel's oneapi repository, it is still running though.