numba-cuda 0.22.0__cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of numba-cuda might be problematic. Click here for more details.
- _numba_cuda_redirector.pth +4 -0
- _numba_cuda_redirector.py +89 -0
- numba_cuda/VERSION +1 -0
- numba_cuda/__init__.py +6 -0
- numba_cuda/_version.py +11 -0
- numba_cuda/numba/cuda/__init__.py +70 -0
- numba_cuda/numba/cuda/_internal/cuda_bf16.py +16394 -0
- numba_cuda/numba/cuda/_internal/cuda_fp16.py +8112 -0
- numba_cuda/numba/cuda/api.py +580 -0
- numba_cuda/numba/cuda/api_util.py +76 -0
- numba_cuda/numba/cuda/args.py +72 -0
- numba_cuda/numba/cuda/bf16.py +397 -0
- numba_cuda/numba/cuda/cache_hints.py +287 -0
- numba_cuda/numba/cuda/cext/__init__.py +2 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpp +159 -0
- numba_cuda/numba/cuda/cext/_devicearray.cpython-312-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_devicearray.h +29 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpp +1098 -0
- numba_cuda/numba/cuda/cext/_dispatcher.cpython-312-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_hashtable.cpp +532 -0
- numba_cuda/numba/cuda/cext/_hashtable.h +135 -0
- numba_cuda/numba/cuda/cext/_helperlib.c +71 -0
- numba_cuda/numba/cuda/cext/_helperlib.cpython-312-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_helpermod.c +82 -0
- numba_cuda/numba/cuda/cext/_pymodule.h +38 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpp +206 -0
- numba_cuda/numba/cuda/cext/_typeconv.cpython-312-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/_typeof.cpp +1159 -0
- numba_cuda/numba/cuda/cext/_typeof.h +19 -0
- numba_cuda/numba/cuda/cext/capsulethunk.h +111 -0
- numba_cuda/numba/cuda/cext/mviewbuf.c +385 -0
- numba_cuda/numba/cuda/cext/mviewbuf.cpython-312-aarch64-linux-gnu.so +0 -0
- numba_cuda/numba/cuda/cext/typeconv.cpp +212 -0
- numba_cuda/numba/cuda/cext/typeconv.hpp +101 -0
- numba_cuda/numba/cuda/cg.py +67 -0
- numba_cuda/numba/cuda/cgutils.py +1294 -0
- numba_cuda/numba/cuda/cloudpickle/__init__.py +21 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle.py +1598 -0
- numba_cuda/numba/cuda/cloudpickle/cloudpickle_fast.py +17 -0
- numba_cuda/numba/cuda/codegen.py +541 -0
- numba_cuda/numba/cuda/compiler.py +1396 -0
- numba_cuda/numba/cuda/core/analysis.py +758 -0
- numba_cuda/numba/cuda/core/annotations/__init__.py +0 -0
- numba_cuda/numba/cuda/core/annotations/pretty_annotate.py +288 -0
- numba_cuda/numba/cuda/core/annotations/type_annotations.py +305 -0
- numba_cuda/numba/cuda/core/base.py +1332 -0
- numba_cuda/numba/cuda/core/boxing.py +1411 -0
- numba_cuda/numba/cuda/core/bytecode.py +728 -0
- numba_cuda/numba/cuda/core/byteflow.py +2346 -0
- numba_cuda/numba/cuda/core/caching.py +744 -0
- numba_cuda/numba/cuda/core/callconv.py +392 -0
- numba_cuda/numba/cuda/core/codegen.py +171 -0
- numba_cuda/numba/cuda/core/compiler.py +199 -0
- numba_cuda/numba/cuda/core/compiler_lock.py +85 -0
- numba_cuda/numba/cuda/core/compiler_machinery.py +497 -0
- numba_cuda/numba/cuda/core/config.py +650 -0
- numba_cuda/numba/cuda/core/consts.py +124 -0
- numba_cuda/numba/cuda/core/controlflow.py +989 -0
- numba_cuda/numba/cuda/core/entrypoints.py +57 -0
- numba_cuda/numba/cuda/core/environment.py +66 -0
- numba_cuda/numba/cuda/core/errors.py +917 -0
- numba_cuda/numba/cuda/core/event.py +511 -0
- numba_cuda/numba/cuda/core/funcdesc.py +330 -0
- numba_cuda/numba/cuda/core/generators.py +387 -0
- numba_cuda/numba/cuda/core/imputils.py +509 -0
- numba_cuda/numba/cuda/core/inline_closurecall.py +1787 -0
- numba_cuda/numba/cuda/core/interpreter.py +3617 -0
- numba_cuda/numba/cuda/core/ir.py +1812 -0
- numba_cuda/numba/cuda/core/ir_utils.py +2638 -0
- numba_cuda/numba/cuda/core/optional.py +129 -0
- numba_cuda/numba/cuda/core/options.py +262 -0
- numba_cuda/numba/cuda/core/postproc.py +249 -0
- numba_cuda/numba/cuda/core/pythonapi.py +1859 -0
- numba_cuda/numba/cuda/core/registry.py +46 -0
- numba_cuda/numba/cuda/core/removerefctpass.py +123 -0
- numba_cuda/numba/cuda/core/rewrites/__init__.py +26 -0
- numba_cuda/numba/cuda/core/rewrites/ir_print.py +91 -0
- numba_cuda/numba/cuda/core/rewrites/registry.py +104 -0
- numba_cuda/numba/cuda/core/rewrites/static_binop.py +41 -0
- numba_cuda/numba/cuda/core/rewrites/static_getitem.py +189 -0
- numba_cuda/numba/cuda/core/rewrites/static_raise.py +100 -0
- numba_cuda/numba/cuda/core/sigutils.py +68 -0
- numba_cuda/numba/cuda/core/ssa.py +498 -0
- numba_cuda/numba/cuda/core/targetconfig.py +330 -0
- numba_cuda/numba/cuda/core/tracing.py +231 -0
- numba_cuda/numba/cuda/core/transforms.py +956 -0
- numba_cuda/numba/cuda/core/typed_passes.py +867 -0
- numba_cuda/numba/cuda/core/typeinfer.py +1950 -0
- numba_cuda/numba/cuda/core/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/core/unsafe/bytes.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/eh.py +67 -0
- numba_cuda/numba/cuda/core/unsafe/refcount.py +98 -0
- numba_cuda/numba/cuda/core/untyped_passes.py +1979 -0
- numba_cuda/numba/cuda/cpython/builtins.py +1153 -0
- numba_cuda/numba/cuda/cpython/charseq.py +1218 -0
- numba_cuda/numba/cuda/cpython/cmathimpl.py +560 -0
- numba_cuda/numba/cuda/cpython/enumimpl.py +103 -0
- numba_cuda/numba/cuda/cpython/iterators.py +167 -0
- numba_cuda/numba/cuda/cpython/listobj.py +1326 -0
- numba_cuda/numba/cuda/cpython/mathimpl.py +499 -0
- numba_cuda/numba/cuda/cpython/numbers.py +1475 -0
- numba_cuda/numba/cuda/cpython/rangeobj.py +289 -0
- numba_cuda/numba/cuda/cpython/slicing.py +322 -0
- numba_cuda/numba/cuda/cpython/tupleobj.py +456 -0
- numba_cuda/numba/cuda/cpython/unicode.py +2865 -0
- numba_cuda/numba/cuda/cpython/unicode_support.py +1597 -0
- numba_cuda/numba/cuda/cpython/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/cpython/unsafe/numbers.py +64 -0
- numba_cuda/numba/cuda/cpython/unsafe/tuple.py +92 -0
- numba_cuda/numba/cuda/cuda_paths.py +691 -0
- numba_cuda/numba/cuda/cudadecl.py +543 -0
- numba_cuda/numba/cuda/cudadrv/__init__.py +14 -0
- numba_cuda/numba/cuda/cudadrv/devicearray.py +954 -0
- numba_cuda/numba/cuda/cudadrv/devices.py +249 -0
- numba_cuda/numba/cuda/cudadrv/driver.py +3238 -0
- numba_cuda/numba/cuda/cudadrv/drvapi.py +435 -0
- numba_cuda/numba/cuda/cudadrv/dummyarray.py +562 -0
- numba_cuda/numba/cuda/cudadrv/enums.py +613 -0
- numba_cuda/numba/cuda/cudadrv/error.py +48 -0
- numba_cuda/numba/cuda/cudadrv/libs.py +220 -0
- numba_cuda/numba/cuda/cudadrv/linkable_code.py +184 -0
- numba_cuda/numba/cuda/cudadrv/mappings.py +14 -0
- numba_cuda/numba/cuda/cudadrv/ndarray.py +26 -0
- numba_cuda/numba/cuda/cudadrv/nvrtc.py +193 -0
- numba_cuda/numba/cuda/cudadrv/nvvm.py +756 -0
- numba_cuda/numba/cuda/cudadrv/rtapi.py +13 -0
- numba_cuda/numba/cuda/cudadrv/runtime.py +34 -0
- numba_cuda/numba/cuda/cudaimpl.py +983 -0
- numba_cuda/numba/cuda/cudamath.py +149 -0
- numba_cuda/numba/cuda/datamodel/__init__.py +7 -0
- numba_cuda/numba/cuda/datamodel/cuda_manager.py +66 -0
- numba_cuda/numba/cuda/datamodel/cuda_models.py +1446 -0
- numba_cuda/numba/cuda/datamodel/cuda_packer.py +224 -0
- numba_cuda/numba/cuda/datamodel/cuda_registry.py +22 -0
- numba_cuda/numba/cuda/datamodel/cuda_testing.py +153 -0
- numba_cuda/numba/cuda/datamodel/manager.py +11 -0
- numba_cuda/numba/cuda/datamodel/models.py +9 -0
- numba_cuda/numba/cuda/datamodel/packer.py +9 -0
- numba_cuda/numba/cuda/datamodel/registry.py +11 -0
- numba_cuda/numba/cuda/datamodel/testing.py +11 -0
- numba_cuda/numba/cuda/debuginfo.py +997 -0
- numba_cuda/numba/cuda/decorators.py +294 -0
- numba_cuda/numba/cuda/descriptor.py +35 -0
- numba_cuda/numba/cuda/device_init.py +155 -0
- numba_cuda/numba/cuda/deviceufunc.py +1021 -0
- numba_cuda/numba/cuda/dispatcher.py +2463 -0
- numba_cuda/numba/cuda/errors.py +72 -0
- numba_cuda/numba/cuda/extending.py +697 -0
- numba_cuda/numba/cuda/flags.py +178 -0
- numba_cuda/numba/cuda/fp16.py +357 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/12/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/12/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.h +5118 -0
- numba_cuda/numba/cuda/include/13/cuda_bf16.hpp +3865 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.h +5363 -0
- numba_cuda/numba/cuda/include/13/cuda_fp16.hpp +3483 -0
- numba_cuda/numba/cuda/initialize.py +24 -0
- numba_cuda/numba/cuda/intrinsics.py +531 -0
- numba_cuda/numba/cuda/itanium_mangler.py +214 -0
- numba_cuda/numba/cuda/kernels/__init__.py +2 -0
- numba_cuda/numba/cuda/kernels/reduction.py +265 -0
- numba_cuda/numba/cuda/kernels/transpose.py +65 -0
- numba_cuda/numba/cuda/libdevice.py +3386 -0
- numba_cuda/numba/cuda/libdevicedecl.py +20 -0
- numba_cuda/numba/cuda/libdevicefuncs.py +1060 -0
- numba_cuda/numba/cuda/libdeviceimpl.py +88 -0
- numba_cuda/numba/cuda/locks.py +19 -0
- numba_cuda/numba/cuda/lowering.py +1980 -0
- numba_cuda/numba/cuda/mathimpl.py +374 -0
- numba_cuda/numba/cuda/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/memory_management/memsys.cu +99 -0
- numba_cuda/numba/cuda/memory_management/memsys.cuh +22 -0
- numba_cuda/numba/cuda/memory_management/nrt.cu +212 -0
- numba_cuda/numba/cuda/memory_management/nrt.cuh +48 -0
- numba_cuda/numba/cuda/memory_management/nrt.py +390 -0
- numba_cuda/numba/cuda/memory_management/nrt_context.py +438 -0
- numba_cuda/numba/cuda/misc/appdirs.py +594 -0
- numba_cuda/numba/cuda/misc/cffiimpl.py +24 -0
- numba_cuda/numba/cuda/misc/coverage_support.py +43 -0
- numba_cuda/numba/cuda/misc/dump_style.py +41 -0
- numba_cuda/numba/cuda/misc/findlib.py +75 -0
- numba_cuda/numba/cuda/misc/firstlinefinder.py +96 -0
- numba_cuda/numba/cuda/misc/gdb_hook.py +240 -0
- numba_cuda/numba/cuda/misc/literal.py +28 -0
- numba_cuda/numba/cuda/misc/llvm_pass_timings.py +412 -0
- numba_cuda/numba/cuda/misc/special.py +94 -0
- numba_cuda/numba/cuda/models.py +56 -0
- numba_cuda/numba/cuda/np/arraymath.py +5130 -0
- numba_cuda/numba/cuda/np/arrayobj.py +7635 -0
- numba_cuda/numba/cuda/np/extensions.py +11 -0
- numba_cuda/numba/cuda/np/linalg.py +3087 -0
- numba_cuda/numba/cuda/np/math/__init__.py +0 -0
- numba_cuda/numba/cuda/np/math/cmathimpl.py +558 -0
- numba_cuda/numba/cuda/np/math/mathimpl.py +487 -0
- numba_cuda/numba/cuda/np/math/numbers.py +1461 -0
- numba_cuda/numba/cuda/np/npdatetime.py +969 -0
- numba_cuda/numba/cuda/np/npdatetime_helpers.py +217 -0
- numba_cuda/numba/cuda/np/npyfuncs.py +1808 -0
- numba_cuda/numba/cuda/np/npyimpl.py +1027 -0
- numba_cuda/numba/cuda/np/numpy_support.py +798 -0
- numba_cuda/numba/cuda/np/polynomial/__init__.py +4 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_core.py +242 -0
- numba_cuda/numba/cuda/np/polynomial/polynomial_functions.py +380 -0
- numba_cuda/numba/cuda/np/ufunc/__init__.py +4 -0
- numba_cuda/numba/cuda/np/ufunc/decorators.py +203 -0
- numba_cuda/numba/cuda/np/ufunc/sigparse.py +68 -0
- numba_cuda/numba/cuda/np/ufunc/ufuncbuilder.py +65 -0
- numba_cuda/numba/cuda/np/ufunc_db.py +1282 -0
- numba_cuda/numba/cuda/np/unsafe/__init__.py +0 -0
- numba_cuda/numba/cuda/np/unsafe/ndarray.py +84 -0
- numba_cuda/numba/cuda/nvvmutils.py +254 -0
- numba_cuda/numba/cuda/printimpl.py +126 -0
- numba_cuda/numba/cuda/random.py +308 -0
- numba_cuda/numba/cuda/reshape_funcs.cu +156 -0
- numba_cuda/numba/cuda/serialize.py +267 -0
- numba_cuda/numba/cuda/simulator/__init__.py +63 -0
- numba_cuda/numba/cuda/simulator/_internal/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/_internal/cuda_bf16.py +2 -0
- numba_cuda/numba/cuda/simulator/api.py +179 -0
- numba_cuda/numba/cuda/simulator/bf16.py +4 -0
- numba_cuda/numba/cuda/simulator/compiler.py +38 -0
- numba_cuda/numba/cuda/simulator/cudadrv/__init__.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devicearray.py +462 -0
- numba_cuda/numba/cuda/simulator/cudadrv/devices.py +122 -0
- numba_cuda/numba/cuda/simulator/cudadrv/driver.py +66 -0
- numba_cuda/numba/cuda/simulator/cudadrv/drvapi.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/dummyarray.py +7 -0
- numba_cuda/numba/cuda/simulator/cudadrv/error.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/libs.py +10 -0
- numba_cuda/numba/cuda/simulator/cudadrv/linkable_code.py +61 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvrtc.py +11 -0
- numba_cuda/numba/cuda/simulator/cudadrv/nvvm.py +32 -0
- numba_cuda/numba/cuda/simulator/cudadrv/runtime.py +22 -0
- numba_cuda/numba/cuda/simulator/dispatcher.py +11 -0
- numba_cuda/numba/cuda/simulator/kernel.py +320 -0
- numba_cuda/numba/cuda/simulator/kernelapi.py +509 -0
- numba_cuda/numba/cuda/simulator/memory_management/__init__.py +4 -0
- numba_cuda/numba/cuda/simulator/memory_management/nrt.py +21 -0
- numba_cuda/numba/cuda/simulator/reduction.py +19 -0
- numba_cuda/numba/cuda/simulator/tests/support.py +4 -0
- numba_cuda/numba/cuda/simulator/vector_types.py +65 -0
- numba_cuda/numba/cuda/simulator_init.py +18 -0
- numba_cuda/numba/cuda/stubs.py +624 -0
- numba_cuda/numba/cuda/target.py +505 -0
- numba_cuda/numba/cuda/testing.py +347 -0
- numba_cuda/numba/cuda/tests/__init__.py +62 -0
- numba_cuda/numba/cuda/tests/benchmarks/__init__.py +0 -0
- numba_cuda/numba/cuda/tests/benchmarks/test_kernel_launch.py +119 -0
- numba_cuda/numba/cuda/tests/cloudpickle_main_class.py +9 -0
- numba_cuda/numba/cuda/tests/core/serialize_usecases.py +113 -0
- numba_cuda/numba/cuda/tests/core/test_itanium_mangler.py +83 -0
- numba_cuda/numba/cuda/tests/core/test_serialize.py +371 -0
- numba_cuda/numba/cuda/tests/cudadrv/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_array_attr.py +147 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_context_stack.py +161 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_array_slicing.py +397 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_auto_context.py +24 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_devicerecord.py +180 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_driver.py +313 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_memory.py +191 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_cuda_ndarray.py +621 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py +247 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_detect.py +100 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_emm_plugins.py +200 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_events.py +53 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_host_alloc.py +72 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_init.py +138 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_inline_ptx.py +43 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_is_fp16.py +15 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linkable_code.py +58 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_linker.py +348 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_managed_alloc.py +128 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_module_callbacks.py +301 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvjitlink.py +174 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvrtc.py +28 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_nvvm_driver.py +185 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_pinned.py +39 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_profiler.py +23 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_reset_device.py +38 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_runtime.py +48 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_select_device.py +44 -0
- numba_cuda/numba/cuda/tests/cudadrv/test_streams.py +127 -0
- numba_cuda/numba/cuda/tests/cudapy/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_usecases.py +231 -0
- numba_cuda/numba/cuda/tests/cudapy/cache_with_cpu_usecases.py +50 -0
- numba_cuda/numba/cuda/tests/cudapy/cg_cache_usecases.py +36 -0
- numba_cuda/numba/cuda/tests/cudapy/complex_usecases.py +116 -0
- numba_cuda/numba/cuda/tests/cudapy/enum_usecases.py +59 -0
- numba_cuda/numba/cuda/tests/cudapy/extensions_usecases.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/jitlink.ptx +28 -0
- numba_cuda/numba/cuda/tests/cudapy/overload_usecases.py +33 -0
- numba_cuda/numba/cuda/tests/cudapy/recursion_usecases.py +104 -0
- numba_cuda/numba/cuda/tests/cudapy/test_alignment.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_analysis.py +1122 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array.py +344 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_alignment.py +268 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_args.py +203 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_methods.py +63 -0
- numba_cuda/numba/cuda/tests/cudapy/test_array_reductions.py +360 -0
- numba_cuda/numba/cuda/tests/cudapy/test_atomics.py +1815 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16.py +599 -0
- numba_cuda/numba/cuda/tests/cudapy/test_bfloat16_bindings.py +377 -0
- numba_cuda/numba/cuda/tests/cudapy/test_blackscholes.py +160 -0
- numba_cuda/numba/cuda/tests/cudapy/test_boolean.py +27 -0
- numba_cuda/numba/cuda/tests/cudapy/test_byteflow.py +98 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cache_hints.py +210 -0
- numba_cuda/numba/cuda/tests/cudapy/test_caching.py +683 -0
- numba_cuda/numba/cuda/tests/cudapy/test_casting.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cffi.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_compiler.py +718 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex.py +370 -0
- numba_cuda/numba/cuda/tests/cudapy/test_complex_kernel.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_const_string.py +142 -0
- numba_cuda/numba/cuda/tests/cudapy/test_constmem.py +178 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cooperative_groups.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_copy_propagate.py +131 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_array_interface.py +438 -0
- numba_cuda/numba/cuda/tests/cudapy/test_cuda_jit_no_types.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_datetime.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debug.py +105 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo.py +978 -0
- numba_cuda/numba/cuda/tests/cudapy/test_debuginfo_types.py +476 -0
- numba_cuda/numba/cuda/tests/cudapy/test_device_func.py +500 -0
- numba_cuda/numba/cuda/tests/cudapy/test_dispatcher.py +820 -0
- numba_cuda/numba/cuda/tests/cudapy/test_enums.py +152 -0
- numba_cuda/numba/cuda/tests/cudapy/test_errors.py +111 -0
- numba_cuda/numba/cuda/tests/cudapy/test_exception.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending.py +1088 -0
- numba_cuda/numba/cuda/tests/cudapy/test_extending_types.py +71 -0
- numba_cuda/numba/cuda/tests/cudapy/test_fastmath.py +265 -0
- numba_cuda/numba/cuda/tests/cudapy/test_flow_control.py +1433 -0
- numba_cuda/numba/cuda/tests/cudapy/test_forall.py +57 -0
- numba_cuda/numba/cuda/tests/cudapy/test_freevar.py +34 -0
- numba_cuda/numba/cuda/tests/cudapy/test_frexp_ldexp.py +69 -0
- numba_cuda/numba/cuda/tests/cudapy/test_globals.py +62 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc.py +474 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scalar.py +167 -0
- numba_cuda/numba/cuda/tests/cudapy/test_gufunc_scheduling.py +92 -0
- numba_cuda/numba/cuda/tests/cudapy/test_idiv.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inline.py +170 -0
- numba_cuda/numba/cuda/tests/cudapy/test_inspect.py +255 -0
- numba_cuda/numba/cuda/tests/cudapy/test_intrinsics.py +1219 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ipc.py +263 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir.py +598 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ir_utils.py +276 -0
- numba_cuda/numba/cuda/tests/cudapy/test_iterators.py +101 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lang.py +68 -0
- numba_cuda/numba/cuda/tests/cudapy/test_laplace.py +123 -0
- numba_cuda/numba/cuda/tests/cudapy/test_libdevice.py +194 -0
- numba_cuda/numba/cuda/tests/cudapy/test_lineinfo.py +220 -0
- numba_cuda/numba/cuda/tests/cudapy/test_localmem.py +173 -0
- numba_cuda/numba/cuda/tests/cudapy/test_make_function_to_jit_function.py +364 -0
- numba_cuda/numba/cuda/tests/cudapy/test_mandel.py +47 -0
- numba_cuda/numba/cuda/tests/cudapy/test_math.py +842 -0
- numba_cuda/numba/cuda/tests/cudapy/test_matmul.py +76 -0
- numba_cuda/numba/cuda/tests/cudapy/test_minmax.py +78 -0
- numba_cuda/numba/cuda/tests/cudapy/test_montecarlo.py +25 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multigpu.py +145 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multiprocessing.py +39 -0
- numba_cuda/numba/cuda/tests/cudapy/test_multithreads.py +82 -0
- numba_cuda/numba/cuda/tests/cudapy/test_nondet.py +53 -0
- numba_cuda/numba/cuda/tests/cudapy/test_operator.py +504 -0
- numba_cuda/numba/cuda/tests/cudapy/test_optimization.py +93 -0
- numba_cuda/numba/cuda/tests/cudapy/test_overload.py +402 -0
- numba_cuda/numba/cuda/tests/cudapy/test_powi.py +128 -0
- numba_cuda/numba/cuda/tests/cudapy/test_print.py +193 -0
- numba_cuda/numba/cuda/tests/cudapy/test_py2_div_issue.py +37 -0
- numba_cuda/numba/cuda/tests/cudapy/test_random.py +117 -0
- numba_cuda/numba/cuda/tests/cudapy/test_record_dtype.py +614 -0
- numba_cuda/numba/cuda/tests/cudapy/test_recursion.py +130 -0
- numba_cuda/numba/cuda/tests/cudapy/test_reduction.py +94 -0
- numba_cuda/numba/cuda/tests/cudapy/test_retrieve_autoconverted_arrays.py +83 -0
- numba_cuda/numba/cuda/tests/cudapy/test_serialize.py +86 -0
- numba_cuda/numba/cuda/tests/cudapy/test_slicing.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm.py +457 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sm_creation.py +233 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ssa.py +454 -0
- numba_cuda/numba/cuda/tests/cudapy/test_stream_api.py +56 -0
- numba_cuda/numba/cuda/tests/cudapy/test_sync.py +277 -0
- numba_cuda/numba/cuda/tests/cudapy/test_tracing.py +200 -0
- numba_cuda/numba/cuda/tests/cudapy/test_transpose.py +90 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeconv.py +333 -0
- numba_cuda/numba/cuda/tests/cudapy/test_typeinfer.py +538 -0
- numba_cuda/numba/cuda/tests/cudapy/test_ufuncs.py +585 -0
- numba_cuda/numba/cuda/tests/cudapy/test_userexc.py +42 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vector_type.py +485 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize.py +312 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_complex.py +23 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_decor.py +183 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_device.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_vectorize_scalar_arg.py +40 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warning.py +206 -0
- numba_cuda/numba/cuda/tests/cudapy/test_warp_ops.py +446 -0
- numba_cuda/numba/cuda/tests/cudasim/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/support.py +9 -0
- numba_cuda/numba/cuda/tests/cudasim/test_cudasim_issues.py +111 -0
- numba_cuda/numba/cuda/tests/data/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/data/cta_barrier.cu +28 -0
- numba_cuda/numba/cuda/tests/data/cuda_include.cu +10 -0
- numba_cuda/numba/cuda/tests/data/error.cu +12 -0
- numba_cuda/numba/cuda/tests/data/include/add.cuh +8 -0
- numba_cuda/numba/cuda/tests/data/jitlink.cu +28 -0
- numba_cuda/numba/cuda/tests/data/jitlink.ptx +49 -0
- numba_cuda/numba/cuda/tests/data/warn.cu +12 -0
- numba_cuda/numba/cuda/tests/doc_examples/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/__init__.py +2 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/functions.cu +54 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/include/mul.cuh +8 -0
- numba_cuda/numba/cuda/tests/doc_examples/ffi/saxpy.cu +14 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cg.py +86 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpointer.py +68 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_cpu_gpu_compat.py +81 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ffi.py +141 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_laplace.py +160 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_matmul.py +180 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_montecarlo.py +119 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_random.py +66 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_reduction.py +80 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_sessionize.py +206 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_ufunc.py +53 -0
- numba_cuda/numba/cuda/tests/doc_examples/test_vecadd.py +76 -0
- numba_cuda/numba/cuda/tests/nocuda/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nocuda/test_dummyarray.py +452 -0
- numba_cuda/numba/cuda/tests/nocuda/test_function_resolution.py +48 -0
- numba_cuda/numba/cuda/tests/nocuda/test_import.py +63 -0
- numba_cuda/numba/cuda/tests/nocuda/test_library_lookup.py +252 -0
- numba_cuda/numba/cuda/tests/nocuda/test_nvvm.py +59 -0
- numba_cuda/numba/cuda/tests/nrt/__init__.py +9 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt.py +387 -0
- numba_cuda/numba/cuda/tests/nrt/test_nrt_refct.py +124 -0
- numba_cuda/numba/cuda/tests/support.py +900 -0
- numba_cuda/numba/cuda/typeconv/__init__.py +4 -0
- numba_cuda/numba/cuda/typeconv/castgraph.py +137 -0
- numba_cuda/numba/cuda/typeconv/rules.py +63 -0
- numba_cuda/numba/cuda/typeconv/typeconv.py +121 -0
- numba_cuda/numba/cuda/types/__init__.py +233 -0
- numba_cuda/numba/cuda/types/__init__.pyi +167 -0
- numba_cuda/numba/cuda/types/abstract.py +9 -0
- numba_cuda/numba/cuda/types/common.py +9 -0
- numba_cuda/numba/cuda/types/containers.py +9 -0
- numba_cuda/numba/cuda/types/cuda_abstract.py +533 -0
- numba_cuda/numba/cuda/types/cuda_common.py +110 -0
- numba_cuda/numba/cuda/types/cuda_containers.py +971 -0
- numba_cuda/numba/cuda/types/cuda_function_type.py +230 -0
- numba_cuda/numba/cuda/types/cuda_functions.py +798 -0
- numba_cuda/numba/cuda/types/cuda_iterators.py +120 -0
- numba_cuda/numba/cuda/types/cuda_misc.py +569 -0
- numba_cuda/numba/cuda/types/cuda_npytypes.py +690 -0
- numba_cuda/numba/cuda/types/cuda_scalars.py +280 -0
- numba_cuda/numba/cuda/types/ext_types.py +101 -0
- numba_cuda/numba/cuda/types/function_type.py +11 -0
- numba_cuda/numba/cuda/types/functions.py +9 -0
- numba_cuda/numba/cuda/types/iterators.py +9 -0
- numba_cuda/numba/cuda/types/misc.py +9 -0
- numba_cuda/numba/cuda/types/npytypes.py +9 -0
- numba_cuda/numba/cuda/types/scalars.py +9 -0
- numba_cuda/numba/cuda/typing/__init__.py +19 -0
- numba_cuda/numba/cuda/typing/arraydecl.py +939 -0
- numba_cuda/numba/cuda/typing/asnumbatype.py +130 -0
- numba_cuda/numba/cuda/typing/bufproto.py +70 -0
- numba_cuda/numba/cuda/typing/builtins.py +1209 -0
- numba_cuda/numba/cuda/typing/cffi_utils.py +219 -0
- numba_cuda/numba/cuda/typing/cmathdecl.py +47 -0
- numba_cuda/numba/cuda/typing/collections.py +138 -0
- numba_cuda/numba/cuda/typing/context.py +782 -0
- numba_cuda/numba/cuda/typing/ctypes_utils.py +125 -0
- numba_cuda/numba/cuda/typing/dictdecl.py +63 -0
- numba_cuda/numba/cuda/typing/enumdecl.py +74 -0
- numba_cuda/numba/cuda/typing/listdecl.py +147 -0
- numba_cuda/numba/cuda/typing/mathdecl.py +158 -0
- numba_cuda/numba/cuda/typing/npdatetime.py +322 -0
- numba_cuda/numba/cuda/typing/npydecl.py +749 -0
- numba_cuda/numba/cuda/typing/setdecl.py +115 -0
- numba_cuda/numba/cuda/typing/templates.py +1446 -0
- numba_cuda/numba/cuda/typing/typeof.py +301 -0
- numba_cuda/numba/cuda/ufuncs.py +746 -0
- numba_cuda/numba/cuda/utils.py +724 -0
- numba_cuda/numba/cuda/vector_types.py +214 -0
- numba_cuda/numba/cuda/vectorizers.py +260 -0
- numba_cuda-0.22.0.dist-info/METADATA +109 -0
- numba_cuda-0.22.0.dist-info/RECORD +487 -0
- numba_cuda-0.22.0.dist-info/WHEEL +6 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE +26 -0
- numba_cuda-0.22.0.dist-info/licenses/LICENSE.numba +24 -0
- numba_cuda-0.22.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from pygments.styles.default import DefaultStyle
|
|
6
|
+
except ImportError:
|
|
7
|
+
msg = "Please install pygments to see highlighted dumps"
|
|
8
|
+
raise ImportError(msg)
|
|
9
|
+
|
|
10
|
+
import numba.cuda.config
|
|
11
|
+
from pygments.styles.manni import ManniStyle
|
|
12
|
+
from pygments.styles.monokai import MonokaiStyle
|
|
13
|
+
from pygments.styles.native import NativeStyle
|
|
14
|
+
|
|
15
|
+
from pygments.token import Name
|
|
16
|
+
|
|
17
|
+
from pygments.style import Style
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def by_colorscheme():
|
|
21
|
+
"""
|
|
22
|
+
Get appropriate style for highlighting according to
|
|
23
|
+
NUMBA_COLOR_SCHEME setting
|
|
24
|
+
"""
|
|
25
|
+
styles = DefaultStyle.styles.copy()
|
|
26
|
+
styles.update(
|
|
27
|
+
{
|
|
28
|
+
Name.Variable: "#888888",
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
custom_default = type("CustomDefaultStyle", (Style,), {"styles": styles})
|
|
32
|
+
|
|
33
|
+
style_map = {
|
|
34
|
+
"no_color": custom_default,
|
|
35
|
+
"dark_bg": MonokaiStyle,
|
|
36
|
+
"light_bg": ManniStyle,
|
|
37
|
+
"blue_bg": NativeStyle,
|
|
38
|
+
"jupyter_nb": DefaultStyle,
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return style_map[numba.cuda.config.COLOR_SCHEME]
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import os
|
|
6
|
+
import re
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def get_lib_dirs():
|
|
10
|
+
"""
|
|
11
|
+
Anaconda specific
|
|
12
|
+
"""
|
|
13
|
+
if sys.platform == "win32":
|
|
14
|
+
# CUDA 12 puts in "bin" directory, whereas CUDA 13 puts in "bin\x64" directory
|
|
15
|
+
dirnames = [
|
|
16
|
+
os.path.join("Library", "bin"),
|
|
17
|
+
os.path.join("Library", "bin", "x64"),
|
|
18
|
+
os.path.join("Library", "nvvm", "bin"),
|
|
19
|
+
os.path.join("Library", "nvvm", "bin", "x64"),
|
|
20
|
+
]
|
|
21
|
+
else:
|
|
22
|
+
dirnames = [
|
|
23
|
+
"lib",
|
|
24
|
+
]
|
|
25
|
+
libdirs = [os.path.join(sys.prefix, x) for x in dirnames]
|
|
26
|
+
return libdirs
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
DLLNAMEMAP = {
|
|
30
|
+
"linux": r"lib%(name)s\.so\.%(ver)s$",
|
|
31
|
+
"linux2": r"lib%(name)s\.so\.%(ver)s$",
|
|
32
|
+
"linux-static": r"lib%(name)s\.a$",
|
|
33
|
+
"darwin": r"lib%(name)s\.%(ver)s\.dylib$",
|
|
34
|
+
"win32": r"%(name)s%(ver)s\.dll$",
|
|
35
|
+
"win32-static": r"%(name)s\.lib$",
|
|
36
|
+
"bsd": r"lib%(name)s\.so\.%(ver)s$",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
RE_VER = r"[0-9]*([_\.][0-9]+)*"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def find_lib(libname, libdir=None, platform=None, static=False):
|
|
43
|
+
platform = platform or sys.platform
|
|
44
|
+
platform = "bsd" if "bsd" in platform else platform
|
|
45
|
+
if static:
|
|
46
|
+
platform = f"{platform}-static"
|
|
47
|
+
if platform not in DLLNAMEMAP:
|
|
48
|
+
# Return empty list if platform name is undefined.
|
|
49
|
+
# Not all platforms define their static library paths.
|
|
50
|
+
return []
|
|
51
|
+
pat = DLLNAMEMAP[platform] % {"name": libname, "ver": RE_VER}
|
|
52
|
+
regex = re.compile(pat)
|
|
53
|
+
return find_file(regex, libdir)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def find_file(pat, libdir=None):
|
|
57
|
+
if libdir is None:
|
|
58
|
+
libdirs = get_lib_dirs()
|
|
59
|
+
elif isinstance(libdir, str):
|
|
60
|
+
libdirs = [
|
|
61
|
+
libdir,
|
|
62
|
+
]
|
|
63
|
+
else:
|
|
64
|
+
libdirs = list(libdir)
|
|
65
|
+
files = []
|
|
66
|
+
for ldir in libdirs:
|
|
67
|
+
try:
|
|
68
|
+
entries = os.listdir(ldir)
|
|
69
|
+
except FileNotFoundError:
|
|
70
|
+
continue
|
|
71
|
+
candidates = [
|
|
72
|
+
os.path.join(ldir, ent) for ent in entries if pat.match(ent)
|
|
73
|
+
]
|
|
74
|
+
files.extend([c for c in candidates if os.path.isfile(c)])
|
|
75
|
+
return files
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
This module provides helper functions to find the first line of a function
|
|
6
|
+
body.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import ast
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class FindDefFirstLine(ast.NodeVisitor):
|
|
13
|
+
"""
|
|
14
|
+
Attributes
|
|
15
|
+
----------
|
|
16
|
+
first_stmt_line : int or None
|
|
17
|
+
This stores the first statement line number if the definition is found.
|
|
18
|
+
Or, ``None`` if the definition is not found.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
def __init__(self, code):
|
|
22
|
+
"""
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
code :
|
|
26
|
+
The function's code object.
|
|
27
|
+
"""
|
|
28
|
+
self._co_name = code.co_name
|
|
29
|
+
self._co_firstlineno = code.co_firstlineno
|
|
30
|
+
self.first_stmt_line = None
|
|
31
|
+
|
|
32
|
+
def _visit_children(self, node):
|
|
33
|
+
for child in ast.iter_child_nodes(node):
|
|
34
|
+
super().visit(child)
|
|
35
|
+
|
|
36
|
+
def visit_FunctionDef(self, node: ast.FunctionDef):
|
|
37
|
+
if node.name == self._co_name:
|
|
38
|
+
# Name of function matches.
|
|
39
|
+
|
|
40
|
+
# The `def` line may match co_firstlineno.
|
|
41
|
+
possible_start_lines = set([node.lineno])
|
|
42
|
+
if node.decorator_list:
|
|
43
|
+
# Has decorators.
|
|
44
|
+
# The first decorator line may match co_firstlineno.
|
|
45
|
+
first_decor = node.decorator_list[0]
|
|
46
|
+
possible_start_lines.add(first_decor.lineno)
|
|
47
|
+
# Does the first lineno match?
|
|
48
|
+
if self._co_firstlineno in possible_start_lines:
|
|
49
|
+
# Yes, we found the function.
|
|
50
|
+
# So, use the first statement line as the first line.
|
|
51
|
+
if node.body:
|
|
52
|
+
first_stmt = node.body[0]
|
|
53
|
+
if _is_docstring(first_stmt):
|
|
54
|
+
# Skip docstring
|
|
55
|
+
first_stmt = node.body[1]
|
|
56
|
+
self.first_stmt_line = first_stmt.lineno
|
|
57
|
+
return
|
|
58
|
+
else:
|
|
59
|
+
# This is probably unreachable.
|
|
60
|
+
# Function body cannot be bare. It must at least have
|
|
61
|
+
# A const string for docstring or a `pass`.
|
|
62
|
+
pass
|
|
63
|
+
self._visit_children(node)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _is_docstring(node):
|
|
67
|
+
if isinstance(node, ast.Expr):
|
|
68
|
+
if isinstance(node.value, ast.Constant) and isinstance(
|
|
69
|
+
node.value.value, str
|
|
70
|
+
):
|
|
71
|
+
return True
|
|
72
|
+
return False
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def get_func_body_first_lineno(pyfunc):
|
|
76
|
+
"""
|
|
77
|
+
Look up the first line of function body using the file in
|
|
78
|
+
``pyfunc.__code__.co_filename``.
|
|
79
|
+
|
|
80
|
+
Returns
|
|
81
|
+
-------
|
|
82
|
+
lineno : int; or None
|
|
83
|
+
The first line number of the function body; or ``None`` if the first
|
|
84
|
+
line cannot be determined.
|
|
85
|
+
"""
|
|
86
|
+
co = pyfunc.__code__
|
|
87
|
+
try:
|
|
88
|
+
with open(co.co_filename) as fin:
|
|
89
|
+
file_content = fin.read()
|
|
90
|
+
except (FileNotFoundError, OSError):
|
|
91
|
+
return
|
|
92
|
+
else:
|
|
93
|
+
tree = ast.parse(file_content)
|
|
94
|
+
finder = FindDefFirstLine(co)
|
|
95
|
+
finder.visit(tree)
|
|
96
|
+
return finder.first_stmt_line
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from llvmlite import ir
|
|
8
|
+
|
|
9
|
+
from numba.cuda import types, config
|
|
10
|
+
from numba.cuda.core import errors
|
|
11
|
+
from numba.cuda import cgutils, utils
|
|
12
|
+
from numba.cuda.misc.special import gdb, gdb_init, gdb_breakpoint
|
|
13
|
+
from numba.cuda.extending import overload, intrinsic
|
|
14
|
+
|
|
15
|
+
_path = os.path.dirname(__file__)
|
|
16
|
+
|
|
17
|
+
_platform = sys.platform
|
|
18
|
+
_unix_like = (
|
|
19
|
+
_platform.startswith("linux")
|
|
20
|
+
or _platform.startswith("darwin")
|
|
21
|
+
or ("bsd" in _platform)
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _confirm_gdb(need_ptrace_attach=True):
|
|
26
|
+
"""
|
|
27
|
+
Set need_ptrace_attach to True/False to indicate whether the ptrace attach
|
|
28
|
+
permission is needed for this gdb use case. Mode 0 (classic) or 1
|
|
29
|
+
(restricted ptrace) is required if need_ptrace_attach is True. See:
|
|
30
|
+
https://www.kernel.org/doc/Documentation/admin-guide/LSM/Yama.rst
|
|
31
|
+
for details on the modes.
|
|
32
|
+
"""
|
|
33
|
+
if not _unix_like:
|
|
34
|
+
msg = "gdb support is only available on unix-like systems"
|
|
35
|
+
raise errors.NumbaRuntimeError(msg)
|
|
36
|
+
gdbloc = config.GDB_BINARY
|
|
37
|
+
if not (os.path.exists(gdbloc) and os.path.isfile(gdbloc)):
|
|
38
|
+
msg = (
|
|
39
|
+
"Is gdb present? Location specified (%s) does not exist. The gdb"
|
|
40
|
+
" binary location can be set using Numba configuration, see: "
|
|
41
|
+
"https://numba.readthedocs.io/en/stable/reference/envvars.html" # noqa: E501
|
|
42
|
+
)
|
|
43
|
+
raise RuntimeError(msg % config.GDB_BINARY)
|
|
44
|
+
# Is Yama being used as a kernel security module and if so is ptrace_scope
|
|
45
|
+
# limited? In this case ptracing non-child processes requires special
|
|
46
|
+
# permission so raise an exception.
|
|
47
|
+
ptrace_scope_file = os.path.join(
|
|
48
|
+
os.sep, "proc", "sys", "kernel", "yama", "ptrace_scope"
|
|
49
|
+
)
|
|
50
|
+
has_ptrace_scope = os.path.exists(ptrace_scope_file)
|
|
51
|
+
if has_ptrace_scope:
|
|
52
|
+
with open(ptrace_scope_file, "rt") as f:
|
|
53
|
+
value = f.readline().strip()
|
|
54
|
+
if need_ptrace_attach and value not in ("0", "1"):
|
|
55
|
+
msg = (
|
|
56
|
+
"gdb can launch but cannot attach to the executing program"
|
|
57
|
+
" because ptrace permissions have been restricted at the "
|
|
58
|
+
"system level by the Linux security module 'Yama'.\n\n"
|
|
59
|
+
"Documentation for this module and the security "
|
|
60
|
+
"implications of making changes to its behaviour can be "
|
|
61
|
+
"found in the Linux Kernel documentation "
|
|
62
|
+
"https://www.kernel.org/doc/Documentation/admin-guide/LSM/Yama.rst" # noqa: E501
|
|
63
|
+
"\n\nDocumentation on how to adjust the behaviour of Yama "
|
|
64
|
+
"on Ubuntu Linux with regards to 'ptrace_scope' can be "
|
|
65
|
+
"found here "
|
|
66
|
+
"https://wiki.ubuntu.com/Security/Features#ptrace."
|
|
67
|
+
)
|
|
68
|
+
raise RuntimeError(msg)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@overload(gdb, target="cuda")
|
|
72
|
+
def hook_gdb(*args):
|
|
73
|
+
_confirm_gdb()
|
|
74
|
+
gdbimpl = gen_gdb_impl(args, True)
|
|
75
|
+
|
|
76
|
+
def impl(*args):
|
|
77
|
+
gdbimpl()
|
|
78
|
+
|
|
79
|
+
return impl
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@overload(gdb_init, target="cuda")
|
|
83
|
+
def hook_gdb_init(*args):
|
|
84
|
+
_confirm_gdb()
|
|
85
|
+
gdbimpl = gen_gdb_impl(args, False)
|
|
86
|
+
|
|
87
|
+
def impl(*args):
|
|
88
|
+
gdbimpl()
|
|
89
|
+
|
|
90
|
+
return impl
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def init_gdb_codegen(
|
|
94
|
+
cgctx, builder, signature, args, const_args, do_break=False
|
|
95
|
+
):
|
|
96
|
+
int8_t = ir.IntType(8)
|
|
97
|
+
int32_t = ir.IntType(32)
|
|
98
|
+
intp_t = ir.IntType(utils.MACHINE_BITS)
|
|
99
|
+
char_ptr = ir.PointerType(ir.IntType(8))
|
|
100
|
+
zero_i32t = int32_t(0)
|
|
101
|
+
|
|
102
|
+
mod = builder.module
|
|
103
|
+
pid = cgutils.alloca_once(builder, int32_t, size=1)
|
|
104
|
+
|
|
105
|
+
# 32bit pid, 11 char max + terminator
|
|
106
|
+
pidstr = cgutils.alloca_once(builder, int8_t, size=12)
|
|
107
|
+
|
|
108
|
+
# str consts
|
|
109
|
+
intfmt = cgctx.insert_const_string(mod, "%d")
|
|
110
|
+
gdb_str = cgctx.insert_const_string(mod, config.GDB_BINARY)
|
|
111
|
+
attach_str = cgctx.insert_const_string(mod, "attach")
|
|
112
|
+
|
|
113
|
+
new_args = []
|
|
114
|
+
# add break point command to known location
|
|
115
|
+
# this command file thing is due to commands attached to a breakpoint
|
|
116
|
+
# requiring an interactive prompt
|
|
117
|
+
# https://sourceware.org/bugzilla/show_bug.cgi?id=10079
|
|
118
|
+
new_args.extend(["-x", os.path.join(_path, "cmdlang.gdb")])
|
|
119
|
+
# issue command to continue execution from sleep function
|
|
120
|
+
new_args.extend(["-ex", "c"])
|
|
121
|
+
# then run the user defined args if any
|
|
122
|
+
if any([not isinstance(x, types.StringLiteral) for x in const_args]):
|
|
123
|
+
raise errors.RequireLiteralValue(const_args)
|
|
124
|
+
new_args.extend([x.literal_value for x in const_args])
|
|
125
|
+
cmdlang = [cgctx.insert_const_string(mod, x) for x in new_args]
|
|
126
|
+
|
|
127
|
+
# insert getpid, getpid is always successful, call without concern!
|
|
128
|
+
fnty = ir.FunctionType(int32_t, tuple())
|
|
129
|
+
getpid = cgutils.get_or_insert_function(mod, fnty, "getpid")
|
|
130
|
+
|
|
131
|
+
# insert snprintf
|
|
132
|
+
# int snprintf(char *str, size_t size, const char *format, ...);
|
|
133
|
+
fnty = ir.FunctionType(int32_t, (char_ptr, intp_t, char_ptr), var_arg=True)
|
|
134
|
+
snprintf = cgutils.get_or_insert_function(mod, fnty, "snprintf")
|
|
135
|
+
|
|
136
|
+
# insert fork
|
|
137
|
+
fnty = ir.FunctionType(int32_t, tuple())
|
|
138
|
+
fork = cgutils.get_or_insert_function(mod, fnty, "fork")
|
|
139
|
+
|
|
140
|
+
# insert execl
|
|
141
|
+
fnty = ir.FunctionType(int32_t, (char_ptr, char_ptr), var_arg=True)
|
|
142
|
+
execl = cgutils.get_or_insert_function(mod, fnty, "execl")
|
|
143
|
+
|
|
144
|
+
# insert sleep
|
|
145
|
+
fnty = ir.FunctionType(int32_t, (int32_t,))
|
|
146
|
+
sleep = cgutils.get_or_insert_function(mod, fnty, "sleep")
|
|
147
|
+
|
|
148
|
+
# insert break point
|
|
149
|
+
fnty = ir.FunctionType(ir.VoidType(), tuple())
|
|
150
|
+
breakpoint = cgutils.get_or_insert_function(
|
|
151
|
+
mod, fnty, "numba_gdb_breakpoint"
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
# do the work
|
|
155
|
+
parent_pid = builder.call(getpid, tuple())
|
|
156
|
+
builder.store(parent_pid, pid)
|
|
157
|
+
pidstr_ptr = builder.gep(pidstr, [zero_i32t], inbounds=True)
|
|
158
|
+
pid_val = builder.load(pid)
|
|
159
|
+
|
|
160
|
+
# call snprintf to write the pid into a char *
|
|
161
|
+
stat = builder.call(snprintf, (pidstr_ptr, intp_t(12), intfmt, pid_val))
|
|
162
|
+
invalid_write = builder.icmp_signed(">", stat, int32_t(12))
|
|
163
|
+
with builder.if_then(invalid_write, likely=False):
|
|
164
|
+
msg = "Internal error: `snprintf` buffer would have overflowed."
|
|
165
|
+
cgctx.call_conv.return_user_exc(builder, RuntimeError, (msg,))
|
|
166
|
+
|
|
167
|
+
# fork, check pids etc
|
|
168
|
+
child_pid = builder.call(fork, tuple())
|
|
169
|
+
fork_failed = builder.icmp_signed("==", child_pid, int32_t(-1))
|
|
170
|
+
with builder.if_then(fork_failed, likely=False):
|
|
171
|
+
msg = "Internal error: `fork` failed."
|
|
172
|
+
cgctx.call_conv.return_user_exc(builder, RuntimeError, (msg,))
|
|
173
|
+
|
|
174
|
+
is_child = builder.icmp_signed("==", child_pid, zero_i32t)
|
|
175
|
+
with builder.if_else(is_child) as (then, orelse):
|
|
176
|
+
with then:
|
|
177
|
+
# is child
|
|
178
|
+
nullptr = ir.Constant(char_ptr, None)
|
|
179
|
+
gdb_str_ptr = builder.gep(gdb_str, [zero_i32t], inbounds=True)
|
|
180
|
+
attach_str_ptr = builder.gep(attach_str, [zero_i32t], inbounds=True)
|
|
181
|
+
cgutils.printf(builder, "Attaching to PID: %s\n", pidstr)
|
|
182
|
+
buf = (gdb_str_ptr, gdb_str_ptr, attach_str_ptr, pidstr_ptr)
|
|
183
|
+
buf = buf + tuple(cmdlang) + (nullptr,)
|
|
184
|
+
builder.call(execl, buf)
|
|
185
|
+
with orelse:
|
|
186
|
+
# is parent
|
|
187
|
+
builder.call(sleep, (int32_t(10),))
|
|
188
|
+
# if breaking is desired, break now
|
|
189
|
+
if do_break is True:
|
|
190
|
+
builder.call(breakpoint, tuple())
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def gen_gdb_impl(const_args, do_break):
|
|
194
|
+
@intrinsic
|
|
195
|
+
def gdb_internal(tyctx):
|
|
196
|
+
function_sig = types.void()
|
|
197
|
+
|
|
198
|
+
def codegen(cgctx, builder, signature, args):
|
|
199
|
+
init_gdb_codegen(
|
|
200
|
+
cgctx, builder, signature, args, const_args, do_break=do_break
|
|
201
|
+
)
|
|
202
|
+
return cgctx.get_constant(types.none, None)
|
|
203
|
+
|
|
204
|
+
return function_sig, codegen
|
|
205
|
+
|
|
206
|
+
return gdb_internal
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@overload(gdb_breakpoint, target="cuda")
|
|
210
|
+
def hook_gdb_breakpoint():
|
|
211
|
+
"""
|
|
212
|
+
Adds the Numba break point into the source
|
|
213
|
+
"""
|
|
214
|
+
if not sys.platform.startswith("linux"):
|
|
215
|
+
raise RuntimeError("gdb is only available on linux")
|
|
216
|
+
bp_impl = gen_bp_impl()
|
|
217
|
+
|
|
218
|
+
def impl():
|
|
219
|
+
bp_impl()
|
|
220
|
+
|
|
221
|
+
return impl
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def gen_bp_impl():
|
|
225
|
+
@intrinsic
|
|
226
|
+
def bp_internal(tyctx):
|
|
227
|
+
function_sig = types.void()
|
|
228
|
+
|
|
229
|
+
def codegen(cgctx, builder, signature, args):
|
|
230
|
+
mod = builder.module
|
|
231
|
+
fnty = ir.FunctionType(ir.VoidType(), tuple())
|
|
232
|
+
breakpoint = cgutils.get_or_insert_function(
|
|
233
|
+
mod, fnty, "numba_gdb_breakpoint"
|
|
234
|
+
)
|
|
235
|
+
builder.call(breakpoint, tuple())
|
|
236
|
+
return cgctx.get_constant(types.none, None)
|
|
237
|
+
|
|
238
|
+
return function_sig, codegen
|
|
239
|
+
|
|
240
|
+
return bp_internal
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: BSD-2-Clause
|
|
3
|
+
|
|
4
|
+
from numba.cuda.extending import overload
|
|
5
|
+
from numba.cuda import types
|
|
6
|
+
from numba.cuda.misc.special import literally, literal_unroll
|
|
7
|
+
from numba.cuda.core.errors import TypingError
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@overload(literally, target="cuda")
|
|
11
|
+
def _ov_literally(obj):
|
|
12
|
+
if isinstance(obj, (types.Literal, types.InitialValue)):
|
|
13
|
+
return lambda obj: obj
|
|
14
|
+
else:
|
|
15
|
+
m = "Invalid use of non-Literal type in literally({})".format(obj)
|
|
16
|
+
raise TypingError(m)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@overload(literal_unroll, target="cuda")
|
|
20
|
+
def literal_unroll_impl(container):
|
|
21
|
+
if isinstance(container, types.Poison):
|
|
22
|
+
m = f"Invalid use of non-Literal type in literal_unroll({container})"
|
|
23
|
+
raise TypingError(m)
|
|
24
|
+
|
|
25
|
+
def impl(container):
|
|
26
|
+
return container
|
|
27
|
+
|
|
28
|
+
return impl
|