Skip to content

Commit

Permalink
continue addressing reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-b-miller committed Aug 22, 2024
1 parent a8c38b6 commit 421fdfb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
24 changes: 7 additions & 17 deletions numba_cuda/numba/cuda/cudadrv/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2695,7 +2695,11 @@ def add_cu_file(self, path):
self.add_cu(cu, os.path.basename(path))

def add_file_guess_ext(self, path_or_code):
"""Add a file to the link, guessing its type from its extension."""
"""
Add a file or LinkableCode object to the link. If a file is
passed, the type will be inferred from the extension. A LinkableCode
object represents a file already in memory.
"""
if isinstance(path_or_code, str):
ext = pathlib.Path(path_or_code).suffix
if ext == '':
Expand All @@ -2704,6 +2708,8 @@ def add_file_guess_ext(self, path_or_code):
)
elif ext == '.cu':
self.add_cu_file(path_or_code)
elif ext == ".ltoir":
self.add_file(path_or_code, "ltoir")
else:
kind = FILE_EXTENSION_MAP.get(ext, None)
if kind is None:
Expand Down Expand Up @@ -3093,22 +3099,6 @@ def add_data(self, data, kind, name):
except NvJitLinkError as e:
raise LinkerError from e

def add_cu(self, cu, name):
with driver.get_active_context() as ac:
dev = driver.get_device(ac.devnum)
cc = dev.compute_capability

ptx, log = nvrtc.compile(cu, name, cc)

if config.DUMP_ASSEMBLY:
print(("ASSEMBLY %s" % name).center(80, "-"))
print(ptx)
print("=" * 80)

# Link the program's PTX using the normal linker mechanism
ptx_name = os.path.splitext(name)[0] + ".ptx"
self.add_ptx(ptx.encode(), ptx_name)

def complete(self):
try:
cubin = self._linker.get_linked_cubin()
Expand Down
2 changes: 1 addition & 1 deletion numba_cuda/numba/cuda/cudadrv/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
# LTO IR
CU_JIT_INPUT_LTO_IR = 5

CU_JIT_NUM_INPUT_TYPES = 7
CU_JIT_NUM_INPUT_TYPES = 6


# Online compiler and linker options
Expand Down

0 comments on commit 421fdfb

Please sign in to comment.