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

EngineBuilder setMCJITMemoryManager and setJITMemoryManager #21222

Closed
llvmbot opened this issue Sep 4, 2014 · 12 comments
Closed

EngineBuilder setMCJITMemoryManager and setJITMemoryManager #21222

llvmbot opened this issue Sep 4, 2014 · 12 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Sep 4, 2014

Bugzilla Link 20848
Resolution FIXED
Resolved on Sep 23, 2014 12:32
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @andykaylor,@echristo,@lhames

Extended Description

Should setJITMemoryManager be eliminated, renamed or merged with setMCJITMemoryManager?
it seems it is used not to provide a JIT memory manager (no JIT now) but to install an alternative one which is used by MCJIT.
Same for MCJMM and JMM.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 4, 2014

assigned to @lhames

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 9, 2014

After rereading the code, I think that MCJMM could take over JMM role, since JITMemoryManager inherits from RTDyldMemoryManager and MCJMM could store both memory managers. That would save a whole lot of code in ExecutionEngine.cpp and ExecutionEngine.h which seem to serve no purpose now.

@lhames
Copy link
Contributor

lhames commented Sep 9, 2014

Very good point. Thanks for looking in to this Yaron!

I think setJITMemoryManager and the JMM member should be removed. Do you already have a patch for this? If not, I'm happy to get to work on it.

  • Lang.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Sep 9, 2014

Hi Lang, I did not make a patch for it, wasn't initially 100% sure there isn't some use to the two different managers somewhere.

While at it, I also noticed JITMemoryManager (the class) is not not used anymore in any "core" llvm but only in lli.cpp and in llvm-jitlistener.cpp with the comment:

// FIXME: This is using the default legacy JITMemoryManager because it
// supports poison memory. At some point, we'll need to update this to
// use an MCJIT-specific memory manager. It might be nice to have the
// poison memory option there too.

The poison option is just memset

  if (PoisonMemory) {
    memset(MemRange+1, 0xCD, MemRange->BlockSize-sizeof(*MemRange));
  }

I'm not sure if lli.cpp really needs JITMemoryManager or could use another memory manager.

JITMemoryManager may be removed after fixing the two uses above.

@lhames
Copy link
Contributor

lhames commented Sep 9, 2014

Hi Yaron,

I'm going through all the references at the moment. I don't think lli needs JITMemoryManager. I'm not sure about llvm-jitlistener.cpp - that's up next.

Hopefully I'll have a patch for this shortly.

  • Lang.

@lhames
Copy link
Contributor

lhames commented Sep 9, 2014

llvm-jiteventlistener.cpp doesn't currently compile. That's concerning.

Andy - Do you whether anyone at Intel is maintaining this code?

Cheers,
Lang.

@andykaylor
Copy link
Contributor

I know that Arch Robinson (arch.robinson@intel.com) has been actively fixing regressions in the IntetlJITEventListener code as they arise because he is using it with the Julia language. One of his changes from a few weeks ago included a change to llvm-jiteventlistener.cpp. He's not an llvm committer, so Elena Demikhovsky committed the change on his befalf.

I'm not sure how long this will continue to be a priority for Arch. He's more attached to Julia than he is to llvm, and even that isn't his only responsibility. In general, if any problems arise that are specific to the IntelJITEventListener code, you should probably continue referring them to me and I'll figure out who I can send them to. I know that the VTune Analyzer team wants to keep this working, but unless it breaks they won't have anyone assigned to it and other than llvm interface changes that code has been fairly stable.

There doesn't seem to be sufficient coverage in the automated tests to catch even build failures for the JIT event listener stuff. The llvm-jiteventlistener tool was meant to help with that, but both the oprofile and the Intel-specific JIT event listeners only get enable with special build flags.

@echristo
Copy link
Contributor

echristo commented Sep 9, 2014

Could probably use a jit listener so you can get the size of a generated set of text and make sure it's > 0 for a quick and dirty "is it working" sort of thing.

@lhames
Copy link
Contributor

lhames commented Sep 12, 2014

@lhames
Copy link
Contributor

lhames commented Sep 12, 2014

Hi Andy,

The attached patch removes support for the JITMemoryManager from LLVM.

In the process it removes the use of poison values for allocated/freed memory in the llvm-jitlistener utility (since the RTDyldMemoryManagers don't support poison yet). As far as I can tell that will not actually impact the running of this utility, since nobody seems to be checking for the poison value. Does that sound right?

If there's no problem with the changes to llvm-jitlistener, I'll go ahead and commit this.

Cheers,
Lang.

@andykaylor
Copy link
Contributor

Sounds good to me. The patch also looks right. My only suggestion would be to change the error checking so that instead of reporting an error if remote jit is requested without -use-mcjit you just have remote jit implicitly set use-mcjit.

@lhames
Copy link
Contributor

lhames commented Sep 23, 2014

Thanks for the review Andy.

I've removed the JITMemoryManager class and its associated APIs in r218316 (with some fallout that was cleaned up in r218317 and r218318).

Since using MCJIT is now the default I've left the error message in to catch the case where the user explicitly requests -force-interpreter -remote-mcjit.

Cheers,
Lang.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 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
Projects
None yet
Development

No branches or pull requests

4 participants