Re: [PATCH risu] use time() as random seed and introduce --randseed option

2023-06-06 Thread Alex Bennée


Jun Sun  writes:

> It seems to me that we are OK with random as default behavior but we should 
> print out the seed (and abstract it into
> a shared function across arches).
>
> Happy to re-work the patch if my understanding is correct.

Works for me. Please respin.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



Re: [PATCH risu] use time() as random seed and introduce --randseed option

2023-06-06 Thread Jun Sun
It seems to me that we are OK with random as default behavior but we should
print out the seed (and abstract it into a shared function across arches).

Happy to re-work the patch if my understanding is correct.

Jun

On Thu, May 18, 2023 at 6:09 AM Alex Bennée  wrote:

>
> Peter Maydell  writes:
>
> > On Fri, 5 May 2023 at 01:23, Jun Sun  wrote:
> >>
> >> Agree on the usefulness of generating the same test. That is the
> >> reason behind adding --randseed option. Once a seed is set, it
> >> always generates the same sequence of instructions.
> >>
> >> Basically with this patch,
> >>
> >> by default you will generate random instruction sequences for most
> testing cases
> >> you can provide a random seed option in the commandline to generate a
> deterministic instruction sequence
> >>
> >> Without this patch,
> >>
> >> we always get one fixed sequence (ie. random seed == 0 case)
> >> Otherwise we would have to manually modify code to generate random
> >> instruction sequences or generate a different fixed sequence.
> >>
> >> Hope this clarifies things a little bit.
> >
> > Mmm; it comes down to: should we default to 'time' and
> > require the user to specify --randseed 0 to get the old
> > behaviour; or do we retain the current behaviour as the
> > default and let the user pass an option if they want a
> > non-reproducibly random output.
> >
> > Alex, what do you reckon? You probably have been using
> > risugen more actively than me recently. I guess I vaguely
> > lean to "default to randomize(time)".
>
> I'm easy either way as long as we as long as we print out the seed so we
> can deterministically regenerate if we want to.
>
> >
> > Also, should we make risugen print the random seed to stdout
> > so you can repro it even if you didn't pass --randseed initially?
> >
> > Now that the random-seed-setting is 6 lines instead of 1,
> > this should definitely be abstracted out to a function
> > in the common code and not repeated in each per-arch file.
> >
> > thanks
> > -- PMM
>
>
> --
> Alex Bennée
> Virtualisation Tech Lead @ Linaro
>


Re: [PATCH risu] use time() as random seed and introduce --randseed option

2023-05-18 Thread Alex Bennée


Peter Maydell  writes:

> On Fri, 5 May 2023 at 01:23, Jun Sun  wrote:
>>
>> Agree on the usefulness of generating the same test. That is the
>> reason behind adding --randseed option. Once a seed is set, it
>> always generates the same sequence of instructions.
>>
>> Basically with this patch,
>>
>> by default you will generate random instruction sequences for most testing 
>> cases
>> you can provide a random seed option in the commandline to generate a 
>> deterministic instruction sequence
>>
>> Without this patch,
>>
>> we always get one fixed sequence (ie. random seed == 0 case)
>> Otherwise we would have to manually modify code to generate random
>> instruction sequences or generate a different fixed sequence.
>>
>> Hope this clarifies things a little bit.
>
> Mmm; it comes down to: should we default to 'time' and
> require the user to specify --randseed 0 to get the old
> behaviour; or do we retain the current behaviour as the
> default and let the user pass an option if they want a
> non-reproducibly random output.
>
> Alex, what do you reckon? You probably have been using
> risugen more actively than me recently. I guess I vaguely
> lean to "default to randomize(time)".

I'm easy either way as long as we as long as we print out the seed so we
can deterministically regenerate if we want to.

>
> Also, should we make risugen print the random seed to stdout
> so you can repro it even if you didn't pass --randseed initially?
>
> Now that the random-seed-setting is 6 lines instead of 1,
> this should definitely be abstracted out to a function
> in the common code and not repeated in each per-arch file.
>
> thanks
> -- PMM


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



