Jump to content

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


  • Please log in to reply
137 replies to this topic

#101
cmf

cmf

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 145 posts

better late than never: *updated first post for 10.8.3+ with the info posted by robertx.


for the people who are interested, the replacement code does this:


movl $2, %eax

nop

jmp 6

movl $0, %eax

nop

so you should be able to set this to a different CC by replacing $MAJOR and $MINOR in this sequence:
B8 $MAJOR 00 00 00 90 EB 06 B8 $MINOR 00 00 00 90


if any of the gtx titan / gk110 folks reads this, please test if this makes opencl work on those devices (sets it to CC3.0 which is used for gk104 devices):
B8 03 00 00 00 90 EB 06 B8 00 00 00 00 90

this does not work!



#102
JahRastaMaN

JahRastaMaN

    InsanelyMac Protégé

  • Members
  • PipPip
  • 92 posts
  • Gender:Male
  • Location:Brasil

I Don't use Web driver. My solution for NVDA Channel Timeout was install Cuda 5.0.59 and freezefix. I have been there five days without NVDA Channel timeout with



#103
ExExibit

ExExibit

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts
  • Gender:Male

Will this patch work on nVidia GTS 250 with 1Gb ram?



#104
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

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:



#105
flmmkr

flmmkr

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

This doesn't work for me.  10.8.5 with a Titan.  Apps using OpenCL just crash.  Won't even start actually.



#106
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

This doesn't work for me.  10.8.5 with a Titan.  Apps using OpenCL just crash.  Won't even start actually.

...i don't believe the Titan is a fermi card...so this fix may not apply... :smoke:



#107
flmmkr

flmmkr

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

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".



#108
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

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)



#109
flmmkr

flmmkr

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

I just tried it and still not working.  When I run OCLInfo it shows OpenCL version, but any apps that use OpenCL either give errors or completely crash out when trying to run them.



#110
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

ok, again i apologize for confusing you...hopefully someone with your card will chime in with a fix or work-around for this issue... :smoke: maybe nvidia retail drivers for 10.8.5 will improve results(when they are released)



#111
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

just on the outside chance...in terminal type: echo "export CL_ENABLE_SM2_DEVICE=1" >> ~/.profile  (i'm not sure whether restart is needed or not) :smoke:



#112
flmmkr

flmmkr

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

No that didn't help.  Is it something I should undo, and how?  I don't even know what it did.



#113
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

http://www.insanelym...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



#114
flmmkr

flmmkr

    InsanelyMac Protégé

  • Members
  • Pip
  • 15 posts

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]


#115
cmf

cmf

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 145 posts

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.



#116
beta992

beta992

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 338 posts
  • Gender:Male

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)?



#117
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

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:



#118
cmf

cmf

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 145 posts

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

just tested my gtx 560 ti in 10.9 DP8 and everything is working ootb.



#119
RobertX

RobertX

    InSanelyMac Maverick

  • Members
  • PipPipPipPipPipPipPip
  • 541 posts
  • Gender:Not Telling

haven't needed this fix ...yet...on mavericks now... :smoke:



#120
bazilato

bazilato

    InsanelyMac Geek

  • Members
  • PipPipPip
  • 104 posts
  • Gender:Male

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







3 user(s) are reading this topic

0 members, 3 guests, 0 anonymous users

© 2014 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Mac Netbook  |   PHP hosting by CatN  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy