Commit fc4dbb6a authored by Bixia Zheng's avatar Bixia Zheng Committed by TensorFlower Gardener
Browse files

[XLA:GPU] Fix a bug related to GPU constant buffer name collision.

Having a hyphen or a dot in the name of an LLVM global variable for a GPU
constant buffer can crash the LLVM PTX backend. This happens when a constant
buffer is created for an HLO constant instruction that contains such
characters in its name. Previously, we sanitize the names of the HLO constant
instruction by replacing such characters with underscores during LLVM IR
emission. However, this approach has a problem in handling name collision due
to name sanitization. In particular, when the same sanitized name is used to
create global variables for the constant buffers of two different HLO constant
instructions, LLVM resolves the name conflict by appending a unique number to
the sanitized name. Later on, during LLVM IR emission or GPU kernel execution,
we simplify use the sanitized name of an HLO constant instruction to look up
the global buffer for the constant and find a wrong buffer. This change adds
an HLO pass to sanitize the HLO constant instruction names before LLVM IR
emission.

Relocate gpu_buffer_assignment_test.cc to gpu_sanitize_constant_names_test.cc
and modify the tests for the purpose of testing the new pass that sanitizes HLO
constant instruction names.

PiperOrigin-RevId: 231342192
parent dd7de7bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment