-
Notifications
You must be signed in to change notification settings - Fork 1
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
Defines functions as static #130
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the usefulness of this refactoring.
Why do static
for the methods?
Also, RTC usage is covered by the Config option for HIP. Yes, the #ifdef
is ugly but will be dropped once we bump up support to LLVM 18.
The usefulness is for proteus users to be able to call these functions without instantiating a proteus JIT object. The proteus JIT object is always a singleton and is bound to the environment variables and a cache which users may or may not want to use. These functions do not modify (modulo the current error on cuda) do not modify the instance of the class. |
Is this a blocker for your use-case? You can instantiate the singleton and call from the object. I'm afraid that if we start making methods as What's the concern with calling through the object? |
@@ -349,8 +349,10 @@ template <typename ImplT> class JitEngineDevice : public JitEngine { | |||
} | |||
|
|||
static std::unique_ptr<MemoryBuffer> | |||
codegenObject(Module &M, StringRef DeviceArch, bool UseRTC = false) { | |||
return ImplT::codegenObject(M, DeviceArch, UseRTC); | |||
codegenObject(Module &M, StringRef DeviceArch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you need to pass GlobalLinkedBinaries
. Is that because Mneme will independenttly find out those instead of relying on the ProteusPass?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
The question I would first ask is why these methods:
are not static. They are not modifying the object and never access Now for I want to have a generic functionality on proteus that does the following:
and with these modifications I can have a clear path of having my function that does: JIT(LLVMIRModules, KernelName){
auto Mod = linkJITModule(LLVMIRModules);
internalize(Mod, KernelName);
F = Mod.getFunction(KernelName);
setKernelDims(Mod);
setLaunchBoundsForKernel(F)
cleanup(M)
optimizeIR(M)
return codeGenObject(Object)
} With no caches, with no environment variables. I can see why the proteus project requires to have these, but I don't see why another user needs to always generate directories or why he needs to specify environment variables that are not defined in my (third-party) code. If in the a third party user requires all of these, he is free to declare the singleton and get all of it, but this is not imposed by the API it is a choice of the user. If proteus adds some feature that no longer can work with static (for whatever reason) the user will decide whether to update their code or not. I am not that worried about passing additional parameters on these functions. As these operate always on the LLVM Module and on the Object. Even if you add functionality that requires access to the instance. The above functions should still exist. |
I understand your use-case now better. I suggest next time you explain in the comments the purpose of your PR before asking for review. You want to use just a subset of codegen/transform aspects of the proteus functionality, which is fine. As discussed offline, I'd consider that for an interim refactoring stage, but clearly we should refactor again. |
b31d653
to
ef1045a
Compare
No description provided.