[Issue]: HIPRTC linking error causes test failure, HIPRTC compile/link behavior seems to have changed
Open
@domcharrier is already working on this.
Since Apr 19, 2024.
Assessment
This issue has not been assessed yet.
Description
Problem Description
TODOs before releasing 6.1.0 sources (to release/rocm-6.1.0 branch) and binaries to test.pypi.org:
- Investigate
hiprtclinker error when testingexamples/1_Advanced/hiprtc_linking_with_llvm_ir.py.
Full error log:
============================= test session starts ==============================
platform linux -- Python 3.8.17, pytest-8.1.1, pluggy-1.4.0 -- /var/jenkins_home/workspace/ROCm-LLVM-Python/Codegen/recipes/python_cython/llvmc/rocm-llvm-python-release-repo/_venv/bin/python3
cachedir: .pytest_cache
rootdir: /var/jenkins_home/workspace/ROCm-LLVM-Python/Codegen/recipes/python_cython/llvmc/rocm-llvm-python-release-repo
collecting ... collected 6 items
examples/test_examples.py::test_python_examples[0_Basic/list_targets.py] PASSED [ 16%]
examples/test_examples.py::test_python_examples[0_Basic/parse_llvm_bitcode.py] PASSED [ 33%]
examples/test_examples.py::test_python_examples[1_Advanced/amd_comgr_hip_to_llvm_ir.py] PASSED [ 50%]
examples/test_examples.py::test_python_examples[1_Advanced/hiprtc_amd_comgr_get_jit_kernel_metadata.py] PASSED [ 66%]
examples/test_examples.py::test_python_examples[1_Advanced/hiprtc_hip_to_llvm_ir.py] PASSED [ 83%]
examples/test_examples.py::test_python_examples[1_Advanced/hiprtc_linking_with_llvm_ir.py] FAILED [100%]
=================================== FAILURES ===================================
_______ test_python_examples[1_Advanced/hiprtc_linking_with_llvm_ir.py] ________
example = '1_Advanced/hiprtc_linking_with_llvm_ir.py'
@pytest.mark.parametrize("example", python_examples)
def test_python_examples(example):
abspath = os.path.join(os.path.dirname(__file__), example)
> runpy.run_path(abspath, run_name="__test__")
examples/test_examples.py:65:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/root/miniconda3/envs/py38/lib/python3.8/runpy.py:265: in run_path
return _run_module_code(code, init_globals, run_name,
/root/miniconda3/envs/py38/lib/python3.8/runpy.py:97: in _run_module_code
_run_code(code, mod_globals, init_globals,
/root/miniconda3/envs/py38/lib/python3.8/runpy.py:87: in _run_code
exec(code, run_globals)
examples/1_Advanced/hiprtc_linking_with_llvm_ir.py:285: in <module>
with HiprtcLinker() as linker, HipProgram(
examples/1_Advanced/hiprtc_linking_with_llvm_ir.py:128: in __init__
self._compile_to_llvm_bc(arch)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <__test__.HipProgram object at 0x7fcc2669e1c0>
arch = b'gfx90a:sramecc+:xnack-'
def _compile_to_llvm_bc(self, arch: str):
self.prog = hip_check(
hiprtc.hiprtcCreateProgram(self.hip_source, self.name, 0, [], [])
)
cflags = [b"--offload-arch=" + arch, b"-fgpu-rdc"]
(err,) = hiprtc.hiprtcCompileProgram(self.prog, len(cflags), cflags)
if err != hiprtc.hiprtcResult.HIPRTC_SUCCESS:
log_size = hip_check(hiprtc.hiprtcGetProgramLogSize(self.prog))
log = bytearray(log_size)
hip_check(hiprtc.hiprtcGetProgramLog(self.prog, log))
> raise RuntimeError(log.decode())
E RuntimeError: ld.lld: error: undefined hidden symbol: scale_op(float*, float)
E >>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
E >>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
E
E ld.lld: error: undefined hidden symbol: print_val(float*)
E >>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
E >>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
examples/1_Advanced/hiprtc_linking_with_llvm_ir.py:140: RuntimeError
=========================== short test summary info ============================
FAILED examples/test_examples.py::test_python_examples[1_Advanced/hiprtc_linking_with_llvm_ir.py] - RuntimeError: ld.lld: error: undefined hidden symbol: scale_op(float*, float)
>>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
>>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
ld.lld: error: undefined hidden symbol: print_val(float*)
>>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
>>> referenced by /tmp/comgr-1031d3/input/LLVMBitcode.bc.o:(scale)
========================= 1 failed, 5 passed in 2.21s ==========================
Operating System
Ubuntu 20.04
CPU
Any
GPU
AMD Instinct MI210
ROCm Version
ROCm 6.1.0
Steps to Reproduce
Reporter is package author and maintainer.
- Dominant language
- Cython
- Stars
- 6
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ROCm/rocm-llvm-python
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
ROCm/rocm-llvm-python#3 ·
-
Streamline licensing Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
ROCm/rocm-llvm-python#2 ·