Contribute
Register

Editing AGPM to prevent GTX4XX Freeze

Status
Not open for further replies.
Joined
Dec 13, 2010
Messages
140
Motherboard
P67A-UD4-B3
CPU
4.2GHZ 2500K
Graphics
GTX 460 @ 800MHZ
Mac
  1. MacBook Pro
Classic Mac
  1. 0
Mobile Phone
  1. Android
  2. iOS
I'm refraining from posting ready-made AGPM edits as it seems that they don't necessarily work for everyone. If you are comfortable editing the Kext yourself, follow the instructions below. If not, feel free to post your VANILLA AGPM.kext and I will apply the edits for the system model you want. You cannot use MacPro3,1 as the kext will not load.

UPDATED 6/12/12 - for those still experiencing crashes with AGPM edits, download the CUDA app below.

Editing AGPM.kext
Code you need to add to your AppleGraphicsPowerManagement.kext if you are using MacPro 4,x or MacPro 5,x

Code:
			<key>MacProX,X</key>
			<dict>
				<key>Vendor10deDevice0e22</key>
				<dict>
					<key>Heuristic</key>
					<dict>
						<key>ID</key>
						<integer>0</integer>
						<key>IdleInterval</key>
						<integer>500</integer>
						<key>SensorOption</key>
						<integer>1</integer>
						<key>TargetCount</key>
						<integer>5</integer>
						<key>Threshold_High</key>
						<array>
							<integer>70</integer>
							<integer>95</integer>
							<integer>110</integer>
							<integer>190</integer>
						</array>
						<key>Threshold_Low</key>
						<array>
							<integer>0</integer>
							<integer>60</integer>
							<integer>90</integer>
							<integer>190</integer>
						</array>
					</dict>
					<key>control-id</key>
					<integer>17</integer>
					<key>LogControl</key>
					<integer>1</integer>
				</dict>
				<key>default-control-id</key>
				<integer>17</integer>
				<key>LogControl</key>
				<integer>1</integer>
			</dict>

Code if you are on a Sandy Bridge system, have installed the iMac/MacBookPro 10.6.7 update and have an identifier of MacBookPro 8,x or iMac12,x

Code:
			<key>iMac or MacBookPro</key>
			<dict>
				<key>Vendor10deDevice0e22</key>
				<dict>
					<key>BoostPState</key>
					<array>
						<integer>0</integer>
						<integer>1</integer>
						<integer>2</integer>
						<integer>3</integer>
					</array>
					<key>BoostTime</key>
					<array>
						<integer>3</integer>
						<integer>3</integer>
						<integer>3</integer>
						<integer>0</integer>
					</array>
					<key>Heuristic</key>
					<dict>
						<key>ID</key>
						<integer>0</integer>
						<key>IdleInterval</key>
						<integer>500</integer>
						<key>SensorOption</key>
						<integer>1</integer>
						<key>TargetCount</key>
						<integer>5</integer>
						<key>Threshold_High</key>
						<array>
							<integer>70</integer>
							<integer>95</integer>
							<integer>110</integer>
							<integer>190</integer>
						</array>
						<key>Threshold_Low</key>
						<array>
							<integer>0</integer>
							<integer>60</integer>
							<integer>90</integer>
							<integer>190</integer>
						</array>
					</dict>
					<key>control-id</key>
					<integer>17</integer>
					<key>LogControl</key>
					<integer>1</integer>
				</dict>
				<key>default-control-id</key>
				<integer>17</integer>
				<key>LogControl</key>
				<integer>1</integer>
			</dict>

Now let's break down what you need to edit for your system -

Vendor 10de = Nvidia
Device 0dc4 = GTX450
Device 0e22 = GTX460
Device 0e23 = GTX460 SE
Device 06cd = GTX470

BoostPState, Threshold_Low and Threshold_High work in tandem to clock your card depending on usage on iMacs and MBPs. On Mac Pros, only Threshold_Low and Threshold_High are used.

The higher the BoostPState, the more power saving you're entering. The assumption we're all working on is that the highest PState (3) is to be avoided since that's causing the kernel panics we're seeing. As such I made the Threshold for reaching state 3 impossible to get to (by making the integer 190). Threshold_Low and Threshold_High appear to define the idle range when switching happens, so if the card is between 90-110% idle, it'll switch to state 2 (I kept it at 110 purposefully just in case to make sure that state 3 is never invoked even when perfectly idle), 60-95 idle and it'll switch to state 1, etc. There's overlap, but that appears in quite a few entries as well.

I increased the idle interval to prevent the card from switching rapidly between states every few seconds and flooding the console. This is done in the assumption that frequent switching to the low power state could also trigger a crash.

Enabling LogControl will mark in the console whenever the card switches states. Feel free to disable this (replace 1 with 0) once you feel confident that the numbers work for you sticks.

Also - don't be afraid to adjust the numbers to how you want them! If you think you're switching too often between state 1 and state 2, increase or decrease the respective spread between Threshold_Low and High for each state. While these numbers work best for my system, they may not be optimal for yours.

Installing the Kext
You can use Kext Utility from Multibeast or Kext Wizard to install AGPM.kext into your S/L/E, then reboot your system. To check to see if AGPM is loading correctly, go to your Console and make sure you're viewing All Messages (upper left). In the filter box type in 'AGPM.' If you are loading everything correctly, you should see the following -

Screen shot 2011-05-22 at 4.00.59 AM.png

The first line shows that the kext is initialized for your system, the remaining shows your card switching through the various states. If you see something else, you probably edited the kext wrong. Post a message in this forum and we'll try to help you get things working!

Results
So far the card boots into state 3, but will quickly jump to state 2 after a few seconds. I've tweaked these values for hours to make sure that the system will gracefully jump to state 0 and state 1 as needed. Watch a Youtube or Giantbomb video and you'll see in your Console (filter out for AGPM) that the videocard will jump to state 1 or 0. Launch iTunes and run the visualizer - same thing. Close all activity and the card will eventually settle back to state 2.

You should never see your card hit state 3, where many of us believe the infamous kernel panics/freezes happen.

Several caveats - i'm not a Mac gamer. I boot back to Windows to play my (somewhat) extensive Steam collection. I already own a MBP and use this hack for web browsing, iTunes and occasional After Effects renders for work. In the three days I've tested these settings I've yet to get a kernel panic from the graphics card, regardless of load. While these settings could theoretically affect your FPS in games, I'm still managing 39FPS in Cinebench. Your Mileage May Vary, of course.

**If you are still experiencing crashing after editing AGPM, you will need to download the following program -

CUDA-Test.zip

Launch it at start up, move the slider to have between 80-300 triangles, and you can hide the app once you have another application loaded with Command-H. I've edited this app to not appear in your dock, so once it is hidden you can only quit it through the Activity Monitor. You will need to install Nvidia's CUDA drivers in order for this application to work. This is a new version of an old trick, except it takes a lot fewer resources and, once hidden, is out of sight, out of mind.

file.php


This can also depend on editing your GTX460 BIOS to increase the voltage and timings in the lower states in order to ensure that the card isn't jumping too much in either at the lowest levels. i believe the lowest state is something like 50mhz/100mhz, which i increased to 300/300 @ .9V.

EDIT: 5/24 to make this post more general.
 

Attachments

  • Screen shot 2011-05-22 at 4.00.59 AM.png
    Screen shot 2011-05-22 at 4.00.59 AM.png
    39.5 KB · Views: 5,613
  • CUDA-Test.zip
    39.3 KB · Views: 271
Last edited by a moderator:
Re: Editing AGPM to prevent Fermi Freeze

Scorcho,

I'd love to try this with you. I've opened up info.plist for the AGPM kext, it will not let me save with the edits you've posted. ..."because the text is not a valid property list." Any suggestions??

If you want to send over your AGPM.kext I can try that as well.
 
Re: Editing AGPM to prevent Fermi Freeze

darkstargtk said:
Scorcho,

I'd love to try this with you. I've opened up info.plist for the AGPM kext, it will not let me save with the edits you've posted. ..."because the text is not a valid property list." Any suggestions??

If you want to send over your AGPM.kext I can try that as well.
Sure! Here it is. Make sure you're either using Kext Helper (from Multibeast) to install the kext, or if you're putting it manually into S/L/E, to repair permissions!

edit: kext moved to the first post.
 
Re: Editing AGPM to prevent Fermi Freeze

Thanks for the Kext - Booted fine, I'll keep you updated on any freezes / KP!
 
Re: Editing AGPM to prevent Fermi Freeze

darkstargtk said:
Thanks for the Kext - Booted fine, I'll keep you updated on any freezes / KP!
can you confirm whether you are seeing AGPM messages in the console? and whether it switched from the boot state of 3 to 1 or 2?

I just made an edit in the Thresholds to prevent the card from switching too often between 1 and 2 when idle. Seems to be working.
 
Re: Editing AGPM to prevent Fermi Freeze

scorcho said:
darkstargtk said:
Thanks for the Kext - Booted fine, I'll keep you updated on any freezes / KP!
can you confirm whether you are seeing AGPM messages in the console? and whether it switched from the boot state of 3 to 1 or 2?

I just made an edit in the Thresholds to prevent the card from switching too often between 1 and 2 when idle. Seems to be working.

I'm in the console viewer - I do not see any AGPM messages. Do I need to navigate to a certain log? I tried launching VLC, still didn't see any messages.
 
Re: Editing AGPM to prevent Fermi Freeze

darkstargtk said:
I'm in the console viewer - I do not see any AGPM messages. Do I need to navigate to a certain log? I tried launching VLC, still didn't see any messages.
go to the Console and click on All Messages on the upper left. then go to the filter on the right and type in AGPM. You should see messages like in the image I posted above.

'AGPM: GPU = display Initialized, Control ID 17' means that AGPM is active. The rest indicate the state switches.

Is your system identifying as an iMac12,1 in System Profiler?
 
Re: Editing AGPM to prevent Fermi Freeze

scorcho said:
darkstargtk said:
I'm in the console viewer - I do not see any AGPM messages. Do I need to navigate to a certain log? I tried launching VLC, still didn't see any messages.
go to the Console and click on All Messages on the upper left. then go to the filter on the right and type in AGPM. You should see messages like in the image I posted above.

'AGPM: GPU = display Initialized, Control ID 17' means that AGPM is active. The rest indicate the state switches.

Is your system identifying as an iMac12,1 in System Profiler?

I believe I'm in the right place - Take a look at the screenshots.
 

Attachments

  • Screen shot 2011-05-22 at 10.31.01 AM.png
    Screen shot 2011-05-22 at 10.31.01 AM.png
    109.1 KB · Views: 5,614
  • Screen shot 2011-05-22 at 10.31.18 AM.png
    Screen shot 2011-05-22 at 10.31.18 AM.png
    69 KB · Views: 5,575
Re: Editing AGPM to prevent Fermi Freeze

can you type in ACPI into the filter and take a picture? how did you install the kext?
 
Re: Editing AGPM to prevent Fermi Freeze

I installed the kext by dropping in /S/L/E and the repairing permissions on the kext folder
 

Attachments

  • Screen shot 2011-05-22 at 10.37.44 AM.png
    Screen shot 2011-05-22 at 10.37.44 AM.png
    124.4 KB · Views: 5,566
Status
Not open for further replies.
Back
Top