Hi everyone. I'm John McCrae. I work on the Microsoft team here at AMD. AMD is dedicated to providing its HPC customers (both Windows and Linux) with the tools they need to be successful with AMD hardware. This blog promises to be a combination of both Developer and IT-Professional content designed to help you maximize your investments in AMD-based HPC products and solutions. I will be posting solutions to common problems as I discover them but would love to get your comments and suggestions on topics you'd love to see posted here as well.
The first suggestion I can pass on is to check out the Hard-Core Software Optimizations blog for some great tips and tricks for writing effective, performant code.
-------------------------
This response is provided for informational purposes only, is provided “AS IS” and does not obligate AMD to provide any of the services, technology, or programs described.
When porting 32-bit code to 64-bit code, one of the issues that must be dealt with is the absence of inline assembly language support in the Microsoft Visual Studio 2005 64-bit compiler. One of the common places where developers have used inline assembly is to determine specific processor features via the cpuid instruction. This can be really easy to fix using intrinsics.
While this is not intended to be a primer on intrinsics, I'll write a few introductory words for those that are unfamiliar. Compiler intrinsics are generally built into a compiler as opposed to being in a library. They also usually generate inline code, although sometimes there is an option to generate a function call. Although an intrinsic may offer some portability, for example the __cpuid intrinsic will work fine for either 32-bit x86 or 64-bit AMD64 targets with the Visual Studio compiler, this may not be so across compilers. Gcc has intrinsics but I believe they are referred to as built-ins and they tend to have different mnemonics even though many overlap in terms of the native instructions they use.
In assembly language, the code might look like the crude code in example 1 below. This code just executes one cpuid function call and displays the results. Your real code would be more substantial. The intrinsic version is shown in example 2 below. Note you'll need to include the header intrin.h to use the __cpuid intrinsic.
I originally decided to write this note because I was unable to locate a cpuid sample using intrinsics. Of course since that time I have found a fairly thourough one on MSDN. It's a little difficult to find online by searching so here's a link, or failing that, drill down in the MSDN Library to Development Tools and Languages\Visual Studio 2005\Visual Studio\Visual C++\Reference\C/C++ Languages\Compiler Intrinsics\Alphabetical Listing...\__cpuid.
int _tmain(int argc, _TCHAR* argv[]) { int CPUInfo[4] = {0}; char idstring[13] = {0};
__cpuid(CPUInfo, 0); *(int*)idstring = CPUInfo[1]; *(int*)(idstring + 4) = CPUInfo[3]; *(int*)(idstring + 8) = CPUInfo[2]; idstring[12] = 0; printf("%s Largest function supported is %#x", &idstring[0], CPUInfo[0]); return 0; }
------------------------- This response is provided for informational purposes only, is provided “AS IS” and does not obligate AMD to provide any of the services, technology, or programs described.
Welcome to the inaugural entry for Inside Dev Central, a window into the workings of the AMD Dev Central team. My name is Bao Phan, and I'm responsible for the overall direction of this web site. You'll hear from other members of our team as they chime in with their own entries.
We'll be using Inside Dev Central to call your attention to interesting and relevant information you may have missed from across AMD and the industry in general, to put forth some ideas that we'd like to get your input on, to clue you in on early access info whenever we can, and anything else we think you might find useful.
We invite you to help guide the direction of this site by leaving comments that let us know if we're on the right track and what topics you would like to see tackled.
For starters, be sure to check out the Developer Performance Team's blog on Hard-Core Software Optimization. I know they have lots of great stuff they are planning to talk about in their upcoming entries. And we'll be adding more topics as time goes on, so do voice your thoughts on what you'd like to hear about.
-------------------------
The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions and typographical errors. Links to third party sites are for convenience only, and no endorsement is implied.
Welcome to our blog. This blog is from the Developer Performance Team at AMD. We will mostly concentrate on software optimization and performance topics. Certainly other areas related to software development and AMD products in general may be touched on. We may also dive in to hardware performance especially as it relates to I/O and how to extract the best performance from it from a software perspective.
Please do give us feedback as to the topics you'd like to see discussed, and your overall opinions of the blog.
------------------------- This response is provided for informational purposes only, is provided “AS IS” and does not obligate AMD to provide any of the services, technology, or programs described.