ITADN

Coverage-instrumented build: CPU JIT fails (`__profc_*` symbols not found); CUDA works

#43177Opencxxhou 创建于 2026-05-25
CPU
C
cxxhoucommented
## Bug Report With LLVM coverage instrumentation enabled at build time, the same HLO module runs fine on **CUDA** but fails on **CPU** at execute time. ``` ./run_hlo_module --platform=CPU --reference_platform=CUDA \ --input_format=stablehlo 65502e234a2aa972.mlir --print_literals ``` [ir.txt](https://github.com/user-attachments/files/28233272/ir.txt) ``` WARNING: All log messages before absl::InitializeLog() is called are written to STDERR I0000 00:00:1779730114.803387 3179391 service.cc:178] XLA service 0x5c7247106f90 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices: I0000 00:00:1779730114.803433 3179391 service.cc:194] StreamExecutor [0]: NVIDIA GeForce RTX 4060 Laptop GPU, Compute Capability 8.9 (Driver: 13.0.0[580.126.9]; Runtime: 12.8.0; Toolkit: 12.9.0; DNN: 9.10.2) I0000 00:00:1779730114.803806 3179391 se_gpu_pjrt_client.cc:1539] Using BFC allocator. I0000 00:00:1779730114.803849 3179391 gpu_helpers.cc:145] XLA backend will use up to 6118932480 bytes on device 0 for BFCAllocator. I0000 00:00:1779730114.803886 3179391 gpu_helpers.cc:184] XLA backend will use up to 2039644160 bytes on device 0 for CollectiveBFCAllocator. I0000 00:00:1779730114.809755 3179391 cuda_dnn.cc:436] Loaded cuDNN version 91002 ** Running 65502e234a2aa972.mlir** ** Buffer assignment proto ** goo.gle/debugstr Running HLO module with runner HloRunnerPjRt... ... compiled and ran in 5.67872s. ** Result with test runner HloRunnerPjRt ** ( f16[3,2] { { 0, 0 }, { 0, 0 }, { 0, 0 } }, f16[3,2,2] { { { 0.57812, 0.09491 }, { 0.14502, 0.01944 } }, { { 0.022766, 0.0037365 }, { 0.1236, 0.016525 } }, { { 0.007988, 0.39746 }, { 0.071594, 0.53564 } } }, s64[3,2] { { 1, 1 }, { 1, 1 }, { 0, 0 } } ) Running HLO module with runner HloRunnerPjRt... E0000 00:00:1779730121.792793 3179622 execution_engine.cc:54] LLVM compilation error: Symbols not found: [ __profc__ZN3xla7codegen10VectorTanhIDv16_fEET_S3_, __profc__ZN3xla7codegen10VectorTanhIDv8_dEET_S3_, __profc__ZN5Eigen12CwiseUnaryOpINS_8internal14scalar_tanh_opIdEEKNS_5ArrayIdLi8ELi1ELi0ELi8ELi1EEEEC2ERS6_RKS3_, __profc__ZN5Eigen12CwiseUnaryOpINS_8internal14scalar_tanh_opIfEEKNS_5ArrayIfLi16ELi1ELi0ELi16ELi1EEEEC2ERS6_RKS3_, __profc__ZN5Eigen15PlainObjectBaseINS_5ArrayIdLi8ELi1ELi0ELi8ELi1EEEE10resizeLikeINS_12CwiseUnaryOpINS_8internal14scalar_t ... ... ... __profc__ZN5Eigen8internal7pstoretIdDv8_dLi16EEEvPT_RKT0_, __profc__ZN5Eigen8internal7pstoretIfDv16_fLi16EEEvPT_RKT0_, __profc__ZN5Eigen8internal7pstoreuIdDv8_dEEvPT_RKT0_, __profc__ZN5Eigen8internal7pstoreuIfDv16_fEEvPT_RKT0_, __profc__ZN5Eigen8internal9ev ... compiled and ran in 1.32801s. INTERNAL: Failed to materialize symbols: { (<xla_jit_dylib_9>, { slice_convert_fusion }) } Failed to execute on HloRunnerPjRt 1/1 runs failed. ``` ## Build command ``` ./configure.py --backend=CUDA bazel build --test_output=all \ --copt=-fprofile-instr-generate \ --copt=-fcoverage-mapping \ --linkopt=-fprofile-instr-generate \ --strip=never \ --compilation_mode=opt \ //xla/tools:run_hlo_module ``` ## Cause `xla/codegen/intrinsic/cpp/cc_to_llvm_ir.bzl` strips sanitizer flags from the C++ it compiles into embedded JIT bitcode but forgets to strip coverage/PGO flags, so `__profc_*` counter references end up in the bitcode and the CPU JIT can't resolve them at runtime. ## Contact - **Email**: `ch395@njit.edu, zhihao.yao@njit.edu, benquike@gmail.com`
0 条评论