Skip to content

Commit

Permalink
Refactor lib_generator to set library and source paths
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiWang1999 committed Jul 11, 2024
1 parent f5b9999 commit fb78244
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions bitblas/builder/lib_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,9 @@ def get_source_path(self):

def get_lib_path(self):
return self.libpath

def set_lib_path(self, libpath):
self.libpath = libpath

def set_src_path(self, srcpath):
self.srcpath = srcpath
6 changes: 4 additions & 2 deletions bitblas/ops/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,11 @@ def update_runtime_module(self, rt_mod, srcpath=None, libpath=None):
self.function_handle = rt_mod.get_function(rt_mod.entry_name).handle
self.torch_func = to_pytorch_func(rt_mod)
if srcpath is not None:
self.srcpath = srcpath
assert self.lib_generator is not None, "lib_generator is not initialized"
self.lib_generator.set_src_path(srcpath)
if libpath is not None:
self.libpath = libpath
assert self.lib_generator is not None, "lib_generator is not initialized"
self.lib_generator.set_lib_path(libpath)
self.lib = ctypes.CDLL(libpath)
self.lib.init()

Expand Down

0 comments on commit fb78244

Please sign in to comment.