Dynamic cpu code?

Everything else that doesn't fall into one of the other PB categories.
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Dynamic cpu code?

Post by Dreglor »

does the compiler create clone code for each processer so when run on amd it will do the 3dnow! instructions and on intel will use sse2 instuctions?
or is it just uses instructions that aren't cpu spcific?
~Dreglor
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Check the section "Using the command line compiler" in the manual
PB manual wrote: /DYNAMICCPU: Creates a executable containing all the available processor specific routines. When the program is started, it looks for the processor type and then select the more appropriates routines to use. This makes a bigger executable, but result in the fastest possible program.
To my knowledge there are very few(if any) library commands that come in mmx, 3dnow! optimized versions.

The ASM that the compiler produces itself is to my knowledge only generic ASM.
Max.²
Enthusiast
Enthusiast
Posts: 175
Joined: Wed Jul 28, 2004 8:38 am

Post by Max.² »

Pupil wrote:To my knowledge there are very few(if any) library commands that come in mmx, 3dnow! optimized versions.
I made a very few, dealing with encryption. No clue if they work with 3.92 though.
The ASM that the compiler produces itself is to my knowledge only generic ASM.
That is what I know, too.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Does anyone know what DYNAMICCPU actually does? Does it, for example, create 386,486 etc codeblocks and do some internal patching at runtime? :)


Just curious, is all.
@}--`--,-- A rose by any other name ..
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

My guess is that a jumptable for the functions in question (for the ones that have CPU specific optimizations) is set up in the init code. This is however only a guess from my side, Fred would know for sure, i hope ;)
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

That's exaclty as Pupil said (you can see that when using the /COMMENTED code with a function which actually support it (actually there is no internal PB functions which use it, but some user libs could)).
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Wondering, if its turned on how will the exe work on lets say non-3dnow cpu's? Will the code that works on all cpu's be included too?
Jellybean
User
User
Posts: 95
Joined: Wed Aug 24, 2005 7:33 pm

Post by Jellybean »

thefool wrote:Wondering, if its turned on how will the exe work on lets say non-3dnow cpu's? Will the code that works on all cpu's be included too?
If you set it to for example MMX and you happen to use some functions that support this, the executable of course won't work on non-MMX processors.

It seems to me like the point of "dynamic" is to include all function sets and then pick the best at runtime. (So then it will of course run on any processor.)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

i asked if it just meant that the mmx was included. So the size grew bigger but exe worked on all cpu's as well. Its not all "Of course".... i doubt it will include functions for mmx or 3dnow when using dynamic.
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

When using dynamic CPU all specialized routines will be included which means a probably bigger exe, but also the fastest possible (as each routine will be used depending of the CPU where the exe is running on).
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

ok thanks for the clearifytation [a word i just made i think :?]
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

Dynamic CPU should be used more often...

it be a good idea if we could have compiler Constants for these so you could write 3dnow!,SSE,MMX version of certain procedures or parts of code that would be nice
~Dreglor
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Very interesting.

Agree with Dreglor, perhaps /DYNAMICCPU should be used more often. And incode compiler switches would be useful.
@}--`--,-- A rose by any other name ..
Dummy
Enthusiast
Enthusiast
Posts: 162
Joined: Wed Jun 09, 2004 11:10 am
Location: Germany
Contact:

Post by Dummy »

The constants would be a great thing!

You could create Exes for 3DNow!, SSE2 and normal(not optimized) and the create an exe that chooses the fastest one.

I'd just speed up a little more in Loops containing Optimized functions :wink:

That'd be great
Fred
Administrator
Administrator
Posts: 18351
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Dummy: you can already do that, what do you mean exactly ?
Post Reply