Re: [fpc-pascal] fpmmap problem 64 bit linux

2020-11-22 Thread Rainer Stratmann via fpc-pascal
mmap2 could be helpful.

The mmap2() system call provides the same interface as mmap(),
except that the final argument specifies the offset into the file in
4096-byte units (instead of bytes, as is done by mmap()).  This
enables applications that use a 32-bit off_t to map large files (up
to 2^44 bytes).

https://man7.org/linux/man-pages/man2/mmap2.2.html

But it is not yet implemented.

FPC 3.0.4


Am Samstag, 21. November 2020, 13:31:22 CET schrieb Rainer Stratmann via fpc-
pascal:
> I watched the syscalls with strace and my assumption was confirmed.
> 
> function Fpmmap( start: pointer; len: size_t; prot: cint; flags: cint;
> fd:cint; offst: off_t ):pointer;
> 
> My offst value for fpmmap is $1.
> 
> strace output:
> 
> mmap(NULL, 192, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_32BIT, 3, 0) = -1
> EINVAL
> 
> Here the value is 0.
> 
> It is likely that the offst value is stripped to 32 bit before passed to the
> mmap syscall.
> 
> 
> 
> Am Samstag, 21. November 2020, 01:15:20 CET schrieb Alexander Grotewohl via
> 
> fpc-pascal:
> > It would seem C handles this at compile time with a define.. mapping mmap
> > to mmap64. Which would almost seem to imply you'd end up with a 32 bit
> > binary that would only work on 64 bit systems. I'm not really sure how
> > this would work for Pascal. You could start by looking in the file listed
> > in the fpmmap docs you posted. My guess is the easiest answer is
> > "distribute both 32 and 64 bit versions," but that doesn't help when you
> > need to test the 32 bit one..
> > 
> > --
> > Alexander Grotewohl
> > https://dcclost.com
> > 
> > --
> > Alexander Grotewohl
> > https://dcclost.com
> > 
> > From: fpc-pascal  on behalf of
> > Rainer Stratmann via fpc-pascal  Sent:
> > Friday, November 20, 2020 6:33:51 PM
> > To: fpc-pascal@lists.freepascal.org 
> > Cc: Rainer Stratmann 
> > Subject: [fpc-pascal] fpmmap problem 64 bit linux
> > 
> > A 32 bit freepascal program on a 32 bit Linux Debian system is working
> > properly. It uses fpmmap for getting the adress of a kms framebuffer.
> > 
> > The same 32 bit program on a 64 bit Linux Debian system *** is not
> > working.
> > When it comes to the fpmmap it gives an error:
> > 
> > Sys_EINVAL
> > 
> > One of the record fields Start, length or offset is invalid.
> > 
> > https://www.freepascal.org/docs-html/rtl/baseunix/fpmmap.html
> > 
> > I figured out that it likely can only be the offset value since start and
> > length are always the same.
> > 
> > The offset value I got from a previous DRM function.
> > 
> > On the 32 bit System this offset value is $1000 (fits in 32 bit)
> > And on the 64 bit System this offset value is $1 (does not fit in
> > 32 bit).
> > 
> > Can it be possible that the fpmmap function strips the offset value to 32
> > bit? Is there another way to call fpmmap more directly?
> > What does fpmmap exactly?
> > Where can I research?
> > 
> > 
> > ***
> > dpkg --add-architecture i386
> > apt-get update
> > apt-get install libc6-i386
> > 
> > 
> > ___
> > fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> 
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compilation speed on Apple M1

2020-11-22 Thread Florian Klämpfl via fpc-pascal


> Am 22.11.2020 um 11:45 schrieb Michael Van Canneyt via fpc-pascal 
> :
> 
> 
> 
>> On Sun, 22 Nov 2020, Florian Klämpfl via fpc-pascal wrote:
>> 
>>> Am 21.11.2020 um 12:54 schrieb Tobias Giesen via fpc-pascal:
>>> Hello,
>>> first and foremost, many thanks to the creators and contributors of FPC
>>> and Lazarus, who enabled me to release my product natively for Apple
>>> Silicon only one day after receiving an M1 Mac. Fantastic work! FPC and
>>> Lazarus both run natively and work very well.
>>> According to Geekbench, the single core performance on the new Mac is
>>> around 1.8x as fast as my Intel Mac. Multicore is also much faster. I
>>> wonder why I don't see the speed increase in compiling though. Yes I am
>>> using different FPC and XCode versions, but I wonder what else could
>>> have an influence? My project is very large and not divided into
>>> packages, so I frequently need to recompile the whole project.
>>> I would be most grateful for any performance tips.
>> 
>> In r47526, I implemented support of the prefetch intrinsic on aarch64. On my 
>> Raspi4 it reduced make cycle time by 25 % (!). I would be very interested to 
>> get numbers for the M1.
> 
> 25% ?!

Yes. I were also baffled and tested several times but numbers didn‘t change. 
This is why I would like to see numbers from others.

> 
> Well... If the compiler can make such a difference,

This are the big low hanging fruits, their are only a few :) In particular the 
compiler benefits a lot from this as it iterates linked lists a lot.

> should we still bother with micro-optimizations in code then ?

I am always against micro-optimising code, this should do the compiler though 
prefetch is also a matter of inserting the intrinsic in your code. FPC can do 
this automatically but so far it is disabled as it is overall not beneficial.

> 
> Michael.___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compilation speed on Apple M1

2020-11-22 Thread Michael Van Canneyt via fpc-pascal



On Sun, 22 Nov 2020, Florian Klämpfl via fpc-pascal wrote:


Am 21.11.2020 um 12:54 schrieb Tobias Giesen via fpc-pascal:

Hello,

first and foremost, many thanks to the creators and contributors of FPC
and Lazarus, who enabled me to release my product natively for Apple
Silicon only one day after receiving an M1 Mac. Fantastic work! FPC and
Lazarus both run natively and work very well.

According to Geekbench, the single core performance on the new Mac is
around 1.8x as fast as my Intel Mac. Multicore is also much faster. I
wonder why I don't see the speed increase in compiling though. Yes I am
using different FPC and XCode versions, but I wonder what else could
have an influence? My project is very large and not divided into
packages, so I frequently need to recompile the whole project.

I would be most grateful for any performance tips.


In r47526, I implemented support of the prefetch intrinsic on aarch64. On my 
Raspi4 it reduced make cycle time by 25 % 
(!). I would be very interested to get numbers for the M1.


25% ?!

Well... 
If the compiler can make such a difference, should we still bother with micro-optimizations in code then ?


Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compilation speed on Apple M1

2020-11-22 Thread Florian Klämpfl via fpc-pascal

Am 21.11.2020 um 12:54 schrieb Tobias Giesen via fpc-pascal:

Hello,

first and foremost, many thanks to the creators and contributors of FPC
and Lazarus, who enabled me to release my product natively for Apple
Silicon only one day after receiving an M1 Mac. Fantastic work! FPC and
Lazarus both run natively and work very well.

According to Geekbench, the single core performance on the new Mac is
around 1.8x as fast as my Intel Mac. Multicore is also much faster. I
wonder why I don't see the speed increase in compiling though. Yes I am
using different FPC and XCode versions, but I wonder what else could
have an influence? My project is very large and not divided into
packages, so I frequently need to recompile the whole project.

I would be most grateful for any performance tips.


In r47526, I implemented support of the prefetch intrinsic on aarch64. On my Raspi4 it reduced make cycle time by 25 % 
(!). I would be very interested to get numbers for the M1.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal