nvmath-python 0.9.0__cp314-cp314-win_amd64.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.
- nvmath/__init__.pxd +0 -0
- nvmath/__init__.py +45 -0
- nvmath/_internal/__init__.py +0 -0
- nvmath/_internal/attribute_ifc_factory.py +330 -0
- nvmath/_internal/layout.py +70 -0
- nvmath/_internal/templates.py +383 -0
- nvmath/_utils.py +150 -0
- nvmath/bindings/__init__.py +51 -0
- nvmath/bindings/_internal/__init__.pxd +0 -0
- nvmath/bindings/_internal/__init__.py +0 -0
- nvmath/bindings/_internal/cublas.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cublas.pxd +530 -0
- nvmath/bindings/_internal/cublasLt.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cublasLt.pxd +59 -0
- nvmath/bindings/_internal/cublasMp.pxd +52 -0
- nvmath/bindings/_internal/cudss.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cudss.pxd +47 -0
- nvmath/bindings/_internal/cufft.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cufft.pxd +70 -0
- nvmath/bindings/_internal/cufftMp.pxd +77 -0
- nvmath/bindings/_internal/curand.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/curand.pxd +42 -0
- nvmath/bindings/_internal/cusolver.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cusolver.pxd +15 -0
- nvmath/bindings/_internal/cusolverDn.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cusolverDn.pxd +406 -0
- nvmath/bindings/_internal/cusparse.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cusparse.pxd +277 -0
- nvmath/bindings/_internal/cusparseLt.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cusparseLt.pxd +48 -0
- nvmath/bindings/_internal/cutensor.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/cutensor.pxd +58 -0
- nvmath/bindings/_internal/mathdx.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/mathdx.pxd +116 -0
- nvmath/bindings/_internal/nvshmem.pxd +29 -0
- nvmath/bindings/_internal/utils.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/_internal/utils.pxd +179 -0
- nvmath/bindings/_internal/utils.pyi +10 -0
- nvmath/bindings/cublas.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cublas.pxd +558 -0
- nvmath/bindings/cublas.pyi +746 -0
- nvmath/bindings/cublasLt.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cublasLt.pxd +109 -0
- nvmath/bindings/cublasLt.pyi +1337 -0
- nvmath/bindings/cublasMp.pxd +85 -0
- nvmath/bindings/cublasMp.pyi +219 -0
- nvmath/bindings/cudss.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cudss.pxd +86 -0
- nvmath/bindings/cudss.pyi +282 -0
- nvmath/bindings/cufft.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cufft.pxd +118 -0
- nvmath/bindings/cufft.pyi +241 -0
- nvmath/bindings/cufftMp.pxd +124 -0
- nvmath/bindings/cufftMp.pyi +260 -0
- nvmath/bindings/curand.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/curand.pxd +71 -0
- nvmath/bindings/curand.pyi +159 -0
- nvmath/bindings/cusolver.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cusolver.pxd +62 -0
- nvmath/bindings/cusolver.pyi +242 -0
- nvmath/bindings/cusolverDn.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cusolverDn.pxd +430 -0
- nvmath/bindings/cusolverDn.pyi +416 -0
- nvmath/bindings/cusparse.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cusparse.pxd +338 -0
- nvmath/bindings/cusparse.pyi +659 -0
- nvmath/bindings/cusparseLt.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cusparseLt.pxd +99 -0
- nvmath/bindings/cusparseLt.pyi +198 -0
- nvmath/bindings/cutensor.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cutensor.pxd +98 -0
- nvmath/bindings/cutensor.pyi +294 -0
- nvmath/bindings/cycublas.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycublas.pxd +684 -0
- nvmath/bindings/cycublasLt.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycublasLt.pxd +1055 -0
- nvmath/bindings/cycublasMp.pxd +183 -0
- nvmath/bindings/cycudss.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycudss.pxd +224 -0
- nvmath/bindings/cycufft.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycufft.pxd +326 -0
- nvmath/bindings/cycufftMp.pxd +334 -0
- nvmath/bindings/cycurand.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycurand.pxd +146 -0
- nvmath/bindings/cycusolver.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycusolver.pxd +154 -0
- nvmath/bindings/cycusolverDn.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycusolverDn.pxd +446 -0
- nvmath/bindings/cycusparse.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycusparse.pxd +470 -0
- nvmath/bindings/cycusparseLt.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycusparseLt.pxd +150 -0
- nvmath/bindings/cycutensor.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cycutensor.pxd +192 -0
- nvmath/bindings/cymathdx.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/cymathdx.pxd +552 -0
- nvmath/bindings/cynvshmem.pxd +126 -0
- nvmath/bindings/mathdx.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/mathdx.pxd +182 -0
- nvmath/bindings/mathdx.pyi +1244 -0
- nvmath/bindings/nvpl/__init__.pxd +0 -0
- nvmath/bindings/nvpl/__init__.py +13 -0
- nvmath/bindings/nvpl/_internal/__init__.pxd +0 -0
- nvmath/bindings/nvpl/_internal/__init__.py +0 -0
- nvmath/bindings/nvpl/_internal/blas.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/nvpl/_internal/blas.pxd +125 -0
- nvmath/bindings/nvpl/_internal/fft.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/nvpl/_internal/fft.pxd +36 -0
- nvmath/bindings/nvpl/blas.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/nvpl/blas.pxd +85 -0
- nvmath/bindings/nvpl/blas.pyi +122 -0
- nvmath/bindings/nvpl/cyblas.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/nvpl/cyblas.pxd +166 -0
- nvmath/bindings/nvpl/cyfft.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/nvpl/cyfft.pxd +92 -0
- nvmath/bindings/nvpl/fft.cp314-win_amd64.pyd +0 -0
- nvmath/bindings/nvpl/fft.pxd +100 -0
- nvmath/bindings/nvpl/fft.pyi +100 -0
- nvmath/bindings/nvshmem.pxd +54 -0
- nvmath/bindings/nvshmem.pyi +179 -0
- nvmath/device/__init__.py +21 -0
- nvmath/device/_deprecated.py +33 -0
- nvmath/device/common.py +313 -0
- nvmath/device/common_backend.py +131 -0
- nvmath/device/common_cuda.py +201 -0
- nvmath/device/common_numba.py +310 -0
- nvmath/device/common_opaque_tensor.py +201 -0
- nvmath/device/cublasdx.py +1805 -0
- nvmath/device/cublasdx_backend.py +807 -0
- nvmath/device/cublasdx_numba.py +1612 -0
- nvmath/device/cufftdx.py +510 -0
- nvmath/device/cufftdx_backend.py +196 -0
- nvmath/device/cufftdx_numba.py +196 -0
- nvmath/device/curand_kernel.py +9147 -0
- nvmath/device/cusolverdx.py +2690 -0
- nvmath/device/cusolverdx_backend.py +440 -0
- nvmath/device/cusolverdx_numba.py +1624 -0
- nvmath/device/llvm_array.py +29 -0
- nvmath/device/random.py +445 -0
- nvmath/device/random_helpers.py +23 -0
- nvmath/device/random_states.py +187 -0
- nvmath/device/types.py +147 -0
- nvmath/device/vector_types_numba.py +203 -0
- nvmath/distributed/__init__.py +205 -0
- nvmath/distributed/_internal/__init__.py +0 -0
- nvmath/distributed/_internal/nvshmem.py +302 -0
- nvmath/distributed/_internal/tensor_ifc.py +67 -0
- nvmath/distributed/_internal/tensor_ifc_cupy.py +62 -0
- nvmath/distributed/_internal/tensor_ifc_host_device.py +165 -0
- nvmath/distributed/_internal/tensor_ifc_numpy.py +41 -0
- nvmath/distributed/_internal/tensor_ifc_torch.py +141 -0
- nvmath/distributed/_internal/tensor_wrapper.py +78 -0
- nvmath/distributed/_utils.py +167 -0
- nvmath/distributed/distribution.py +770 -0
- nvmath/distributed/fft/__init__.py +7 -0
- nvmath/distributed/fft/_configuration.py +79 -0
- nvmath/distributed/fft/fft.py +2801 -0
- nvmath/distributed/linalg/__init__.py +12 -0
- nvmath/distributed/linalg/_internal/__init__.py +3 -0
- nvmath/distributed/linalg/_internal/epilog_protocol.py +496 -0
- nvmath/distributed/linalg/_internal/matmul_desc_ifc.py +28 -0
- nvmath/distributed/linalg/advanced/__init__.py +8 -0
- nvmath/distributed/linalg/advanced/_configuration.py +166 -0
- nvmath/distributed/linalg/advanced/matmulmod.py +2908 -0
- nvmath/distributed/process_group.py +408 -0
- nvmath/distributed/reshape/__init__.py +6 -0
- nvmath/distributed/reshape/_configuration.py +39 -0
- nvmath/distributed/reshape/reshape.py +1256 -0
- nvmath/fft/__init__.py +7 -0
- nvmath/fft/_configuration.py +208 -0
- nvmath/fft/_exec_utils.py +109 -0
- nvmath/fft/_helpers.py +237 -0
- nvmath/fft/fft.py +2903 -0
- nvmath/internal/__init__.pxd +3 -0
- nvmath/internal/__init__.py +10 -0
- nvmath/internal/_bindings.cp314-win_amd64.pyd +0 -0
- nvmath/internal/_bindings.pxd +12 -0
- nvmath/internal/_device_utils.py +54 -0
- nvmath/internal/enum_utils.py +142 -0
- nvmath/internal/formatters.py +87 -0
- nvmath/internal/mem_limit.py +51 -0
- nvmath/internal/memory.cp314-win_amd64.pyd +0 -0
- nvmath/internal/memory.pxd +10 -0
- nvmath/internal/memory.pyi +46 -0
- nvmath/internal/ndbuffer/__init__.pxd +3 -0
- nvmath/internal/ndbuffer/__init__.py +7 -0
- nvmath/internal/ndbuffer/copy_kernel/args.h +34 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/array_view.h +52 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/elementwise.h +68 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/grid_indexer.h +69 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/transposed.h +240 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/type_utils.h +39 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/utils.h +132 -0
- nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/vec.h +159 -0
- nvmath/internal/ndbuffer/copy_kernel/elementwise.h +53 -0
- nvmath/internal/ndbuffer/copy_kernel/transposed.h +58 -0
- nvmath/internal/ndbuffer/copy_kernel.cp314-win_amd64.pyd +0 -0
- nvmath/internal/ndbuffer/copy_kernel.pxd +9 -0
- nvmath/internal/ndbuffer/copy_kernel.pyi +9 -0
- nvmath/internal/ndbuffer/data_layout.cp314-win_amd64.pyd +0 -0
- nvmath/internal/ndbuffer/data_layout.pxd +72 -0
- nvmath/internal/ndbuffer/data_layout.pyi +23 -0
- nvmath/internal/ndbuffer/jit.cp314-win_amd64.pyd +0 -0
- nvmath/internal/ndbuffer/jit.pxd +7 -0
- nvmath/internal/ndbuffer/jit.pyi +6 -0
- nvmath/internal/ndbuffer/ndbuffer.cp314-win_amd64.pyd +0 -0
- nvmath/internal/ndbuffer/ndbuffer.pxd +36 -0
- nvmath/internal/ndbuffer/ndbuffer.pyi +41 -0
- nvmath/internal/ndbuffer/package_utils.cp314-win_amd64.pyd +0 -0
- nvmath/internal/ndbuffer/package_utils.pxd +11 -0
- nvmath/internal/ndbuffer/package_utils.pyi +12 -0
- nvmath/internal/package_ifc.py +147 -0
- nvmath/internal/package_ifc_cuda.py +49 -0
- nvmath/internal/package_ifc_cupy.py +49 -0
- nvmath/internal/package_ifc_torch.py +31 -0
- nvmath/internal/package_wrapper.py +14 -0
- nvmath/internal/tensor_ifc.py +194 -0
- nvmath/internal/tensor_ifc_cupy.py +241 -0
- nvmath/internal/tensor_ifc_ndbuffer.py +153 -0
- nvmath/internal/tensor_ifc_numpy.py +183 -0
- nvmath/internal/tensor_ifc_torch.py +176 -0
- nvmath/internal/tensor_wrapper.py +157 -0
- nvmath/internal/typemaps.py +162 -0
- nvmath/internal/utils.py +771 -0
- nvmath/linalg/__init__.py +46 -0
- nvmath/linalg/_internal/__init__.py +3 -0
- nvmath/linalg/_internal/algo_cap_ifc.py +82 -0
- nvmath/linalg/_internal/algo_config_ifc.py +43 -0
- nvmath/linalg/_internal/batch.py +217 -0
- nvmath/linalg/_internal/enum_to_tuples.py +64 -0
- nvmath/linalg/_internal/epilog_protocol.py +766 -0
- nvmath/linalg/_internal/layout.py +624 -0
- nvmath/linalg/_internal/matmul_desc_ifc.py +28 -0
- nvmath/linalg/_internal/matmul_pref_ifc.py +27 -0
- nvmath/linalg/_internal/matrix_layout_ifc.py +26 -0
- nvmath/linalg/_internal/typemaps.py +144 -0
- nvmath/linalg/_internal/utils.py +134 -0
- nvmath/linalg/advanced/__init__.py +8 -0
- nvmath/linalg/advanced/_algorithmmod.py +149 -0
- nvmath/linalg/advanced/_configuration.py +349 -0
- nvmath/linalg/advanced/helpers/__init__.py +5 -0
- nvmath/linalg/advanced/helpers/matmul.py +1348 -0
- nvmath/linalg/advanced/matmulmod.py +3937 -0
- nvmath/linalg/generic/__init__.py +43 -0
- nvmath/linalg/generic/_configuration/__init__.py +37 -0
- nvmath/linalg/generic/_configuration/layout.py +263 -0
- nvmath/linalg/generic/_configuration/match.py +609 -0
- nvmath/linalg/generic/_configuration/qualifiers.py +494 -0
- nvmath/linalg/generic/_configuration/wrap.py +217 -0
- nvmath/linalg/generic/_dtype.py +15 -0
- nvmath/linalg/generic/matmulmod.py +1060 -0
- nvmath/memory.py +282 -0
- nvmath/sparse/__init__.py +38 -0
- nvmath/sparse/_internal/__init__.py +21 -0
- nvmath/sparse/_internal/common_utils.py +144 -0
- nvmath/sparse/_internal/cudss_config_ifc.py +741 -0
- nvmath/sparse/_internal/cudss_data_ifc.py +399 -0
- nvmath/sparse/_internal/cudss_utils.py +445 -0
- nvmath/sparse/_internal/cusparse_utils.py +382 -0
- nvmath/sparse/_internal/sparse_bsc_ifc.py +300 -0
- nvmath/sparse/_internal/sparse_bsr_ifc.py +303 -0
- nvmath/sparse/_internal/sparse_coo_ifc.py +254 -0
- nvmath/sparse/_internal/sparse_csc_ifc.py +266 -0
- nvmath/sparse/_internal/sparse_csr_ifc.py +266 -0
- nvmath/sparse/_internal/sparse_dia_ifc.py +239 -0
- nvmath/sparse/_internal/sparse_format_helpers.py +601 -0
- nvmath/sparse/_internal/sparse_tensor_ifc.py +121 -0
- nvmath/sparse/_internal/sparse_ust_ifc.py +146 -0
- nvmath/sparse/_internal/utils.py +56 -0
- nvmath/sparse/advanced/__init__.py +7 -0
- nvmath/sparse/advanced/_configuration.py +230 -0
- nvmath/sparse/advanced/direct_solver.py +1884 -0
- nvmath/sparse/generic/__init__.py +7 -0
- nvmath/sparse/generic/_configuration.py +129 -0
- nvmath/sparse/generic/_helpers.py +137 -0
- nvmath/sparse/generic/_thunks.py +21 -0
- nvmath/sparse/generic/matmulmod.py +2426 -0
- nvmath/sparse/ust/__init__.py +7 -0
- nvmath/sparse/ust/_converters.py +378 -0
- nvmath/sparse/ust/_drawer.py +552 -0
- nvmath/sparse/ust/_emitter.py +553 -0
- nvmath/sparse/ust/_jit.py +212 -0
- nvmath/sparse/ust/_kernel.py +346 -0
- nvmath/sparse/ust/_semiring.py +71 -0
- nvmath/sparse/ust/_utils.py +102 -0
- nvmath/sparse/ust/interfaces/__init__.py +0 -0
- nvmath/sparse/ust/interfaces/torch_interface.py +476 -0
- nvmath/sparse/ust/semiring_ops.py +71 -0
- nvmath/sparse/ust/tensor.py +1027 -0
- nvmath/sparse/ust/tensor_drawer.py +552 -0
- nvmath/sparse/ust/tensor_emitter.py +558 -0
- nvmath/sparse/ust/tensor_format.py +935 -0
- nvmath/sparse/ust/tensor_jit.py +212 -0
- nvmath/sparse/ust/tensor_kernel.py +348 -0
- nvmath/sparse/ust/tensor_utils.py +380 -0
- nvmath/tensor/__init__.py +6 -0
- nvmath/tensor/_configuration.py +95 -0
- nvmath/tensor/_internal/__init__.py +3 -0
- nvmath/tensor/_internal/cutensor_config_ifc.py +247 -0
- nvmath/tensor/_internal/cutensor_utils.py +162 -0
- nvmath/tensor/_internal/data.py +43 -0
- nvmath/tensor/_internal/einsum_parser.py +444 -0
- nvmath/tensor/_internal/typemaps.py +96 -0
- nvmath/tensor/contract.py +1861 -0
- nvmath_python-0.9.0.dist-info/METADATA +127 -0
- nvmath_python-0.9.0.dist-info/RECORD +309 -0
- nvmath_python-0.9.0.dist-info/WHEEL +5 -0
- nvmath_python-0.9.0.dist-info/licenses/LICENSE +177 -0
- nvmath_python-0.9.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from numba import cuda
|
|
6
|
+
from numba.core import cgutils, typing
|
|
7
|
+
from numba.cuda.cudaimpl import lower_constant
|
|
8
|
+
from numba.cuda.cudaimpl import registry as cuda_registry
|
|
9
|
+
from numba.cuda.extending import overload, overload_method, typeof_impl
|
|
10
|
+
from numba.cuda.models import register_model
|
|
11
|
+
from numba.extending import types, utils
|
|
12
|
+
|
|
13
|
+
from nvmath.device.common_cuda import get_default_code_type
|
|
14
|
+
from nvmath.device.cufftdx import FFT, compile_fft_execute
|
|
15
|
+
|
|
16
|
+
from .common_numba import (
|
|
17
|
+
NUMBA_FE_TYPES_TO_NUMBA_IR,
|
|
18
|
+
EmptyStructModel,
|
|
19
|
+
declare_cabi_device,
|
|
20
|
+
get_array_ptr,
|
|
21
|
+
overload_type_attribute,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
_FFT_DEFINITION_ARGS = [
|
|
25
|
+
"size",
|
|
26
|
+
"precision",
|
|
27
|
+
"fft_type",
|
|
28
|
+
"execution",
|
|
29
|
+
"sm",
|
|
30
|
+
"direction",
|
|
31
|
+
"ffts_per_block",
|
|
32
|
+
"elements_per_thread",
|
|
33
|
+
"real_fft_options",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
_FFT_COMPILED_ARGS = [
|
|
37
|
+
"value_type",
|
|
38
|
+
"input_type",
|
|
39
|
+
"output_type",
|
|
40
|
+
"storage_size",
|
|
41
|
+
"shared_memory_size",
|
|
42
|
+
"stride",
|
|
43
|
+
"block_dim",
|
|
44
|
+
"implicit_type_batching",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class FFTType(types.Type):
|
|
49
|
+
"""
|
|
50
|
+
Type class associated with the `cufftdx.FFT`.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
def __init__(self, fft: FFT):
|
|
54
|
+
assert isinstance(fft, FFT)
|
|
55
|
+
self._fft = fft
|
|
56
|
+
attributes = [f"{attr}={getattr(fft, attr)}" for attr in _FFT_DEFINITION_ARGS if getattr(fft, attr)]
|
|
57
|
+
attributes.sort()
|
|
58
|
+
|
|
59
|
+
self.name = "FFT(" + ",".join(attributes) + ")"
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def fft(self) -> FFT:
|
|
63
|
+
return self._fft
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
register_model(FFTType)(EmptyStructModel)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@lower_constant(FFTType)
|
|
70
|
+
def constant_dummy(context, builder, typ, pyval):
|
|
71
|
+
struct_ptr = cgutils.create_struct_proxy(typ)(context, builder)
|
|
72
|
+
return struct_ptr._getvalue()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@typeof_impl.register(FFT)
|
|
76
|
+
def typeof_fft_numba(val: FFT, c: typing.Context) -> FFTType:
|
|
77
|
+
return FFTType(val)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
for attribute in _FFT_DEFINITION_ARGS + _FFT_COMPILED_ARGS:
|
|
81
|
+
overload_type_attribute(FFTType, "fft", attribute)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# Numba does not support method overload or variadic arguments, so we using
|
|
85
|
+
# default values as a workaround
|
|
86
|
+
# https://github.com/numba/numba/issues/9980
|
|
87
|
+
# https://github.com/numba/numba/issues/9979
|
|
88
|
+
# https://github.com/numba/numba/issues/10143
|
|
89
|
+
@overload_method(FFTType, "execute", jit_options={"forceinline": True}, strict=False)
|
|
90
|
+
def ol_fft_numba_execute(fft_numba: FFTType, _arg1, _arg2=None):
|
|
91
|
+
return ol_fft_numba(fft_numba, _arg1, _arg2)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@overload_method(FFTType, "__call__", strict=False)
|
|
95
|
+
def ol_fft_numba_call(fft_numba: FFTType, _arg1, _arg2=None):
|
|
96
|
+
return ol_fft_numba(fft_numba, _arg1, _arg2)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def ol_fft_numba(fft_numba: FFTType, _arg1, _arg2=None):
|
|
100
|
+
if _arg2 in {None, types.Omitted(None)}:
|
|
101
|
+
return lambda _, smem, _arg2=None: _fft_type___call__(_, smem)
|
|
102
|
+
else:
|
|
103
|
+
return lambda _, thread_data, smem: _fft_type___call__(_, thread_data, smem)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# TODO: use overload_method when supported
|
|
107
|
+
def _fft_type___call__(*args):
|
|
108
|
+
raise Exception("Stub for overloads")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
@overload(_fft_type___call__, jit_options={"forceinline": True}, strict=False)
|
|
112
|
+
def ol_fft_type___call___rmem(
|
|
113
|
+
fft_numba: FFTType,
|
|
114
|
+
thread_data: types.Array,
|
|
115
|
+
):
|
|
116
|
+
if not isinstance(fft_numba, FFTType):
|
|
117
|
+
return
|
|
118
|
+
if not isinstance(thread_data, types.Array):
|
|
119
|
+
return
|
|
120
|
+
FFT = fft_numba.fft
|
|
121
|
+
value_type = NUMBA_FE_TYPES_TO_NUMBA_IR[FFT.value_type]
|
|
122
|
+
if thread_data.dtype != value_type:
|
|
123
|
+
return
|
|
124
|
+
|
|
125
|
+
code, symbol = compile_fft_execute(
|
|
126
|
+
FFT,
|
|
127
|
+
code_type=get_default_code_type(),
|
|
128
|
+
execute_api="shared_memory" if FFT.execution == "Block" else None,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
lto = cuda.LTOIR(code.data)
|
|
132
|
+
|
|
133
|
+
sig = types.void(types.CPointer(value_type))
|
|
134
|
+
fft_device_func = declare_cabi_device(symbol, sig, link=lto)
|
|
135
|
+
|
|
136
|
+
def impl(_, thread_data):
|
|
137
|
+
tptr = get_array_ptr(thread_data)
|
|
138
|
+
fft_device_func(tptr)
|
|
139
|
+
|
|
140
|
+
return impl
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@overload(_fft_type___call__, jit_options={"forceinline": True}, strict=False)
|
|
144
|
+
def ol_fft_type___call___smem(
|
|
145
|
+
fft_numba: FFTType,
|
|
146
|
+
thread_data: types.Array,
|
|
147
|
+
smem: types.Array,
|
|
148
|
+
):
|
|
149
|
+
if not isinstance(fft_numba, FFTType):
|
|
150
|
+
return
|
|
151
|
+
if not isinstance(thread_data, types.Array):
|
|
152
|
+
return
|
|
153
|
+
if not isinstance(smem, types.Array):
|
|
154
|
+
return
|
|
155
|
+
FFT = fft_numba.fft
|
|
156
|
+
value_type = NUMBA_FE_TYPES_TO_NUMBA_IR[FFT.value_type]
|
|
157
|
+
if smem.dtype != value_type:
|
|
158
|
+
return
|
|
159
|
+
if thread_data.dtype != value_type:
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
code, symbol = compile_fft_execute(
|
|
163
|
+
FFT,
|
|
164
|
+
code_type=get_default_code_type(),
|
|
165
|
+
execute_api="register_memory" if FFT.execution == "Block" else None,
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
lto = cuda.LTOIR(code.data)
|
|
169
|
+
|
|
170
|
+
value_type = NUMBA_FE_TYPES_TO_NUMBA_IR[FFT.value_type]
|
|
171
|
+
sig = types.void(types.CPointer(value_type), types.CPointer(value_type))
|
|
172
|
+
fft_device_func = declare_cabi_device(symbol, sig, link=lto)
|
|
173
|
+
|
|
174
|
+
def impl(_, thread_data, smem):
|
|
175
|
+
tptr = get_array_ptr(thread_data)
|
|
176
|
+
sptr = get_array_ptr(smem)
|
|
177
|
+
fft_device_func(tptr, sptr)
|
|
178
|
+
|
|
179
|
+
return impl
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
# __call__ overload is not supported by numba, however adding this overload
|
|
183
|
+
# kind of activates proper behaviour and works like magic.
|
|
184
|
+
# Issue reference: https://github.com/numba/numba/issues/5885
|
|
185
|
+
# TODO: remove once supported
|
|
186
|
+
@cuda_registry.lower(FFTType, FFTType, types.VarArg(types.Any))
|
|
187
|
+
def method_impl(context, builder, sig, args):
|
|
188
|
+
typing_context = context.typing_context
|
|
189
|
+
fnty = typing_context.resolve_value_type(ol_fft_numba_call)
|
|
190
|
+
sig = fnty.get_call_type(typing_context, sig.args, {})
|
|
191
|
+
sig = sig.replace(pysig=utils.pysignature(ol_fft_numba_call))
|
|
192
|
+
|
|
193
|
+
call = context.get_function(fnty, sig)
|
|
194
|
+
# Link dependent library
|
|
195
|
+
context.add_linking_libs(getattr(call, "libs", ()))
|
|
196
|
+
return call(builder, args)
|