Jump to content

OpenCL fix for non-GF100/GF110 cards (aka CC/SM 2.1+)


cmf
 Share

138 posts in this topic

Recommended Posts

  • 2 months later...

this fix is again valid for the stock apple drivers from 10.8.5

backup original, and in Terminal type:

 

sudo perl -pi -e '$c+=s/\x8b\x81\x1c\x0c\x00\x00\xeb\x06\x8b\x81\x20\x0c\x00\x00/\xb8\x02\x00\x00\x00\x90\xeb\x06\xb8\x00\x00\x00\x00\x90/; END { printf "%s: %d substitution%s made.\n",($c==1 ? "Success" : "Error"),$c,(!$c || $c>1 ? "s" : ""); $?=($c!=1); }' /System/Library/Extensions/GeForceGLDriver.bundle/Contents/MacOS/libclh.dylib

reboot not necessary

 

:smoke:

  • Like 1
Link to comment
Share on other sites

This entire thread is for non-Fermi cards, no?  I thought GF is Fermi and GK is Keplar.  And the thread title says "non-GF100/GF110 cards".

sorry...brain-freeze here...try this slightly modified script in terminal

sudo perl -pi -e '$c+=s/\x8b\x81\x1c\x0c\x00\x00\xeb\x06\x8b\x81\x20\x0c\x00\x00/\xb8\x03\x00\x00\x00\x90\xeb\x06\xb8\x00\x00\x00\x00\x90/; END { printf "%s: %d substitution%s made.\n",($c==1 ? "Success" : "Error"),$c,(!$c || $c>1 ? "s" : ""); $?=($c!=1); }' /System/Library/Extensions/GeForceGLDriver.bundle/Contents/MacOS/libclh.dylib

if any of the gtx titan / gk110 folks reads this, please test(sets it to CC3.0 which is used for gk104 devices)

Link to comment
Share on other sites

http://www.insanelymac.com/forum/user/42821-cmf/ posted:

it's basically the same as the GeForceGLDriver binary patch, but at the user level (and w/o modifying the binary, obviously).
i.e. if the binary patch isn't applied, opencl will only function if "CL_ENABLE_SM2_DEVICE" is defined/set in the users environment vars (default set can be changed through the .profile file).
so, if apple ever decides to add an additional "is device opencl capable?" check or shuffle the code around, so that the binary patch doesn't work any more (which i'm surprised it did in 10.7.3), opencl should still work (to some extent*) using the "CL_ENABLE_SM2_DEVICE" define.

downside and (*): this really only works if a program is started by the user and the program doesn't ignore/overwrite the cl define or does some other weird stuff (like luxmark does ...). some system services/programs that use opencl and are started by another user also won't be able to use the opencl device (just open activity monitor and look which processes aren't owned by your user).


and ftr and the people that are interested:
the GeForceGLDriver binary patch changes the "cmp eax, 2" to a "cmp eax, 3" (note: eax at this point contains the major version of the nvidia compute capability (cc/sm), which is 2 for fermi gpus), so the subsequent jump condition will evaluate to true (instead of false, b/c 2 is not less than 2, but 2 < 3!) and continue @loc_8F014446. if the binary patch has not been applied (it still says "cmp eax, 2"), it will continue and check if "CL_ENABLE_SM2_DEVICE" is defined in the users env vars. if so, it will also continue @loc_8F014446. if not, the device will be "destroyed" and be "declared" not opencl capable.
post-42821-0-80167800-1329226199_thumb.p

  • Like 1
Link to comment
Share on other sites

Sorry, this is all new to me, so I don't really understand.  After running the sudo perl command and the echo "export CL_ENABLE_SM2_DEVICE=1" >> ~/.profile commands, here is the output I get when I run oclinfo.  Seems like it says OpenCL is supported, but nothing with OpenCL works.  I've tried Promiere Pro CC, LuxMark, OpenCL Oceanwave, and the new beta builds for RedCine-X Pro, and none of them will work.

 

1 OpenCL platform found!

 
[Platform 0]
Name: Apple
Vendor: Apple
Version: OpenCL 1.2 (Apr 25 2013 18:32:06)
Profile: FULL_PROFILE
Extensions: cl_APPLE_SetMemObjectDestructor cl_APPLE_ContextLoggingFunctions cl_APPLE_clut cl_APPLE_query_kernel_names cl_APPLE_gl_sharing cl_khr_gl_event
 
 
[OpenCL-only Context]
2 OpenCL devices found!
 
[Device 0]
Name: Intel® Core i7-3770K CPU @ 3.50GHz
Vendor: Intel
Type: CPU 
Device Version: OpenCL 1.2 
Driver Version: 1.1
Compute Units: 8
Work Group Size: 1024
Clock: 3500 MHz
Global Memory (Total): 32768 MB
Global Memory (Host): 32768 MB
Global Memory (PCIe): 0 MB
Local Memory: 32 KB
Cache Size: 0.0625 KB
Cache Line Size: 8388608 Bytes
Available: Yes
Double-Precision: Yes
Extensions: 
cl_APPLE_SetMemObjectDestructor
cl_APPLE_ContextLoggingFunctions
cl_APPLE_clut
cl_APPLE_query_kernel_names
cl_APPLE_gl_sharing
cl_khr_gl_event
cl_khr_fp64
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_khr_byte_addressable_store
cl_khr_int64_base_atomics
cl_khr_int64_extended_atomics
cl_khr_3d_image_writes
cl_APPLE_fp64_basic_ops
cl_APPLE_fixed_alpha_channel_orders
cl_APPLE_biased_fixed_point_image_formats
 
[Device 1]
Name: GeForce GTX TITAN
Vendor: NVIDIA
Type: GPU 
Device Version: OpenCL 1.1 
Driver Version: 8.16.74 310.40.00.10f02
Compute Units: 14
Work Group Size: 1024
Clock: 928 MHz
Global Memory: 6144 MB
Local Memory: 48 KB
Cache Size: 0 KB
Cache Line Size: 0 Bytes
Available: Yes
Double-Precision: Yes
Extensions: 
cl_APPLE_SetMemObjectDestructor
cl_APPLE_ContextLoggingFunctions
cl_APPLE_clut
cl_APPLE_query_kernel_names
cl_APPLE_gl_sharing
cl_khr_gl_event
cl_khr_byte_addressable_store
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_APPLE_fp64_basic_ops
cl_khr_fp64
cl_khr_3d_image_writes
 
[shared OpenCL+OpenGL Context]
2 OpenCL devices found!
 
[Device 0]
Name: GeForce GTX TITAN
Vendor: NVIDIA
Type: GPU 
Device Version: OpenCL 1.1 
Driver Version: 8.16.74 310.40.00.10f02
Compute Units: 14
Work Group Size: 1024
Clock: 928 MHz
Global Memory: 6144 MB
Local Memory: 48 KB
Cache Size: 0 KB
Cache Line Size: 0 Bytes
Available: Yes
Double-Precision: Yes
Extensions: 
cl_APPLE_SetMemObjectDestructor
cl_APPLE_ContextLoggingFunctions
cl_APPLE_clut
cl_APPLE_query_kernel_names
cl_APPLE_gl_sharing
cl_khr_gl_event
cl_khr_byte_addressable_store
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_APPLE_fp64_basic_ops
cl_khr_fp64
cl_khr_3d_image_writes
 
[Device 1]
Name: Intel® Core i7-3770K CPU @ 3.50GHz
Vendor: Intel
Type: CPU 
Device Version: OpenCL 1.2 
Driver Version: 1.1
Compute Units: 8
Work Group Size: 1024
Clock: 3500 MHz
Global Memory (Total): 32768 MB
Global Memory (Host): 32768 MB
Global Memory (PCIe): 0 MB
Local Memory: 32 KB
Cache Size: 0.0625 KB
Cache Line Size: 8388608 Bytes
Available: Yes
Double-Precision: Yes
Extensions: 
cl_APPLE_SetMemObjectDestructor
cl_APPLE_ContextLoggingFunctions
cl_APPLE_clut
cl_APPLE_query_kernel_names
cl_APPLE_gl_sharing
cl_khr_gl_event
cl_khr_fp64
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_khr_byte_addressable_store
cl_khr_int64_base_atomics
cl_khr_int64_extended_atomics
cl_khr_3d_image_writes
cl_APPLE_fp64_basic_ops
cl_APPLE_fixed_alpha_channel_orders
cl_APPLE_biased_fixed_point_image_formats
 
logout
 
[Process completed]
Link to comment
Share on other sites

This thread applies to fermi cards only, where non-GF100/GF110 means any GF10x/GF11x card where x != 0 ;)

 

For GK110 based cards (Titan and 780), I'd highly recommend updating to 10.9 - I doubt we'll ever see full and proper OpenCL support for these in 10.8.

In 10.9 OpenCL is working OOTB on these cards. And since I haven't mentioned it anywhere yet: 780 OpenCL support has been added in some earlier DP.

  • Like 1
Link to comment
Share on other sites

This thread applies to fermi cards only, where non-GF100/GF110 means any GF10x/GF11x card where x != 0 ;)

 

For GK110 based cards (Titan and 780), I'd highly recommend updating to 10.9 - I doubt we'll ever see full and proper OpenCL support for these in 10.8.

In 10.9 OpenCL is working OOTB on these cards. And since I haven't mentioned it anywhere yet: 780 OpenCL support has been added in some earlier DP.

How do Fermi cards work in 10.9 (450 GTS here)?

Link to comment
Share on other sites

for the new nvidia "Web" drivers (10.8.5)this again works for me
(always backup first) then...in Terminal type:
sudo perl -pi -e '$c+=s/\x8b\x81\x1c\x0c\x00\x00\xeb\x06\x8b\x81\x20\x0c\x00\x00/\xb8\x02\x00\x00\x00\x90\xeb\x06\xb8\x00\x00\x00\x00\x90/; END { printf "%s: %d substitution%s made.\n",($c==1 ? "Success" : "Error"),$c,(!$c || $c>1 ? "s" : ""); $?=($c!=1); }' /System/Library/Extensions/GeForceGLDriverWeb.bundle/Contents/MacOS/libclh.dylib
:smoke:

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

