Author Topic: SSE 128bit randomgenerator(s)  (Read 2248 times)

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
SSE 128bit randomgenerator(s)
« on: June 28, 2019, 02:20:58 AM »
making 128bit randomgenerator(s)
SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #1 on: May 20, 2021, 09:28:37 PM »
I decided to try alternative fast gp reg unrolled 4 times
using mul instead of pmuludq,is there any way to use edx result for randomize it more?
SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s) unrollx?times?
« Reply #2 on: May 29, 2021, 12:36:45 AM »
I have 128bit SSE2 simple randomgenerator in macro

unrolled it 8 times in loop few million times
and checks for primes and add together primes
could you check timings please?





« Last Edit: May 29, 2021, 02:02:22 AM by daydreamer »
SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

mineiro

  • Member
  • ****
  • Posts: 725
Re: SSE 128bit randomgenerator(s)
« Reply #3 on: May 29, 2021, 04:20:57 AM »
Code: [Select]
$ wine cmd.exe
Microsoft Windows 6.1.7601
Z:\home\mineiro\Documentos>1th.exe
1# program
the RND's
sum of random primes :583603954
27
Ms : 315
Ms composites :0
Press any key to continue ...

Z:\home\mineiro\Documentos>1th.exe
1# program
the RND's
sum of random primes :583603954
27
Ms : 318
Ms composites :0
Press any key to continue ..

Z:\home\mineiro\Documentos>1th.exe
1# program
the RND's
sum of random primes :583603954
27
Ms : 338
Ms composites :0
Press any key to continue ..
I'd rather be this ambulant metamorphosis than to have that old opinion about everything

HSE

  • Member
  • *****
  • Posts: 1744
  • <AMD>< 7-32>
Re: SSE 128bit randomgenerator(s)
« Reply #4 on: May 29, 2021, 06:20:20 AM »
Well...not so random:
Code: [Select]
1# program
the RND's
sum of random primes :583603954
27
Ms : 468
Ms composites :0
Press any key to continue ...

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #5 on: May 29, 2021, 09:01:02 PM »
Code: [Select]
1# program
the RND's
sum of random primes :583603954
27
Ms : 391
Ms composites :0
Press any key to continue ...

I can also use random seed,but for timings it will become random add together or not,could randomize timings some without same seeds

with before also generating primes,it took several seconds

SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #6 on: June 01, 2021, 02:21:17 AM »
probably can go faster

SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

HSE

  • Member
  • *****
  • Posts: 1744
  • <AMD>< 7-32>
Re: SSE 128bit randomgenerator(s)
« Reply #7 on: June 01, 2021, 03:26:33 AM »
Code: [Select]
1# program
the RND's
sum of random primes :583610108
27
Ms : 577
Ms composites :-2029479
Press any key to continue ...

Ms : 592
Ms composites :-2081178

Ms : 562
Ms composites :-2116059

Ms : 561
Ms composites :-2141363

Ms : 577
Ms composites :-2176416

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #8 on: June 01, 2021, 09:36:08 PM »
its really fast now :biggrin:
Code: [Select]
1# program
the RND's
sum of random primes :583610108
27
Ms : 156
Ms composites :-1527477187
Press any key to continue ...
but maybe slower on older cpus
changed align 64 above loops and removed two .IFs
started with over 2000+ms,when it took most time pre-generate primes



SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

LiaoMi

  • Member
  • ****
  • Posts: 922
Re: SSE 128bit randomgenerator(s)
« Reply #9 on: June 01, 2021, 11:45:48 PM »
Hi daydreamer,

1# program
the RND's
sum of random primes :583610108
27
Ms : 125
Ms composites :-71800812
Press any key to continue ...

1# program
the RND's
sum of random primes :583610108
27
Ms : 125
Ms composites :-71843093
Press any key to continue ...   

1# program
the RND's
sum of random primes :583610108
27
Ms : 140
Ms composites :-71870625
Press any key to continue ... 

my timing results are always in two variations 140 - 125, is this normal? What algorithm was taken as a basis? Is it possible to check the randomness of the distribution of numbers?

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #10 on: June 02, 2021, 07:32:37 AM »
LiaoMi
The First posted earlier was inspired by Hutch 64bit random pad ,somewhere he had some program that you could test random quality
I had both rdtsc and get milliseconds to randomizer it

Its the usual windows milliseconds clock from startup I use
The later Unrolled 128bit generator Is based on fast simple rnd generator for texture generating



SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 8497
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: SSE 128bit randomgenerator(s)
« Reply #11 on: June 12, 2021, 05:58:10 PM »
The app you are looking for is called ENT written by John Walker. Its freeware.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #12 on: June 13, 2021, 04:46:27 AM »
The app you are looking for is called ENT written by John Walker. Its freeware.
Thanks hutch  :thumbsup:
Is there a way to combine several different rnd generators for quality, instead of quantity?

wish to add one test to rnd generators: randomness/speed ratio

« Last Edit: June 14, 2021, 07:02:48 PM by daydreamer »
SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P

daydreamer

  • Member
  • *****
  • Posts: 1721
  • building nextdoor
Re: SSE 128bit randomgenerator(s)
« Reply #13 on: June 18, 2021, 06:38:45 PM »
Seem solution to better randomness is right there,looking at low compression ratio for. Primes.inc
SIMD fan and macro fan
why assembly is fastest is because its switch has no (brakes) breaks
:P
only in 16bit assembly you can get away with "Only words" :P