Dolphin, the GameCube and Wii emulator - Forums

Full Version: cmakelist changes for opencl on linux
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(12-21-2012, 02:55 AM)Shonumi Wrote: [ -> ]
(12-21-2012, 02:00 AM)algarues Wrote: [ -> ]anyway whether i select or not the opencl option in the video config nothing changes at the level of emulation speed

The OpenCL texture decoder is actually slower than the SSE2 optimized one, or something like that. IIRC, it could run better if someone decided to code it to use a more recent version of OpenCL. You're not really going to see any benefit in using OpenCL right now.

(12-21-2012, 02:00 AM)algarues Wrote: [ -> ]e.g. ztp hack does not change any of the emulation speed in hyrule fields (GC version)

I am trying to understand whether any of this is compilation dependent

That's probably because your system is running Hyrule Field as best as it currently can. Though, that's hard to say for sure, since we can't see what kind of hardware you're running (unless you post it). In any case, the ZTP hack is part of Dolphin's code; as long as you don't remove the related code, it gets compiled.
I compiled Dolphin on ubuntu precise in order to make it use the latest OpenCL libraries installed in the system

briefly:

I installed the opencl headers and cuda toolkit and configured the linker

I then changed CMakeLists.txt this way

Code:
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    find_library(CL OpenCL)
    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-lOpenCL")
else()
    include_directories(Externals/CLRun/include)
    add_subdirectory(Externals/CLRun)
endif()

Then after giving cmake ..
this new line appears in CMakeCache.txt

Code:
//Path to a library.
CL:FILEPATH=/usr/lib/libOpenCL.so

If CMakeLists.txt is left in the default state the line above does not appear.

Then I downloaded opencl-utils from googlecode and compiled clrun which generates libclrun.so, which has to be copied inside the system libraries

from openclutils I also copied clrun.h into /Source/Core/VideoCommon/Src

then Dolphin can be compiled without errors

in the end activating the OpenCL option does not improve a damn thing

However my graphic card is a 8800 GT, so, not the hottest thing in town.

Would a GPU that support sse3 improve things significantly?
algarues Wrote:I compiled Dolphin on ubuntu precise in order to make it use the latest OpenCL libraries installed in the system

That doesn't matter if Dolphin isn't coded to use the latest version. Think like OpenGL. Your GPU can support the latest version of the API, say 4.3, but that's pretty useless if a program is coded to run OpenGL 2.1 code. Note this may not be the best example, since I don't have any experience coding OpenCL, but hopefully it's not too inaccurate :p The files under Source/Core/VideoCommon/Src/OpenCL/ simply aren't designed to take advantage of what the latest OpenCL versions offer.

algarues Wrote:in the end activating the OpenCL option does not improve a damn thing

That's because, as I said before, the OpenCL texture decoder is slower than the default one. It might perform at the same level (enough not to notice the difference anyway), but it's very unlikely to consistently improve performance

algarues Wrote:However my graphic card is a 8800 GT, so, not the hottest thing in town.

There's a high probability that the result is going to be the same even on a higher end GPU. I can confirm that OpenCL in Dolphin, as it currently is, does not visibly improve performance.

algarues Wrote:Would a GPU that support sse3 improve things significantly?

SSE3 is an x86 instruction set, i.e. it's specifically for CPUs. What do you mean by "a GPU that supports SSE3"?
Texture decoding is not a bottleneck in Dolphin anyway. Your CPU is very good at it.
(12-21-2012, 04:31 PM)delroth Wrote: [ -> ]Texture decoding is not a bottleneck in Dolphin anyway. Your CPU is very good at it.
In that case it could be used to address other performance bottlenecks, such as the hyrule field slowdown or whatever you think might be important

paradoxically, since it seems to me that in Dolphin the CPU does a lot of work that in reality the GPU should do (e.g. texture decoding)

opencl could be used in the emulator to have the GPU supporting what would have been heavy CPU calculations on the wii

If the code was changed to make opencl always compilable in Linux, other coders could address the issue
Short answer: no.

Long answer: A GPU can not do everything a CPU can do: it's only faster on very specific, highly parallelizable workloads. In the case of emulation, your GPU can actually do very little more than what Dolphin currently uses them for (vertex/pixel transformations).

Doing texture decoding on the GPU is an idea that makes sense: it's parallelizable pretty easily (cut a texture in 16x16 blocks) and the textures need to be uploaded on the GPU anyway. But when the GPU load is already high, doing texture decoding there will actually make everything slower by adding two context switches at every texture load, which might require a complete pipeline flush.
Pages: 1 2