You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "kparzysz-quic (via GitHub)" <gi...@apache.org> on 2023/09/20 14:42:19 UTC

[GitHub] [tvm] kparzysz-quic commented on pull request #15761: [Target] LLVM helper functions for any target info

kparzysz-quic commented on PR #15761:
URL: https://github.com/apache/tvm/pull/15761#issuecomment-1727872007

   The idea behind `LLVMInstance` is that all interactions with the LLVM libraries only happen when an object of that class has been created.  You can think of it as if "LLVM instance" was turning on LLVM, and turning it back off when the object is destroyed.  There was a discussion about this a while back, motivated mostly by keeping track of the global state of LLVM.  Long story short, LLVM code has a global state, and modifying the global state in one part of TVM may affect how LLVM works in other parts (e.g. setting up codegen for CPU may affect codegen for GPU).  LLVM instance was created to encapsulate any potential global state changes into the lifetime period of the LLVM instance object.
   
   The functions you wrote can be moved to llvm_instance.cc.  They can create a temporary LLVMInstance object, get LLVMTargetInfo, get the `llvm::Target` object (or `llvm::TargetMachine`) from it, and do their work.
   
   Btw, the functionality you're adding is great, what I'm asking for is to integrate it with the existing code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org