Skip to content

rand_xoshiro crate = runtime error #203

Closed

Description

@brandonros

Reproduction:

#[kernel]
#[allow(improper_ctypes_definitions, clippy::missing_safety_doc)]
pub unsafe fn find_vanity_private_key(a: &[u8]) {
    let idx = thread::index_1d() as usize;

    let mut rng_seed: u64 = 42; // TODO: make this unique for each thread?
    let mut num_iterations: u64 = 0;

    for _ in 0..10000 {
        // generate random input for seed
        let mut rng = Xoroshiro128StarStar::seed_from_u64(rng_seed); // if i change this to MockXoroshiro128StarStar it works fine
        let mut input = [0u8; 32];
        rng.fill_bytes(&mut input);
         ...

Activity

  1. jorge-ortega commented on Apr 24, 2025

    @jorge-ortega
    Collaborator

    Hi @brandonros,

    Thanks for the report. I'm not able to reproduce this atm. Can you also share how you launch from the host side?

    My kernel currently looks like this:

    #[kernel]
    #[allow(improper_ctypes_definitions, clippy::missing_safety_doc)]
    pub unsafe fn rng_test() {
    
        let rng_seed: u64 = 42;
    
        for _ in 0..10000 {
            let mut rng = Xoroshiro128StarStar::seed_from_u64(rng_seed);
            let mut input = [0u8; 32];
            rng.fill_bytes(&mut input);
        }
    }

    And I launch like this:

    unsafe {
        launch!(
            module.rng_test<<<32, 32, 0, stream>>>()
        )?;
    }

    The path-tracer example uses DefaultRand, which uses Xorohiro128StarStar. The render kernel receives it as a parameter, which the host side provides when launching. Hope that helps.

  2. brandonros commented on Apr 26, 2025

    @brandonros
    ContributorAuthor

    I'll report back if I'm able to reproduce. I moved to XorShiftRng for now which doesn't seem to have this issue. Not sure if it is related to resources (too many threads/blocks).

    I had the problem trying to launch it with cust and https://github.com/coreylowman/cudarc but I do not want to waste your time tracking it down.

    Would a compiled output like .ll help at all?

  3. brandonros commented on Apr 27, 2025

    @brandonros
    ContributorAuthor

    brandonros/vanity-miner-rs@424ee9d

    if you switch Xoroshiro128StarStar and XorShiftRng on this branch it should reproduce

  4. brandonros commented on Apr 29, 2025

    @brandonros
    ContributorAuthor
  5. changed the title [-]Xoroshiro128StarStar::seed_from_u64 causes Error: IllegalAddress failure[/-] [+]rand_xoshiro crate = runtime error[/+] on Apr 29, 2025
  6. brandonros commented on May 26, 2025

    @brandonros
    ContributorAuthor

    not sure if #217 fixed it 100% but no longer reproducible

  7. LegNeato commented on May 26, 2025

    @LegNeato
    Contributor

    Sweet!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions