Issue compiling one api in blender 4.1 in cycles using VS 2022

We’re using cycles from Blender 4.1 and are having difficulties compiling in VS 2022 for the oneapi device. Specifically, when compiling kernel/oneapi the compat.h file errors on always_inline not being found. We set the language to c++ 20 standard. Is there a special way to compile the oneapi support? I’m looking through the make files and not seeing anything.

I’m running your make file using the 2022 vs version and a few of your files won’t compile.
Image.cpp
C:\work\blender\intern\cycles\scene\image.cpp(651,14): error C2668: ‘ccl::anonymous-namespace'::isfinite': ambiguous c all to overloaded function [C:\work\build_windows_x64_vc17_Release\intern\cycles\scene\cycles_scene.vcxproj] C:\work\blender\intern\cycles\scene\image.cpp(40,6): could be 'bool ccl::anonymous-namespace’::isfinite(uint16_t)’
C:\work\blender\intern\cycles\scene\image.cpp(36,6):
or ‘bool ccl::anonymous-namespace'::isfinite(ccl::half)' C:\work\blender\intern\cycles\scene\image.cpp(32,6): or 'bool ccl::anonymous-namespace’::isfinite(ccl::uchar)’

And

C:\work\blender\intern\cycles\util\profiling.cpp(51,23): error C2672: ‘std::this_thread::sleep_until’: no matching over
loaded function found [C:\work\build_windows_x64_vc17_Release\intern\cycles\util\cycles_util.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\thread(208,10):
could be ‘void std::this_thread::sleep_until(const std::chrono::time_point<_Clock,_Duration> &)’

I can fix these locally but how is this not compiling with your environment?
I have release blender 4.1 up to Commit: b5f8a50c80e44013214a76df8b2886bc903acbfc [b5f8a50]

You’re using a newer compiler (the isfinite issue showed up with 2022 17.11) and c++ standard than the code had encountered around the time of blender 4.1 and running into some issues because of it.

You’re gonna need 92d935a2059e99dd4cbfcf18c14870ee77476ab2 for that isfinite issue

unsure about the sleep_until issue, but given main builds without issues on the latest vs2022 with c++17, (we’re following the VFX platform for the C++ standard) if it is a C++20 issue, we generally accept patches.

Yes I was able to fix the is infinite with a cast to double.

I did run the cmake on blender project and it did bark I had 17.6 so I’m downgrading to 17.5 and see if this helps.

Careful with vs2022, virtually all versions until the last few releases had various codegen issues that broke at-least one of our tests (worst case 40%) or caused build errors, if you want reliability, stick to vs2019

Ok I’ll go to 2019. We’re jumping from 2017 and don’t want to jump again for a while.

the last few 2022 releases are ok, but not with blender code that old so you’ll need to bump that to something newer than 4.1 if you want to go down that path.

I did get the one api code to compile along with kernel.cpp and an linking the lib created with the .so file I created. It calls for the appropriate DLLs like sycl8.dll but when executing available_sycl_devices and specifically sycl::platform::get_platforms(); it crashes since get_platforms seems to resolve to 0x0 address like the DLL was not loaded. I can see the get_platforms function in the sycl8.dll.

Any clues as to what’s going on? Is there an init step I have to do for OneApi? I used icpx to build the .so file. Kind of hard to trace your cmake files.

Sorry, i have no idea what is happening there.

On windows are you using icx or ipcx to compile?

no we use (and ship) dpcpp in our library set for compilation

Ok that maybe the issue.

I’d probably just reset at this point, do a blender build with oneapi support

once you have that going, it be a lot easier to copy what we do on our end.

Yes been trying that as well thanks.

I got my code to compile and run. Turned out I needed to use your DPCPP libs instead of oneapi libs and the clang++.exe compiler.

The integrated IBM cards won’t work with cycles apparently. Do you have a list of compatible ARC cards? Is the Arc A750 compatible. I found articles on older opencl test beds but nothing new. We need a card for testing.

the manual lists all compatible hardware:

Blender 4.4 Manual - GPU Rendering

As i’m not entirely certain if you’re still on the 4.1 codebase, here’s a link to the 4.1 page as well

Blender 4.1 Manual - GPU Rendering

We used the stable 41. code base.

I finally obtained an Arc 750 card for testing. Blender 4.1 (the release we are synced to in april 22 of 2024 2c29fd4e09a4b242b3da67a5644a53324d8c6ff8) does not detect that card but 3.6 blender does as well as the latest 4.4. When you build do you include the binaries?

When we build do we include the binaries? I Don’t quite understand your question, could you rephrase it?

There is an option in the cmake to include binaries for oneapi. Is that checked on?