Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In literal_util.cc, use absl::uniform_int_distribution. #22331

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

In literal_util.cc, use absl::uniform_int_distribution.

absl::uniform_int_distribution is faster than std::uniform_int_distribution. This makes initializing literals in run_hlo_module faster. In particular, I tested the following HLO:

ENTRY f {
  arg = s8[2000000000] parameter(0)
  ROOT add_result = s8[2000000000] add(arg, arg)
}

It takes 7.8 seconds to initialize the input literal with the absl function, and 18.2 with the std function.

Unfortunately the absl version of uniform_real_distribution is not faster. It takes 25.5 seconds with absl and 8.3 with std on the HLO when s8 is replaced with f16.

absl::uniform_int_distribution is faster than std::uniform_int_distribution. This makes initializing literals in run_hlo_module faster. In particular, I tested the following HLO:

    ENTRY f {
      arg = s8[2000000000] parameter(0)
      ROOT add_result = s8[2000000000] add(arg, arg)
    }

It takes 7.8 seconds to initialize the input literal with the absl function, and 18.2 with the std function.

Unfortunately the absl version of uniform_real_distribution is not faster. It takes 25.5 seconds with absl and 8.3 with std on the HLO when s8 is replaced with f16.

PiperOrigin-RevId: 723316656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant