27 Replies Latest reply on Jan 24, 2010 7:27 AM by avk

    CPUID values' manipulation

    avk
      Is it possible to manipulate the CPUID values returned back to a program?

      I know about MSRs responsible on CPUID.8000_0002..4 (i.e. CPU Name), but I'm rather talking about CPUID.0000_0000..1 and CPUID.8000_0000..1. I suspect that some programs are too relying on these CPUID values, so I need a tool to proof it.
        • CPUID values' manipulation
          randyj.vanderheyden@amd.com

          In general I don't know of any way to manipulate the CPUID results returned by the processor. There is a bit in MSR MSRC001_0015, Hardware Configuration Register (HWCR) which allows you to disable certain SSE instructions (bit 15). I've copied the text from the BIOS and Kernel Developer's Guide below. You can get the guide here: http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/31116.PDF

          15 SseDis: SSE instructions disable. Read-write. 1=Disables SSE instructions. If this is set, then
          CPUID Fn[8000_0001, 0000_0001]_EDX[SSE, SSE2], CPUID Fn0000_0001_ECX[SSE3], and
          CPUID Fn8000_0001_ECX[SSE4A] are 0.

          Regards,

            Randy 

          • CPUID values' manipulation
            avk
            Thank you for the information. But my point is slightly different: to replace, for example, "AuthenticAMD" string with "GenuineIntel". You see, I know several applications that are relying on this string, and I suspect that this quirk is a cause of slowdown of those applications on non-Intel CPUs. All I need is a tool capable of these manipulation. Maybe such a thing possible on some virtual machine?
            • CPUID values' manipulation
              avk
              Well, there are interesting information about changing CPUID: Ars Technica. In brief: a VIA Nano CPU has an ability to change its CPUID.Vendor string, and this ability in the hands of article's author leads to impressive results: PCMark 2005 Memory Score was improved by 47.4%! It's very pity that none of AMD CPUs have mentioned ability (maybe enginering samples have?) - this would be useful to proof that many programs rely of "GenuineIntel" string.
                • CPUID values' manipulation
                  agner

                  I have made similar observations for software compiled with an Intel compiler or using an Intel function library. The software has a CPU dispatcher which chooses the optimal code path depending on which instruction set is supported. Unfortunately, the CPU dispatcher refuses to acknowledge anything in a CPU that doesn't have the "GenuineIntel" identifier. If you have the source code, it is possible to recompile it with the Intel CPU dispatcher replaced. See www.agner.org/optimize/optimizing_cpp.pdf for the details. The result is a dramatic increase in speed on AMD processors for math functions and certain other functions.

                  If the source code is not available, then the only possibility for improving the speed of the Intel-compiled software on an AMD processor is to find the CPU dispatcher inside the binary code and modify it manually, which is quite difficult. However, it is possible to verify that the code looks for the "GenuineIntel" string by searching the binary file for this string. The string is divided into three 32-bit constants with the values "Genu" "ineI" "ntel". Use any search tool to look for each of these string fragments in the .exe and .dll files used.

                • CPUID values' manipulation
                  avk
                  I have already did such an investigation and even more . For example:
                  1) ABBYY Fine Reader 8.0's ScanMan.exe contains the CPU dispatcher which blocks the SSE2 code path (and chooses x87) on CPU with Vendor = "AuthenticAMD" and Base Family = 0Fh, i.e. on K8 & K10!
                  2) Several DivX 6.x versions contain similar CPU dispatcher which blocks SSE's (and chooses MMX) on CPU with Vendor != "GenuineIntel".

                  What unfair play!
                  • CPUID values' manipulation
                    avk
                    Ok, I'll try.
                    • CPUID values' manipulation
                      avk
                      Please, tell me: is it possible to disable 3DNow! & E3DNow! instructions, excluding PREFETCH/W? Some even not so old programs use 3DNow! instead of SSEx (do you know Far Cry and Crysis games?), so K10's performance in those cases is undeservedly suffers. If would be nice feature to enable/disable 3DNow! in the BIOS - several games and multimedia programs will increase their performance. BTW, what about to implement this feature into the new Fusion software utility?
                        • CPUID values' manipulation
                          Tatsumaru

                          found a tool to manipulate the CPUID

                          check this link:

                          http://f0dder.reteam.org/amdp4.htm

                          i think it needs some improvement

                           

                            • CPUID values' manipulation
                              avk

                              Thanks, but my point was slightly different: I'd like to manipulate the CPUID.0000_0000:1 and 8000_0000:1 values. Alas, seems that there is no way to do it .

                                • CPUID values' manipulation
                                  avk

                                  Hey, AMD! Sorry for repeating myself. If you would implement the CPUID.01.Vendor change feature, this would help you to sue Intel about unfair play. Just imagine how simply you would provide the evidence, just by changing the CPUID.Vendor in BIOS from "AuthenticAMD" to "GenuineIntel". VIA already made such a feature, so why didn't you? What are you waiting for?

                                    • CPUID values' manipulation
                                      Brane2

                                       

                                      Originally posted by: avk Hey, AMD! Sorry for repeating myself. If you would implement the CPUID.01.Vendor change feature, this would help you to sue Intel about unfair play. Just imagine how simply you would provide the evidence, just by changing the CPUID.Vendor in BIOS from "AuthenticAMD" to "GenuineIntel". VIA already made such a feature, so why didn't you? What are you waiting for?

                                       

                                       

                                      I have found "AMD Processor Recongition" ( 20734.pdf ) on their site, which seems to describe pretty much what you needed...

                                        • CPUID values' manipulation
                                          Brane2

                                           

                                          I have found "AMD Processor Recongition" ( 20734.pdf ) on their site, which seems to describe pretty much what you needed...

                                           

                                           

                                          C**p, it's for old 32-bit generation chips...

                                            • CPUID values' manipulation
                                              avk

                                              Again and again I will repeat: "Carthage must be destroyed!" I mean: Intel must be catched in its unfair play a.k.a "GenuineIntel" on the software market! Do you know that lots of software contain this CPUID.Vendor check (what about Adobe Creative Suite 1, 2, 3, 4) which is preventing them to use most of SIMD extensions on non-Intel CPUs? Why are you still do nothing against it?

                                              Is that so difficult to implement an allocation of three MSRs like this?:

                                              1st MSR: First eight ASCII symbols of CPUID.Vendor string;

                                              2nd MSR: Last four ASCII symbols of CPUID.Vendor string and one 32-bit value for CPUID.FamilyModelStepping (just to make Family = 06);

                                              3rd MSR: AND-mask for CPUID.8000_0001 to hide AMD-specific features which usually are not present in Intel CPUs (3DNow!, E3DNow!, EMMX, 3DNow! Prefetch, SSE4A, LZCNT, XOP, CVT16, FMA4 etc).

                                              You could allow user to program these MSRs in the BIOS only by reading some sort of disclaimer if you want, but you definitely should implement this feature to let people know that Intel is a fraud. Here, in Europe, you could change people's mind by doing this, not sure about the other world.

                                                • CPUID values' manipulation
                                                  avk

                                                  Two pictures cost thousand words , just look there and there.

                                                    • CPUID values' manipulation
                                                      agner

                                                       

                                                      Originally posted by: avk Two pictures cost thousand words , just look there and there.


                                                      So you are saying that future AMD chips will have a CPUID manipulation feature. Where did you get this from?

                                                        • CPUID values' manipulation
                                                          avk

                                                          agner: Relax, it's just an imitation I've made . I just want to say that AMD should implement such a feature (let's call it "Chameleon") long time ago, say, in 1996, with the K5 release. This feature would be a very simple and efficient way to proof that many programs are too sensitive to CPUID.Vendor string.

                                                          P.S. BTW, It seems that I've made a (small) mistake in the second "Chameleon" feature page: CPUID.0000_0001.Signature.

                                                            • CPUID values' manipulation
                                                              arros123










                                                              Thank you for the information. But my point is slightly different: to replace, for example, "AuthenticAMD" string with "GenuineIntel". You see, I know several applications that are relying on this string, and I suspect that this quirk is a cause of slowdown of those applications on non-Intel CPUs. All I need is a tool capable of these manipulation. Maybe such a thing possible on some virtual machine?





                                                               
                                                               
                                                              Edit: Removed advertising from post
                                                               
                                                                • CPUID values' manipulation
                                                                  agner

                                                                  I have collected major facts about the Intel compiler issue on my blog:
                                                                  http://www.agner.org/optimize/blog/read.php?i=49

                                                                    • CPUID values' manipulation
                                                                      avk

                                                                      Nice put, I'd say. But, like I said, a petition would be a more efficient form of expression.

                                                                      BTW, I've written a small program that can change the "Genu"+"ineI"+"ntel" into the "Auth"+"enti"+"cAMD" and vice versa. You wouldn't believe how much these signatures were found in a miscellaneous software! I recall Morpheus' phrase: "The Matrix is everywhere, it is all around us."

                                                                        • CPUID values' manipulation
                                                                          agner

                                                                           

                                                                          Originally posted by: avk I've written a small program that can change the "Genu"+"ineI"+"ntel" into the "Auth"+"enti"+"cAMD" and vice versa.


                                                                          Have you found any examples of programs that run faster on AMD when you change this string in the binary?

                                                                          If you publish your code then everybody can try with their programs.

                                                                            • CPUID values' manipulation
                                                                              avk

                                                                              The program itself is very simple, every coder (even rookie) can create something alike. But I can, of course, publish its source .

                                                                              As for its testing: not thoroughly. I think you perfectly know that just changing a CPUID.Vendor Signature from one to another is not enough. Every case, I believe, should be thoroughly analyzed and debugged. You see, my goal is to check as many modern PC games as I can, but, alas, I'm not so rich to buy all of them. If I'd try to use their illegal versions (downloaded from the Torrent, for example), who'd believe my results?

                                                                          • CPUID values' manipulation
                                                                            sigmainfotech

                                                                            cpuid dumps detailed information about the CPU(s) gathered from the CPUID instruction, and also determines the exact model of CPU(s) from that information. It dumps all information available from the CPUID instruction. The exact collection of information available varies between manufacturers and even between different CPUs from a single manufacturer.

                                                                              • New program for CPUID value manipulation
                                                                                agner

                                                                                I have made a program that can manipulate the CPUID vendor string, family and model number on VIA Nano processors. You can download it from http://www.agner.org/optimize/cpuidfake.zip . It works only on VIA, not on AMD or Intel processors.

                                                                                Now you can test if a program runs faster if you cange the CPUID. All you need is a computer with a VIA processor (The VIA Mini-ITX board costs less than 200$ and fits into a standard desktop cabinet).

                                                                                If you find any benchmarks or other commonly used programs with evidently unfair CPU dispatching then please let me know.

                                                                                  • New program for CPUID value manipulation
                                                                                    avk

                                                                                    Thank you, Agner!

                                                                                    Hey, AMD, wake up! What are you waiting for? Intel will never be a fair player on the CPU market, and you perfectly know this! I believe that it is extremely urgent that you, AMD, should implement this feature. Is it so damn difficult to implement just two or three additional MSR in order to make your CPUs a chameleons like VIA did back in 2003 with C3?

                                                                                      • CPUID values' manipulation
                                                                                        agner

                                                                                         

                                                                                        Originally posted by: avk

                                                                                        I believe that it is extremely urgent that you, AMD, should implement this feature.



                                                                                        Considering how long the development cycle of a microprocessor is, it will take several years before we have a CPUID change feature in an AMD processor if they decide to make one. By that time, Intel will probably have changed their strategy due to legal pressure and bad publicity.

                                                                                        It would be much faster to make a CPUID manipulation program based on AMD virtualization instructions. I don't have the time to make such a program, but I hope that somebody else will do it. It could be added as a feature to existing virtualization software. Some virtualization tools are open source, so this is doable.