Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ORC addModuleSet / addModule API cleanup #30244

Closed
lhames opened this issue Nov 3, 2016 · 3 comments
Closed

ORC addModuleSet / addModule API cleanup #30244

lhames opened this issue Nov 3, 2016 · 3 comments
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug orcjit

Comments

@lhames
Copy link
Contributor

lhames commented Nov 3, 2016

Bugzilla Link 30896
Resolution INVALID
Resolved on May 22, 2019 13:18
Version trunk
OS All
CC @weliveindetail

Extended Description

There are a number of changes that could be made to addModuleSet to simplify it, and the ORC layer classes in general.

Background:

addModuleSet is the ORC layer concept's method for adding IR to the JIT. It takes a collection of IR Modules (using a template type for the collection), a memory manager (a template type that must support dereference) and a symbol resolver (also a template type that supports dereference).

The choice to have addModuleSet add a set of modules, rather than a single module, was so that those modules could be co-located in memory. This would enable short jumps and references between these modules. In practice, any code wanting to achieve this effect is likely to be better off doing one of two things:

(1) If all modules to be co-located are IR modules they are likely to be better off being pre-linked into a single module (this enables better IR optimization), or

(2) If the modules to be added are a mix of objects and IR modules (in which case they can't be added in a single addModuleSet call), they can be added using multiple calls using the same memory manager. As long as no symbol resolution calls are made by the client between the addModuleSet calls, none of the generated objects will be finalized, so the code can be co-located by the memory manager during finalization.

Proposed changes:

(1) Move from addModuleSet to addModule (singular).

(2) Use shared_ptr as the module type, rather than a template argument -- once the collection type is not a template argument, it makes sense to pin the memory ownership model to shared in order to remove this template argument entirely.

A lot of ORC layer code is playing type-erasure games to be able to hold the module pointer types, so fixing this to shared_ptr would simply not just addModuleSet but the surrounding layer code.

@weliveindetail
Copy link
Contributor

Orc moved from addModuleSet to addModule with Release 5.0, I belief. Also, loads of templates became obsolete with increased use of std::function for callbacks.

Is there any particular work todo in this ticket? If so, please roughly describe a potential approach. Thanks!

@lhames
Copy link
Contributor Author

lhames commented May 22, 2019

Nope -- I think this is dead. Thanks for catching that!

@lhames
Copy link
Contributor Author

lhames commented Nov 26, 2021

mentioned in issue llvm/llvm-bugzilla-archive#31103

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla invalid Resolved as invalid, i.e. not a bug orcjit
Projects
None yet
Development

No branches or pull requests

2 participants