Skip to content

Commit 0b57b05

Browse files
committed
fix(core.utils): key helper passes target_type to ProgramOptions.as_bytes
cuda.core's ProgramOptions.as_bytes learned a target_type parameter so that NVVM compilations can inject -gen-lto for ltoir targets. Forward target_type from make_program_cache_key so the canonical option bytes reflect this when available, falling back to the one-argument signature on older builds. Part of issue #178.
1 parent 8421a22 commit 0b57b05

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cuda_core/cuda/core/utils/_program_cache.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,13 @@ def make_program_cache_key(
221221
)
222222

223223
backend = _backend_for_code_type(code_type)
224-
option_bytes = options.as_bytes(backend) # list[bytes], canonical form
224+
# ProgramOptions.as_bytes may or may not accept target_type depending on
225+
# the cuda.core version; pass it through when it does so the key reflects
226+
# any target-specific flags (e.g. NVVM's ``-gen-lto`` for ltoir).
227+
try:
228+
option_bytes = options.as_bytes(backend, target_type)
229+
except TypeError:
230+
option_bytes = options.as_bytes(backend)
225231
names = tuple(sorted(str(n) for n in name_expressions))
226232

227233
hasher = hashlib.blake2b(digest_size=32)

0 commit comments

Comments
 (0)