@@ -18,15 +18,17 @@ def _get_llvmlite_version():
1818 """Get llvmlite version as tuple (major, minor, patch)."""
1919 try :
2020 import llvmlite
21+
2122 version_str = llvmlite .__version__
2223 # Parse version string like "0.46.0" or "0.46.0dev"
23- parts = version_str .split ('.' )
24+ parts = version_str .split ("." )
2425 major = int (parts [0 ])
2526 minor = int (parts [1 ])
2627 return (major , minor )
2728 except Exception :
2829 return (0 , 0 )
2930
31+
3032def _check_polymorphic_debug_info_support ():
3133 """Check if CTK and llvmlite support polymorphic debug info.
3234
@@ -38,6 +40,7 @@ def _check_polymorphic_debug_info_support():
3840 """
3941 try :
4042 from numba .cuda .cudadrv import runtime
43+
4144 ctk_version = runtime .get_version ()
4245 llvmlite_version = _get_llvmlite_version ()
4346
@@ -53,17 +56,18 @@ def _check_polymorphic_debug_info_support():
5356 except Exception :
5457 return (False , False )
5558
59+
5660# Check support and determine mode
57- (DEBUG_POLY_SUPPORTED ,
58- DEBUG_POLY_USE_TYPED_CONST ) = _check_polymorphic_debug_info_support ()
61+ (DEBUG_POLY_SUPPORTED , DEBUG_POLY_USE_TYPED_CONST ) = (
62+ _check_polymorphic_debug_info_support ()
63+ )
5964
6065# Set config based on polymorphic debug info support
6166if not hasattr (config , "CUDA_DEBUG_POLY" ):
6267 config .CUDA_DEBUG_POLY = DEBUG_POLY_SUPPORTED
6368if not hasattr (config , "CUDA_DEBUG_POLY_USE_TYPED_CONST" ):
64- config .CUDA_DEBUG_POLY_USE_TYPED_CONST = (
65- DEBUG_POLY_USE_TYPED_CONST
66- )
69+ config .CUDA_DEBUG_POLY_USE_TYPED_CONST = DEBUG_POLY_USE_TYPED_CONST
70+
6771
6872@contextmanager
6973def suspend_emission (builder ):
@@ -699,13 +703,13 @@ def _var_type(self, lltype, size, datamodel=None):
699703 # Polymorphic debug info with DW_TAG_variant
700704 # extraData depends on llvmlite version
701705 if config .CUDA_DEBUG_POLY_USE_TYPED_CONST :
702- metadata_dict ["extraData" ] = (
703- ir . IntType ( 8 )( index )
706+ metadata_dict ["extraData" ] = ir . IntType ( 8 ) (
707+ index
704708 )
705709 else :
706710 # Use metadata node reference
707- metadata_dict ["extraData" ] = (
708- m . add_metadata ( [ir .IntType (8 )(index )])
711+ metadata_dict ["extraData" ] = m . add_metadata (
712+ [ir .IntType (8 )(index )]
709713 )
710714 # Add offset to each variant member
711715 # Offset equals the element's own width
@@ -729,11 +733,14 @@ def _var_type(self, lltype, size, datamodel=None):
729733 {
730734 "tag" : ir .DIToken ("DW_TAG_member" ),
731735 "name" : "discriminator" ,
732- "baseType" : m .add_debug_info ("DIBasicType" , {
733- "name" : "int" ,
734- "size" : _BYTE_SIZE ,
735- "encoding" : ir .DIToken ("DW_ATE_unsigned" )
736- }),
736+ "baseType" : m .add_debug_info (
737+ "DIBasicType" ,
738+ {
739+ "name" : "int" ,
740+ "size" : _BYTE_SIZE ,
741+ "encoding" : ir .DIToken ("DW_ATE_unsigned" ),
742+ },
743+ ),
737744 "size" : _BYTE_SIZE ,
738745 "flags" : ir .DIToken ("DIFlagArtificial" ),
739746 },
@@ -782,7 +789,7 @@ def _var_type(self, lltype, size, datamodel=None):
782789 "elements" : m .add_metadata (meta ),
783790 "size" : maxwidth ,
784791 },
785- is_distinct = True ,
792+ is_distinct = True ,
786793 )
787794 # For other cases, use upstream Numba implementation
788795 return super ()._var_type (lltype , size , datamodel = datamodel )
0 commit comments