Skip to content

Commit 6a31f6b

Browse files
committed
Replace is not None checks for linker flags with booleans
The earlier code would check for requested linker flags using "is not None" instead of True/False. This can result in unwanted flags being passed to the linker in some instances. This change replaces the "is not None" check with simple boolean checks where appropriate.
1 parent d8b4acc commit 6a31f6b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

cuda_core/cuda/core/experimental/_linker.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,17 @@ def _init_nvjitlink(self):
203203
self.formatted_options.append(f"-maxrregcount={self.max_register_count}")
204204
if self.time is not None:
205205
self.formatted_options.append("-time")
206-
if self.verbose is not None:
206+
if self.verbose:
207207
self.formatted_options.append("-verbose")
208-
if self.link_time_optimization is not None and self.link_time_optimization:
208+
if self.link_time_optimization:
209209
self.formatted_options.append("-lto")
210-
if self.ptx is not None:
210+
if self.ptx:
211211
self.formatted_options.append("-ptx")
212212
if self.optimization_level is not None:
213213
self.formatted_options.append(f"-O{self.optimization_level}")
214-
if self.debug is not None and self.debug:
214+
if self.debug:
215215
self.formatted_options.append("-g")
216-
if self.lineinfo is not None and self.lineinfo:
216+
if self.lineinfo:
217217
self.formatted_options.append("-lineinfo")
218218
if self.ftz is not None:
219219
self.formatted_options.append(f"-ftz={'true' if self.ftz else 'false'}")
@@ -273,21 +273,21 @@ def _init_driver(self):
273273
self.option_keys.append(_driver.CUjit_option.CU_JIT_MAX_REGISTERS)
274274
if self.time is not None:
275275
raise ValueError("time option is not supported by the driver API")
276-
if self.verbose is not None:
276+
if self.verbose:
277277
self.formatted_options.append(1)
278278
self.option_keys.append(_driver.CUjit_option.CU_JIT_LOG_VERBOSE)
279-
if self.link_time_optimization is not None:
279+
if self.link_time_optimization:
280280
self.formatted_options.append(1)
281281
self.option_keys.append(_driver.CUjit_option.CU_JIT_LTO)
282-
if self.ptx is not None:
282+
if self.ptx:
283283
raise ValueError("ptx option is not supported by the driver API")
284284
if self.optimization_level is not None:
285285
self.formatted_options.append(self.optimization_level)
286286
self.option_keys.append(_driver.CUjit_option.CU_JIT_OPTIMIZATION_LEVEL)
287-
if self.debug is not None:
287+
if self.debug:
288288
self.formatted_options.append(1)
289289
self.option_keys.append(_driver.CUjit_option.CU_JIT_GENERATE_DEBUG_INFO)
290-
if self.lineinfo is not None:
290+
if self.lineinfo:
291291
self.formatted_options.append(1)
292292
self.option_keys.append(_driver.CUjit_option.CU_JIT_GENERATE_LINE_INFO)
293293
if self.ftz is not None:

0 commit comments

Comments
 (0)