Skip to content

Conversation

JoelleJS
Copy link
Contributor

Splits CompileSourceToExecutable into CompileSourceWithDeviceLibsToBc, CodegenBcToRelocatable and LinkRelocatableToExecutable when ZOC is used and outputs the intermediate artifacts:

  • CompileSourceWithDeviceLibsToBc outputs <name>.with-device-libs.ll
  • CodegenBcToRelocatable outputs <name>.relocatable.elf
  • Relocatable is also disassembled, outputs <name>.relocatable.asm
  • LinkRelocatableToExecutable outputs <name>.elf (unchanged)

@JoelleJS JoelleJS changed the title Stepwise compilation and output for ZOC zoc: Stepwise compilation and output Aug 27, 2025
&linked_data_set,
)?;
let data = dataset.get_content(comgr, DataKind::Bc, 0)?;
let data = ptx::bitcode_to_ir(data);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails with Invalid attribute group entry (Producer: 'LLVM19.0.0git' Reader: 'LLVM 17.0.6'), which makes sense. LLVM that ZLUDA links to is (deliberately) 17.0.6, while comgr is whatever ships with HIP (18 or 19). Older LLVM can't read newer bitcode.
Not sure if there is a good solution to this. This should be handled by comgr itself and it does not look like comgr exposes this capability? There's a promising AMD_COMGR_ACTION_DISASSEMBLE_BYTES_TO_SOURCE, but it seems to be used only for input filtering, disassembly seems to be an equivalent of objdump, so ELF/COFF only.

Not sure if there's a good solution is here. On linux one could try to to sniff path to llvm-dis? Start with the comgr path via dlinfo and try to call llvm-dis relative to it (on my machine comgr is in /opt/rocm/lib and llvm-dis is in /opt/rocm/llvm/bin/

If there is no good solution feel free to just comment it out with appropriate note

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.

2 participants