Skip to content

Commit c54ec75

Browse files
Use format strings
1 parent 6146027 commit c54ec75

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

llvm/test/lit.cfg.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,16 +316,17 @@ def ptxas_supported_isa_versions(ptxas):
316316
versions.append((int(match.group(1)), int(match.group(2))))
317317
return versions
318318

319+
319320
def ptxas_add_isa_features(major_version, minor_version):
320321
supported_isa_versions = ptxas_supported_isa_versions(ptxas_executable)
321322
if supported_isa_versions:
322323
for major_version, minor_version in supported_isa_versions:
323-
config.available_features.add(
324-
"ptxas-isa-{}.{}".format(major_version, minor_version)
325-
)
324+
config.available_features.add(f"ptxas-isa-{major_version}.{minor_version}")
326325
return
327326
if major_version >= 13:
328-
raise RuntimeError("ptxas {} does not support ISA version listing".format(ptxas_executable))
327+
raise RuntimeError(
328+
f"ptxas {ptxas_executable} does not support ISA version listing"
329+
)
329330
# Use a more pythonic approach: define a list of (major, minor, feature) tuples and iterate.
330331
isa_features = [
331332
(12, 9, "ptxas-isa-8.8"),
@@ -401,25 +402,25 @@ def ptxas_supports_address_size_32(ptxas_executable):
401402
return False
402403
if "Missing .version directive at start of file" in result.stderr:
403404
return True
404-
raise RuntimeError("Unexpected ptxas output: {}".format(result.stderr))
405+
raise RuntimeError(f"Unexpected ptxas output: {result.stderr}")
405406

406407

407408
def enable_ptxas(ptxas_executable):
408409
config.available_features.add("ptxas")
409410
tools.extend(
410411
[
411412
ToolSubst("%ptxas", ptxas_executable),
412-
ToolSubst("%ptxas-verify", "{} -c -".format(ptxas_executable)),
413+
ToolSubst("%ptxas-verify", f"{ptxas_executable} -c -"),
413414
]
414415
)
415416

416417
major_version, minor_version = ptxas_version(ptxas_executable)
417-
config.available_features.add("ptxas-{}.{}".format(major_version, minor_version))
418+
config.available_features.add(f"ptxas-{major_version}.{minor_version}")
418419

419420
ptxas_add_isa_features(major_version, minor_version)
420421

421422
for sm in ptxas_supported_sms(ptxas_executable):
422-
config.available_features.add("ptxas-sm_{}".format(sm))
423+
config.available_features.add(f"ptxas-sm_{sm}")
423424

424425
if ptxas_supports_address_size_32(ptxas_executable):
425426
config.available_features.add("ptxas-ptr32")

0 commit comments

Comments
 (0)