Skip to content

Prevent CPU HLO profiling crashes#103

Open
stevenvar wants to merge 1 commit into
joeyye-work:for-serving-2.20from
stevenvar:steven.cpu_hlo_profile_fix
Open

Prevent CPU HLO profiling crashes#103
stevenvar wants to merge 1 commit into
joeyye-work:for-serving-2.20from
stevenvar:steven.cpu_hlo_profile_fix

Conversation

@stevenvar
Copy link
Copy Markdown
Collaborator

@stevenvar stevenvar commented May 5, 2026

This PR fixes a crash when using --xla_hlo_profile=true with XLA:CPU.

Before this change, XLA could generate profiling code, but at runtime the profiling counter buffer could be missing. The generated code then tried to write to a null pointer and crashed.

This change:

  • creates the profiling counter buffer before running the compiled CPU function
  • passes that buffer to the generated code
  • adds a safety check so profiling does not crash if the buffer is missing
  • disables HLO profiling for the CPU thunk runtime, because that path does not support profiling counters yet

On non-x86 CPUs, it also uses a safer runtime timer instead of a low-level LLVM cycle counter.

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