vosen / ZLUDA

CUDA on ??? GPUs
Apache License 2.0
8.98k stars 599 forks source link

ZLUDA won't work with higher version of Blender 4.0+ (Blender 4.2 Alpha tested) #146

Open gioxyer opened 7 months ago

gioxyer commented 7 months ago

When testing ZLUDA on Blender 4.2 Alpha it doesn't work, version tested Blender 4.2.0 [cfb60c98be7d], as main error display on viewport appear "Failed to configure CUDA context (Invalid context)".

Recognise correctly ZLUDA in render engine Screenshot (690)

Error "Failed to configure CUDA context (Invalid context)" in viewport Screenshot (691)

Error "Failed to configure CUDA context (Invalid context)" in final render Screenshot (692)

Display CMD main error Screenshot (693)

Main error: Invalid context in cuStreamCreate(&cudastream, CU_STREAM_NON_BLOCKING) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\queue.cpp:21) Invalid context in cuCtxPopCurrent(NULL) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:19) Invalid value in cuCtxPushCurrent(device->cuContext) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:14) Invalid context in cuCtxPopCurrent(NULL) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:19) Invalid context in cuDevicePrimaryCtxRelease(cuDevice) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\device_impl.cpp:139) Failed to configure CUDA context (Invalid context)

Refer to the Cycles GPU rendering documentation for possible solutions: https://docs.blender.org/manual/en/latest/render/cycles/gpu_rendering.html

Invalid value in cuCtxPushCurrent(device->cuContext) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:14) Invalid context in cuStreamCreate(&cudastream, CU_STREAM_NON_BLOCKING) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\queue.cpp:21) Invalid context in cuCtxPopCurrent(NULL) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:19) Invalid value in cuCtxPushCurrent(device->cuContext) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:14) Invalid context in cuCtxPopCurrent(NULL) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:19) Invalid context in cuDevicePrimaryCtxRelease(cuDevice) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\device_impl.cpp:139) Error: Failed to configure CUDA context (Invalid context)

chocolatewafer commented 6 months ago

some issues with the alpha build maybe? Blender 4.0 works fine for me with a RX 560X card.

gioxyer commented 6 months ago

With Blender 4.0 I didn't have any issue too, but if you try Blender 4.1 Release Candidate or Blender 4.2 Alpha seems that check if there is cuda cores inside Blender (cuCtxPushCurrent, cuStreamCreate, cuCtxPushCurrent, cuCtxPopCurrent)

vosen commented 6 months ago

Should be fixed as of the latest version

gioxyer commented 6 months ago

Hi, I tried to download the updated version, it show this main error, as version tested 35c6c11c7edf

Screenshot (784)

Error: OsError { function: "DetourCreateProcessWithDllsW", error_code: 14001, message: "Unable to start the specified application. The application's side-by-side mode configuration is incorrect. Please consult the application event log or use the command-line tool sxstrace.exe to get more information." }

vosen commented 6 months ago

What happens if you start blender.exe normally? What happens if you check "Unblock" in blender.exe properties and try to run with ZLUDA? Windows tends to block unknown freshly-download .exe and this might be the case here

gioxyer commented 6 months ago

You're right, seems windows blocking, I will try unzip again the file and then I will need proably to open blender.exe before zluda.

It says Unable to execute the App on your pc Screenshot 2024-03-28 185150

gioxyer commented 6 months ago

Now it open correctly, but seems give similar error, probably lower than before Screenshot (786)

Invalid value in cuCtxPushCurrent(device->cuContext) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:14) Invalid context in cuStreamCreate(&cudastream, CU_STREAM_NON_BLOCKING) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\queue.cpp:21) Invalid context in cuCtxPopCurrent(NULL) (C:\Users\blender\git\blender-vdev\blender.git\intern\cycles\device\cuda\util.cpp:19)

vosen commented 6 months ago

Did you build from source? If so what revision (shuld be 067c923408e962260bc4cfbf9374b3f75ca939ff)? The release binaries are for an older version. I'm asking because I'm getting the same error when using previous git revision, but it works fine here with the newest one

gioxyer commented 6 months ago

I just use this version 067c923, but I add zluda.exe, because I didn't find in zluda folder with files used before, probably it could create conflict? image

Screenshot (789)

Screenshot (790)

vosen commented 6 months ago

This won't work, one needs to build from source (and sorry, it should be 7d4147c8b2cc31422a73f5db3ec065db8af82246, though it's identical to 067c923). If it's not urgent maybe wait a bit? I'll add an automatic build on each commit, so you will be able to download ready-to-use prerelease package. I did not foresee so much interest in the work-in-progress versions

gioxyer commented 6 months ago

No problem, I can safely wait. It was interesting to try some features of Blender 4.2, anyway in general zluda I must say is improving a lot, I also tried some fork versions of lshqqytiger, you are doing a great job. I had made a video about it and I must say there is a fair amount of interest in general, for the versions though Blender official and with other software always on 3d.

BaalNetbek commented 6 months ago

I compiled the latest version and it's working with 4.1. You can try yourself. zluda-3-windows_7d4147c.zip

gioxyer commented 6 months ago

It works now with both version Blender 4.1 and Blender 4.2 Alpha, thank you so much for your help

Screenshot (791)

Screenshot (792)