@@ -253,8 +253,8 @@ def cabi_wrap_function(context, lib, fndesc, wrapper_function_name,
253253
254254
255255@global_compiler_lock
256- def compile (pyfunc , sig , debug = False , lineinfo = False , device = True ,
257- fastmath = False , cc = None , opt = True , abi = "c" , abi_info = None ,
256+ def compile (pyfunc , sig , debug = None , lineinfo = False , device = True ,
257+ fastmath = False , cc = None , opt = None , abi = "c" , abi_info = None ,
258258 output = 'ptx' ):
259259 """Compile a Python function to PTX or LTO-IR for a given set of argument
260260 types.
@@ -283,7 +283,7 @@ def compile(pyfunc, sig, debug=False, lineinfo=False, device=True,
283283 :param cc: Compute capability to compile for, as a tuple
284284 ``(MAJOR, MINOR)``. Defaults to ``(5, 0)``.
285285 :type cc: tuple
286- :param opt: Enable optimizations. Defaults to ``True`` .
286+ :param opt: Whether to enable optimizations in the compiled code .
287287 :type opt: bool
288288 :param abi: The ABI for a compiled function - either ``"numba"`` or
289289 ``"c"``. Note that the Numba ABI is not considered stable.
@@ -307,8 +307,11 @@ def compile(pyfunc, sig, debug=False, lineinfo=False, device=True,
307307 if output not in ("ptx" , "ltoir" ):
308308 raise NotImplementedError (f'Unsupported output type: { output } ' )
309309
310+ debug = config .CUDA_DEBUGINFO_DEFAULT if debug is None else debug
311+ opt = (config .OPT != 0 ) if opt is None else opt
312+
310313 if debug and opt :
311- msg = ("debug=True with opt=True (the default) "
314+ msg = ("debug=True with opt=True "
312315 "is not supported by CUDA. This may result in a crash"
313316 " - set debug=False or opt=False." )
314317 warn (NumbaInvalidConfigWarning (msg ))
@@ -359,8 +362,8 @@ def compile(pyfunc, sig, debug=False, lineinfo=False, device=True,
359362 return code , resty
360363
361364
362- def compile_for_current_device (pyfunc , sig , debug = False , lineinfo = False ,
363- device = True , fastmath = False , opt = True ,
365+ def compile_for_current_device (pyfunc , sig , debug = None , lineinfo = False ,
366+ device = True , fastmath = False , opt = None ,
364367 abi = "c" , abi_info = None , output = 'ptx' ):
365368 """Compile a Python function to PTX or LTO-IR for a given signature for the
366369 current device's compute capabilility. This calls :func:`compile` with an
@@ -371,8 +374,8 @@ def compile_for_current_device(pyfunc, sig, debug=False, lineinfo=False,
371374 abi_info = abi_info , output = output )
372375
373376
374- def compile_ptx (pyfunc , sig , debug = False , lineinfo = False , device = False ,
375- fastmath = False , cc = None , opt = True , abi = "numba" , abi_info = None ):
377+ def compile_ptx (pyfunc , sig , debug = None , lineinfo = False , device = False ,
378+ fastmath = False , cc = None , opt = None , abi = "numba" , abi_info = None ):
376379 """Compile a Python function to PTX for a given signature. See
377380 :func:`compile`. The defaults for this function are to compile a kernel
378381 with the Numba ABI, rather than :func:`compile`'s default of compiling a
@@ -382,8 +385,8 @@ def compile_ptx(pyfunc, sig, debug=False, lineinfo=False, device=False,
382385 abi_info = abi_info , output = 'ptx' )
383386
384387
385- def compile_ptx_for_current_device (pyfunc , sig , debug = False , lineinfo = False ,
386- device = False , fastmath = False , opt = True ,
388+ def compile_ptx_for_current_device (pyfunc , sig , debug = None , lineinfo = False ,
389+ device = False , fastmath = False , opt = None ,
387390 abi = "numba" , abi_info = None ):
388391 """Compile a Python function to PTX for a given signature for the current
389392 device's compute capabilility. See :func:`compile_ptx`."""
0 commit comments