Re: [PATCH risu] use time() as random seed and introduce --randseed option

2023-05-09 Thread Peter Maydell
On Fri, 5 May 2023 at 01:23, Jun Sun  wrote:
>
> Agree on the usefulness of generating the same test.  That is the reason 
> behind adding --randseed option.  Once a seed is set, it always generates the 
> same sequence of instructions.
>
> Basically with this patch,
>
> by default you will generate random instruction sequences for most testing 
> cases
> you can provide a random seed option in the commandline to generate a 
> deterministic instruction sequence
>
> Without this patch,
>
> we always get one fixed sequence (ie. random seed == 0 case)
> Otherwise we would have to manually modify code to generate random 
> instruction sequences or generate a different fixed sequence.
>
> Hope this clarifies things a little bit.

Mmm; it comes down to: should we default to 'time' and
require the user to specify --randseed 0 to get the old
behaviour; or do we retain the current behaviour as the
default and let the user pass an option if they want a
non-reproducibly random output.

Alex, what do you reckon? You probably have been using
risugen more actively than me recently. I guess I vaguely
lean to "default to randomize(time)".

Also, should we make risugen print the random seed to stdout
so you can repro it even if you didn't pass --randseed initially?

Now that the random-seed-setting is 6 lines instead of 1,
this should definitely be abstracted out to a function
in the common code and not repeated in each per-arch file.

thanks
-- PMM



Re: [PATCH risu] use time() as random seed and introduce --randseed option

2023-05-04 Thread Jun Sun
Agree on the usefulness of generating the same test.  That is the reason
behind adding --randseed option.  Once a seed is set, it always generates
the same sequence of instructions.

Basically with this patch,

   - by default you will generate random instruction sequences for most
   testing cases
   - you can provide a random seed option in the commandline to generate a
   deterministic instruction sequence

Without this patch,

   - we always get one fixed sequence (ie. random seed == 0 case)
   - Otherwise we would have to manually modify code to generate random
   instruction sequences or generate a different fixed sequence.

Hope this clarifies things a little bit.

Jun

On Wed, May 3, 2023 at 10:05 AM Alex Bennée  wrote:

>
> Jun Sun  writes:
>
> > By default, risu currently does not generate random instruction
> sequences because it uses 0 as the random seed.
> > This patch uses time() as random seed and also introduces --randomseed
> option for deterministic sequence
> > generation.
>
> I can see the benefit for being able to change the seed but I think
> using time() by default means any given sequence won't be reproducible.
> This is useful behaviour if you want to regenerate the same test
> sequence on another machine without copying stuff about.
>
> >
> > [4. text/x-diff;
> 0008-add-randseed-option-and-use-time-as-default-seed.patch]...
>
>
> --
> Alex Bennée
> Virtualisation Tech Lead @ Linaro
>


Re: [PATCH risu] use time() as random seed and introduce --randseed option

2023-05-03 Thread Alex Bennée


Jun Sun  writes:

> By default, risu currently does not generate random instruction sequences 
> because it uses 0 as the random seed. 
> This patch uses time() as random seed and also introduces --randomseed option 
> for deterministic sequence
> generation.

I can see the benefit for being able to change the seed but I think
using time() by default means any given sequence won't be reproducible.
This is useful behaviour if you want to regenerate the same test
sequence on another machine without copying stuff about.

>
> [4. text/x-diff; 
> 0008-add-randseed-option-and-use-time-as-default-seed.patch]...


-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro



[PATCH risu] use time() as random seed and introduce --randseed option

2023-05-03 Thread Jun Sun
By default, risu currently does not generate random instruction sequences
because it uses 0 as the random seed.  This patch uses time() as random
seed and also introduces --randomseed option for deterministic sequence
generation.


0008-add-randseed-option-and-use-time-as-default-seed.patch
Description: Binary data