Get reason for invalid IR from libnvvm

I am writing a codegen backend for an existing compiler, the backend targets NVVM IR and uses libnvvm to transform it to ptx. However, when trying to compile the core library of the language, the codegen creates invalid IR. However, it generates over 200 kloc of LLVM IR, so going through it manually is a bit impossible. Is it somehow possible to find out what part of the IR is invalid using libnvvm?

this may be of interest:

nvvmResult nvvmGetProgramLog ( nvvmProgram prog, char* buffer )

Get the Compiler/Verifier Message.



NVVM program program.


Compilation/Verification log.


Sorry i should have added that i tried that method already, i tried it:

  • before compilation (but after adding modules)
  • after verification
  • after compilation

and it yielded an empty string every time. I think that method is more for after you compile if any warnings happened. Perhaps i did it wrong? i don’t think i did, the samples seem to suggest that its more for warnings or errors after compilation instead of IR verification

@Robert_Crovella I apologize, i had a really stupid bug, i was using a vector (a rust Vec) to collect the compiler log, which worked fine except i use the vector capacity and forgot to set the length, so the vector showed up as empty. Now it gives me useful info, sorry for the trouble :)

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.