for me I have strange thing ... in 10.9 560ti is working out of the box but Benchmarking are really low when I compared them to the 10.8.5 benchmark...

I also fix my freezing problem (FERMI FREEZE)

 

 

/EDIT

 

Nope, FREEZE Came back ... it is just less redundant

Link to comment
Share on other sites

Also on 10.9 now. Haven't got a freeze yet (EVGA GeForce 450 GTS 1GB), hope it stays this way. :)

 

What I do find strange is that OS X never is clocking down my GPU anymore. This is because of the new nVidia drivers that where also on 10.8.3>

 

I already added my card to AGPM.kext (see my post), GUI is smooth. But again no clocking-down = high power usage

Link to comment
Share on other sites

  • 2 weeks later...

Yewwo :)

 

I'm stuck in the same boat as many others here - I have an EVGA GTX 780 w/ ACX Cooler and the fixes here aren't working in the retail 10.9 drivers. It seems that the 10.9 drivers are a regression and are actually older than the stock 10.8.5 drivers, yet somehow modified with GK110 code. The DP versions of Mavericks seem to have worked for people here, but the release version has regressions and none of the fixes here work.

 

Has anybody gotten 780 cards working in Mavericks w/ OpenCL? There is a lot more that uses OpenCL now, especially Preview when viewing anything other than text/pdf, and having the apps just crash outright because of OpenCL (or Apple's pathetic implementation of it) is a total productivity killer.

 

Any help would be greatly appreciated. :)

Link to comment
Share on other sites

Yewwo :)

 

I'm stuck in the same boat as many others here - I have an EVGA GTX 780 w/ ACX Cooler and the fixes here aren't working in the retail 10.9 drivers. It seems that the 10.9 drivers are a regression and are actually older than the stock 10.8.5 drivers, yet somehow modified with GK110 code. The DP versions of Mavericks seem to have worked for people here, but the release version has regressions and none of the fixes here work.

 

Has anybody gotten 780 cards working in Mavericks w/ OpenCL? There is a lot more that uses OpenCL now, especially Preview when viewing anything other than text/pdf, and having the apps just crash outright because of OpenCL (or Apple's pathetic implementation of it) is a total productivity killer.

 

Any help would be greatly appreciated. :)

This fix was never meant for any GK1xx cards and might even result in problems, because sm_2x (fermi) != sm_3x (kepler). Although the compiled binaries should generally be upwards compatible, there might be other things that get messed up because of the different sm version.

 

That being said, this fix isn't even necessary any more in 10.9 (even for sm_21 cards) as I've already written in the first post (the compiler in 10.9 can properly produce and handle up to sm_35 code now - thats GK110).

 

Concerning the GTX 780: I have no issues besides the general OpenGL slowness of the driver (really hoping for R330 drivers in 10.9.1 or 10.9.2 soon ...). On the other hand, OpenCL is actually pretty fast and you probably won't see any performance increases in future drivers as it is already at the max - at least for well written programs. It scales pretty much perfectly for my code (6x over a GT650M).

So, I don't know what you did wrong, but it should just work OOTB in 10.9.

Link to comment
Share on other sites

Unfortunately even a vanilla install with only FakeSMC.kext and HWSensors installed results in OpenCL crashing immediately on any app that uses it. Boot to safe mode and OpenCL based apps don't crash anymore. And since the only driver that is disabled in Safe Mode for the nVidia GPUs is GeForce.kext, that puts the onus squarely on Apple's driver. Unfortunately without that driver loaded I get no acceleration either and the entire UI is choppy to say the least.

 

Mavericks' drivers are older than ML 10.8.5's stock drivers. Why the DP versions of Mavericks had awesome drivers and the release got drivers that are a year old is what's making me scratch my head.

Link to comment
Share on other sites

are you sure you installed mavericks correctly? maybe some installer utility you used messed something up?

driver version should be 8.18.22 (apple version) and/or 310.40.05f01 (nvidia version) - better check all GeForce* and NVDA* kexts.

thats exactly the same driver that was already used in DP7, DP8 and the first GM.

Link to comment
Share on other sites

The driver version is exactly what you posted. Even booting from a Clover install on my USB drive causes this. My system profile is that of a Mac Pro 3,1. But even an iMac 14,2 has the same problem (and has issues of its own). Everything works except OpenCL. Any app that calls OpenCL crashes instantly the moment it does so. Preview.app, Pacifist, Cornerstone SVN, and LuxMark are among those apps. Preview crashes when attempting to view graphics files. Even QuickLook instantly crashes on graphics files.

 

I'm still trying to find out why this happens. It occurs both in 10.8.5 (including supplemental update 1.0) and in Mavericks. Only OpenCL causes the crashes. Other GTX 780 cards seem to work, but those are all cards released before the one I have. Now I didn't expect 10.8.5 to have real OpenCL support, but the crashes are a real problem.

Link to comment
Share on other sites

 Share

×
×
  • Create New...