nvmath-python 1.0.0__cp314-cp314t-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.
Files changed (332) hide show
  1. nvmath/__init__.pxd +0 -0
  2. nvmath/__init__.py +45 -0
  3. nvmath/_internal/__init__.py +0 -0
  4. nvmath/_internal/attribute_ifc_factory.py +330 -0
  5. nvmath/_internal/layout.py +70 -0
  6. nvmath/_internal/templates.py +130 -0
  7. nvmath/_internal/threadsafe.py +106 -0
  8. nvmath/_internal/utils.py +43 -0
  9. nvmath/_internal/workspace.py +490 -0
  10. nvmath/_utils.py +147 -0
  11. nvmath/bindings/__init__.py +60 -0
  12. nvmath/bindings/_internal/__init__.pxd +0 -0
  13. nvmath/bindings/_internal/__init__.py +0 -0
  14. nvmath/bindings/_internal/common_types.pxd +31 -0
  15. nvmath/bindings/_internal/cublas.cp314t-win_amd64.pyd +0 -0
  16. nvmath/bindings/_internal/cublas.pxd +530 -0
  17. nvmath/bindings/_internal/cublasLt.cp314t-win_amd64.pyd +0 -0
  18. nvmath/bindings/_internal/cublasLt.pxd +59 -0
  19. nvmath/bindings/_internal/cublasMp.pxd +52 -0
  20. nvmath/bindings/_internal/cudss.cp314t-win_amd64.pyd +0 -0
  21. nvmath/bindings/_internal/cudss.pxd +54 -0
  22. nvmath/bindings/_internal/cufft.cp314t-win_amd64.pyd +0 -0
  23. nvmath/bindings/_internal/cufft.pxd +70 -0
  24. nvmath/bindings/_internal/cufftMp.pxd +77 -0
  25. nvmath/bindings/_internal/curand.cp314t-win_amd64.pyd +0 -0
  26. nvmath/bindings/_internal/curand.pxd +42 -0
  27. nvmath/bindings/_internal/cusolver.cp314t-win_amd64.pyd +0 -0
  28. nvmath/bindings/_internal/cusolver.pxd +15 -0
  29. nvmath/bindings/_internal/cusolverDn.cp314t-win_amd64.pyd +0 -0
  30. nvmath/bindings/_internal/cusolverDn.pxd +406 -0
  31. nvmath/bindings/_internal/cusolverMp.pxd +71 -0
  32. nvmath/bindings/_internal/cusolverSp.cp314t-win_amd64.pyd +0 -0
  33. nvmath/bindings/_internal/cusolverSp.pxd +75 -0
  34. nvmath/bindings/_internal/cusparse.cp314t-win_amd64.pyd +0 -0
  35. nvmath/bindings/_internal/cusparse.pxd +471 -0
  36. nvmath/bindings/_internal/cusparseLt.cp314t-win_amd64.pyd +0 -0
  37. nvmath/bindings/_internal/cusparseLt.pxd +48 -0
  38. nvmath/bindings/_internal/cutensor.cp314t-win_amd64.pyd +0 -0
  39. nvmath/bindings/_internal/cutensor.pxd +58 -0
  40. nvmath/bindings/_internal/mathdx.cp314t-win_amd64.pyd +0 -0
  41. nvmath/bindings/_internal/mathdx.pxd +116 -0
  42. nvmath/bindings/_internal/nvshmem.pxd +29 -0
  43. nvmath/bindings/_internal/utils.cp314t-win_amd64.pyd +0 -0
  44. nvmath/bindings/_internal/utils.pxd +174 -0
  45. nvmath/bindings/_internal/utils.pyi +10 -0
  46. nvmath/bindings/cublas.cp314t-win_amd64.pyd +0 -0
  47. nvmath/bindings/cublas.pxd +558 -0
  48. nvmath/bindings/cublas.pyi +812 -0
  49. nvmath/bindings/cublasLt.cp314t-win_amd64.pyd +0 -0
  50. nvmath/bindings/cublasLt.pxd +109 -0
  51. nvmath/bindings/cublasLt.pyi +1461 -0
  52. nvmath/bindings/cublasMp.pxd +85 -0
  53. nvmath/bindings/cublasMp.pyi +267 -0
  54. nvmath/bindings/cudss.cp314t-win_amd64.pyd +0 -0
  55. nvmath/bindings/cudss.pxd +98 -0
  56. nvmath/bindings/cudss.pyi +443 -0
  57. nvmath/bindings/cufft.cp314t-win_amd64.pyd +0 -0
  58. nvmath/bindings/cufft.pxd +118 -0
  59. nvmath/bindings/cufft.pyi +301 -0
  60. nvmath/bindings/cufftMp.pxd +124 -0
  61. nvmath/bindings/cufftMp.pyi +326 -0
  62. nvmath/bindings/curand.cp314t-win_amd64.pyd +0 -0
  63. nvmath/bindings/curand.pxd +71 -0
  64. nvmath/bindings/curand.pyi +189 -0
  65. nvmath/bindings/cusolver.cp314t-win_amd64.pyd +0 -0
  66. nvmath/bindings/cusolver.pxd +62 -0
  67. nvmath/bindings/cusolver.pyi +320 -0
  68. nvmath/bindings/cusolverDn.cp314t-win_amd64.pyd +0 -0
  69. nvmath/bindings/cusolverDn.pxd +430 -0
  70. nvmath/bindings/cusolverDn.pyi +422 -0
  71. nvmath/bindings/cusolverMp.pxd +98 -0
  72. nvmath/bindings/cusolverMp.pyi +114 -0
  73. nvmath/bindings/cusolverSp.cp314t-win_amd64.pyd +0 -0
  74. nvmath/bindings/cusolverSp.pxd +95 -0
  75. nvmath/bindings/cusolverSp.pyi +70 -0
  76. nvmath/bindings/cusparse.cp314t-win_amd64.pyd +0 -0
  77. nvmath/bindings/cusparse.pxd +546 -0
  78. nvmath/bindings/cusparse.pyi +1017 -0
  79. nvmath/bindings/cusparseLt.cp314t-win_amd64.pyd +0 -0
  80. nvmath/bindings/cusparseLt.pxd +99 -0
  81. nvmath/bindings/cusparseLt.pyi +252 -0
  82. nvmath/bindings/cutensor.cp314t-win_amd64.pyd +0 -0
  83. nvmath/bindings/cutensor.pxd +98 -0
  84. nvmath/bindings/cutensor.pyi +324 -0
  85. nvmath/bindings/cycublas.cp314t-win_amd64.pyd +0 -0
  86. nvmath/bindings/cycublas.pxd +664 -0
  87. nvmath/bindings/cycublasLt.cp314t-win_amd64.pyd +0 -0
  88. nvmath/bindings/cycublasLt.pxd +1045 -0
  89. nvmath/bindings/cycublasMp.pxd +171 -0
  90. nvmath/bindings/cycudss.cp314t-win_amd64.pyd +0 -0
  91. nvmath/bindings/cycudss.pxd +277 -0
  92. nvmath/bindings/cycufft.cp314t-win_amd64.pyd +0 -0
  93. nvmath/bindings/cycufft.pxd +333 -0
  94. nvmath/bindings/cycufftMp.pxd +342 -0
  95. nvmath/bindings/cycurand.cp314t-win_amd64.pyd +0 -0
  96. nvmath/bindings/cycurand.pxd +141 -0
  97. nvmath/bindings/cycusolver.cp314t-win_amd64.pyd +0 -0
  98. nvmath/bindings/cycusolver.pxd +137 -0
  99. nvmath/bindings/cycusolverDn.cp314t-win_amd64.pyd +0 -0
  100. nvmath/bindings/cycusolverDn.pxd +443 -0
  101. nvmath/bindings/cycusolverMp.pxd +107 -0
  102. nvmath/bindings/cycusolverSp.cp314t-win_amd64.pyd +0 -0
  103. nvmath/bindings/cycusolverSp.pxd +93 -0
  104. nvmath/bindings/cycusparse.cp314t-win_amd64.pyd +0 -0
  105. nvmath/bindings/cycusparse.pxd +679 -0
  106. nvmath/bindings/cycusparseLt.cp314t-win_amd64.pyd +0 -0
  107. nvmath/bindings/cycusparseLt.pxd +135 -0
  108. nvmath/bindings/cycutensor.cp314t-win_amd64.pyd +0 -0
  109. nvmath/bindings/cycutensor.pxd +189 -0
  110. nvmath/bindings/cymathdx.cp314t-win_amd64.pyd +0 -0
  111. nvmath/bindings/cymathdx.pxd +552 -0
  112. nvmath/bindings/cynvshmem.pxd +118 -0
  113. nvmath/bindings/mathdx.cp314t-win_amd64.pyd +0 -0
  114. nvmath/bindings/mathdx.pxd +182 -0
  115. nvmath/bindings/mathdx.pyi +1562 -0
  116. nvmath/bindings/nvpl/__init__.pxd +0 -0
  117. nvmath/bindings/nvpl/__init__.py +13 -0
  118. nvmath/bindings/nvpl/_internal/__init__.pxd +0 -0
  119. nvmath/bindings/nvpl/_internal/__init__.py +0 -0
  120. nvmath/bindings/nvpl/_internal/blas.cp314t-win_amd64.pyd +0 -0
  121. nvmath/bindings/nvpl/_internal/blas.pxd +237 -0
  122. nvmath/bindings/nvpl/_internal/fft.cp314t-win_amd64.pyd +0 -0
  123. nvmath/bindings/nvpl/_internal/fft.pxd +36 -0
  124. nvmath/bindings/nvpl/blas.cp314t-win_amd64.pyd +0 -0
  125. nvmath/bindings/nvpl/blas.pxd +131 -0
  126. nvmath/bindings/nvpl/blas.pyi +168 -0
  127. nvmath/bindings/nvpl/cyblas.cp314t-win_amd64.pyd +0 -0
  128. nvmath/bindings/nvpl/cyblas.pxd +280 -0
  129. nvmath/bindings/nvpl/cyfft.cp314t-win_amd64.pyd +0 -0
  130. nvmath/bindings/nvpl/cyfft.pxd +93 -0
  131. nvmath/bindings/nvpl/fft.cp314t-win_amd64.pyd +0 -0
  132. nvmath/bindings/nvpl/fft.pxd +100 -0
  133. nvmath/bindings/nvpl/fft.pyi +168 -0
  134. nvmath/bindings/nvshmem.pxd +54 -0
  135. nvmath/bindings/nvshmem.pyi +191 -0
  136. nvmath/device/__init__.py +38 -0
  137. nvmath/device/_deprecated.py +33 -0
  138. nvmath/device/common.py +315 -0
  139. nvmath/device/common_backend.py +131 -0
  140. nvmath/device/common_cuda.py +201 -0
  141. nvmath/device/common_numba.py +300 -0
  142. nvmath/device/common_numba_cuda_mlir.py +202 -0
  143. nvmath/device/common_opaque_tensor.py +201 -0
  144. nvmath/device/cublasdx.py +1606 -0
  145. nvmath/device/cublasdx_backend.py +860 -0
  146. nvmath/device/cublasdx_numba.py +1534 -0
  147. nvmath/device/cublasdx_numba_cuda_mlir.py +208 -0
  148. nvmath/device/cufftdx.py +373 -0
  149. nvmath/device/cufftdx_backend.py +220 -0
  150. nvmath/device/cufftdx_numba.py +140 -0
  151. nvmath/device/cufftdx_numba_cuda_mlir.py +79 -0
  152. nvmath/device/curand_kernel.py +9147 -0
  153. nvmath/device/cusolverdx.py +2708 -0
  154. nvmath/device/cusolverdx_backend.py +440 -0
  155. nvmath/device/cusolverdx_numba.py +567 -0
  156. nvmath/device/cusolverdx_numba_cuda_mlir.py +604 -0
  157. nvmath/device/cusolverdx_overload_backend.py +1029 -0
  158. nvmath/device/llvm_array.py +29 -0
  159. nvmath/device/random.py +441 -0
  160. nvmath/device/random_helpers.py +23 -0
  161. nvmath/device/random_states.py +187 -0
  162. nvmath/device/types.py +138 -0
  163. nvmath/device/vector_types_numba.py +259 -0
  164. nvmath/distributed/__init__.py +200 -0
  165. nvmath/distributed/_internal/__init__.py +0 -0
  166. nvmath/distributed/_internal/nccl.py +86 -0
  167. nvmath/distributed/_internal/nvshmem.py +307 -0
  168. nvmath/distributed/_internal/symmetric_memory.py +35 -0
  169. nvmath/distributed/_internal/tensor_ifc.py +70 -0
  170. nvmath/distributed/_internal/tensor_ifc_cupy.py +68 -0
  171. nvmath/distributed/_internal/tensor_ifc_host_device.py +172 -0
  172. nvmath/distributed/_internal/tensor_ifc_numpy.py +46 -0
  173. nvmath/distributed/_internal/tensor_ifc_torch.py +162 -0
  174. nvmath/distributed/_internal/tensor_wrapper.py +81 -0
  175. nvmath/distributed/_utils.py +167 -0
  176. nvmath/distributed/distribution/__init__.py +30 -0
  177. nvmath/distributed/distribution/_configuration.py +39 -0
  178. nvmath/distributed/distribution/distributions.py +1024 -0
  179. nvmath/distributed/distribution/redistribute.py +1284 -0
  180. nvmath/distributed/fft/__init__.py +7 -0
  181. nvmath/distributed/fft/_configuration.py +82 -0
  182. nvmath/distributed/fft/fft.py +2742 -0
  183. nvmath/distributed/linalg/__init__.py +22 -0
  184. nvmath/distributed/linalg/_internal/__init__.py +3 -0
  185. nvmath/distributed/linalg/_internal/epilog_protocol.py +586 -0
  186. nvmath/distributed/linalg/_internal/matmul_desc_ifc.py +28 -0
  187. nvmath/distributed/linalg/advanced/__init__.py +8 -0
  188. nvmath/distributed/linalg/advanced/_configuration.py +171 -0
  189. nvmath/distributed/linalg/advanced/matmulmod.py +3573 -0
  190. nvmath/distributed/linalg/generic/__init__.py +8 -0
  191. nvmath/distributed/linalg/generic/_caching.py +66 -0
  192. nvmath/distributed/linalg/generic/_configuration.py +61 -0
  193. nvmath/distributed/linalg/generic/_factorization.py +172 -0
  194. nvmath/distributed/linalg/generic/_initialization.py +966 -0
  195. nvmath/distributed/linalg/generic/_problem_spec.py +511 -0
  196. nvmath/distributed/linalg/generic/solvermod.py +1368 -0
  197. nvmath/distributed/process_group.py +408 -0
  198. nvmath/fft/__init__.py +7 -0
  199. nvmath/fft/_configuration.py +189 -0
  200. nvmath/fft/_exec_utils.py +82 -0
  201. nvmath/fft/_helpers.py +237 -0
  202. nvmath/fft/fft.py +3122 -0
  203. nvmath/internal/__init__.pxd +3 -0
  204. nvmath/internal/__init__.py +10 -0
  205. nvmath/internal/_bindings.cp314t-win_amd64.pyd +0 -0
  206. nvmath/internal/_bindings.pxd +18 -0
  207. nvmath/internal/_device_utils.py +45 -0
  208. nvmath/internal/_layout/__init__.pxd +3 -0
  209. nvmath/internal/_layout/__init__.py +7 -0
  210. nvmath/internal/_layout/_layout.cp314t-win_amd64.pyd +0 -0
  211. nvmath/internal/_layout/_layout.pxd +1303 -0
  212. nvmath/internal/_layout/_layout.pyi +1145 -0
  213. nvmath/internal/enum_utils.py +142 -0
  214. nvmath/internal/formatters.py +87 -0
  215. nvmath/internal/mem_limit.py +51 -0
  216. nvmath/internal/memory.cp314t-win_amd64.pyd +0 -0
  217. nvmath/internal/memory.pxd +13 -0
  218. nvmath/internal/memory.pyi +50 -0
  219. nvmath/internal/ndbuffer/__init__.pxd +3 -0
  220. nvmath/internal/ndbuffer/__init__.py +9 -0
  221. nvmath/internal/ndbuffer/_copy_kernel.cp314t-win_amd64.pyd +0 -0
  222. nvmath/internal/ndbuffer/_copy_kernel.pxd +10 -0
  223. nvmath/internal/ndbuffer/_jit.cp314t-win_amd64.pyd +0 -0
  224. nvmath/internal/ndbuffer/_jit.pxd +7 -0
  225. nvmath/internal/ndbuffer/_ndbuffer.cp314t-win_amd64.pyd +0 -0
  226. nvmath/internal/ndbuffer/_ndbuffer.pxd +40 -0
  227. nvmath/internal/ndbuffer/_ndbuffer.pyi +463 -0
  228. nvmath/internal/ndbuffer/copy_kernel/args.h +34 -0
  229. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/array_view.h +52 -0
  230. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/elementwise.h +68 -0
  231. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/grid_indexer.h +69 -0
  232. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/transposed.h +242 -0
  233. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/type_utils.h +39 -0
  234. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/utils.h +132 -0
  235. nvmath/internal/ndbuffer/copy_kernel/copy_kernel_impl/vec.h +159 -0
  236. nvmath/internal/ndbuffer/copy_kernel/elementwise.h +53 -0
  237. nvmath/internal/ndbuffer/copy_kernel/transposed.h +58 -0
  238. nvmath/internal/package_ifc.py +168 -0
  239. nvmath/internal/package_ifc_cuda.py +57 -0
  240. nvmath/internal/package_ifc_cupy.py +67 -0
  241. nvmath/internal/package_ifc_torch.py +69 -0
  242. nvmath/internal/package_wrapper.py +14 -0
  243. nvmath/internal/tensor_ifc.py +179 -0
  244. nvmath/internal/tensor_ifc_cupy.py +234 -0
  245. nvmath/internal/tensor_ifc_ndbuffer.py +147 -0
  246. nvmath/internal/tensor_ifc_numpy.py +184 -0
  247. nvmath/internal/tensor_ifc_torch.py +178 -0
  248. nvmath/internal/tensor_wrapper.py +160 -0
  249. nvmath/internal/typemaps.py +113 -0
  250. nvmath/internal/utils.py +805 -0
  251. nvmath/linalg/__init__.py +56 -0
  252. nvmath/linalg/_internal/__init__.py +3 -0
  253. nvmath/linalg/_internal/algo_cap_ifc.py +82 -0
  254. nvmath/linalg/_internal/algo_config_ifc.py +43 -0
  255. nvmath/linalg/_internal/batch.py +234 -0
  256. nvmath/linalg/_internal/enum_to_tuples.py +64 -0
  257. nvmath/linalg/_internal/epilog_protocol.py +766 -0
  258. nvmath/linalg/_internal/layout.py +624 -0
  259. nvmath/linalg/_internal/matmul_desc_ifc.py +28 -0
  260. nvmath/linalg/_internal/matmul_pref_ifc.py +27 -0
  261. nvmath/linalg/_internal/matrix_layout_ifc.py +26 -0
  262. nvmath/linalg/_internal/solver_utils.py +432 -0
  263. nvmath/linalg/_internal/typemaps.py +144 -0
  264. nvmath/linalg/_internal/utils.py +157 -0
  265. nvmath/linalg/advanced/__init__.py +8 -0
  266. nvmath/linalg/advanced/_algorithmmod.py +170 -0
  267. nvmath/linalg/advanced/_configuration.py +351 -0
  268. nvmath/linalg/advanced/helpers/__init__.py +5 -0
  269. nvmath/linalg/advanced/helpers/matmul.py +1316 -0
  270. nvmath/linalg/advanced/matmulmod.py +3734 -0
  271. nvmath/linalg/generic/__init__.py +53 -0
  272. nvmath/linalg/generic/_configuration/__init__.py +39 -0
  273. nvmath/linalg/generic/_configuration/layout.py +263 -0
  274. nvmath/linalg/generic/_configuration/match.py +734 -0
  275. nvmath/linalg/generic/_configuration/qualifiers.py +493 -0
  276. nvmath/linalg/generic/_configuration/solver_configuration.py +59 -0
  277. nvmath/linalg/generic/_configuration/wrap.py +217 -0
  278. nvmath/linalg/generic/_dtype.py +15 -0
  279. nvmath/linalg/generic/matmulmod.py +2094 -0
  280. nvmath/linalg/generic/solvermod.py +1301 -0
  281. nvmath/memory.py +279 -0
  282. nvmath/sparse/__init__.py +38 -0
  283. nvmath/sparse/_internal/__init__.py +21 -0
  284. nvmath/sparse/_internal/common_utils.py +147 -0
  285. nvmath/sparse/_internal/cudss_config_ifc.py +702 -0
  286. nvmath/sparse/_internal/cudss_data_ifc.py +399 -0
  287. nvmath/sparse/_internal/cudss_utils.py +506 -0
  288. nvmath/sparse/_internal/cusparse_utils.py +382 -0
  289. nvmath/sparse/_internal/sparse_bsc_ifc.py +303 -0
  290. nvmath/sparse/_internal/sparse_bsr_ifc.py +305 -0
  291. nvmath/sparse/_internal/sparse_coo_ifc.py +256 -0
  292. nvmath/sparse/_internal/sparse_csc_ifc.py +268 -0
  293. nvmath/sparse/_internal/sparse_csr_ifc.py +288 -0
  294. nvmath/sparse/_internal/sparse_dia_ifc.py +242 -0
  295. nvmath/sparse/_internal/sparse_format_helpers.py +601 -0
  296. nvmath/sparse/_internal/sparse_tensor_ifc.py +133 -0
  297. nvmath/sparse/_internal/sparse_ust_ifc.py +141 -0
  298. nvmath/sparse/_internal/utils.py +56 -0
  299. nvmath/sparse/advanced/__init__.py +7 -0
  300. nvmath/sparse/advanced/_configuration.py +227 -0
  301. nvmath/sparse/advanced/direct_solver.py +2069 -0
  302. nvmath/sparse/generic/__init__.py +7 -0
  303. nvmath/sparse/generic/_configuration.py +129 -0
  304. nvmath/sparse/generic/_helpers.py +137 -0
  305. nvmath/sparse/generic/_thunks.py +21 -0
  306. nvmath/sparse/generic/matmulmod.py +2353 -0
  307. nvmath/sparse/ust/__init__.py +7 -0
  308. nvmath/sparse/ust/_converters.py +422 -0
  309. nvmath/sparse/ust/_cpp.py +28 -0
  310. nvmath/sparse/ust/_drawer.py +565 -0
  311. nvmath/sparse/ust/_emitter.py +1033 -0
  312. nvmath/sparse/ust/_jit.py +188 -0
  313. nvmath/sparse/ust/_kernel.py +282 -0
  314. nvmath/sparse/ust/_utils.py +149 -0
  315. nvmath/sparse/ust/interfaces/__init__.py +0 -0
  316. nvmath/sparse/ust/interfaces/torch_interface.py +476 -0
  317. nvmath/sparse/ust/tensor.py +1016 -0
  318. nvmath/sparse/ust/tensor_format.py +957 -0
  319. nvmath/tensor/__init__.py +6 -0
  320. nvmath/tensor/_configuration.py +120 -0
  321. nvmath/tensor/_internal/__init__.py +3 -0
  322. nvmath/tensor/_internal/cutensor_config_ifc.py +279 -0
  323. nvmath/tensor/_internal/cutensor_utils.py +230 -0
  324. nvmath/tensor/_internal/data.py +43 -0
  325. nvmath/tensor/_internal/einsum_parser.py +444 -0
  326. nvmath/tensor/_internal/typemaps.py +96 -0
  327. nvmath/tensor/contract.py +1900 -0
  328. nvmath_python-1.0.0.dist-info/METADATA +134 -0
  329. nvmath_python-1.0.0.dist-info/RECORD +332 -0
  330. nvmath_python-1.0.0.dist-info/WHEEL +5 -0
  331. nvmath_python-1.0.0.dist-info/licenses/LICENSE +177 -0
  332. nvmath_python-1.0.0.dist-info/top_level.txt +2 -0
@@ -0,0 +1,22 @@
1
+ # Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from nvmath.bindings.cublas import ComputeType # type: ignore
6
+
7
+ from . import advanced
8
+ from .generic.solvermod import (
9
+ DirectSolver,
10
+ DirectSolverOptions,
11
+ InvalidDirectSolverState,
12
+ direct_solver,
13
+ )
14
+
15
+ __all__ = [
16
+ "advanced",
17
+ "ComputeType",
18
+ "InvalidDirectSolverState",
19
+ "DirectSolver",
20
+ "DirectSolverOptions",
21
+ "direct_solver",
22
+ ]
@@ -0,0 +1,3 @@
1
+ # Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
@@ -0,0 +1,586 @@
1
+ # Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """Internal interface for epilog input handling."""
6
+
7
+ __all__ = [
8
+ "EPILOG_INPUT_HANDLERS_MAP",
9
+ "EPILOG_OUTPUT_HANDLERS_MAP",
10
+ "BiasHandler",
11
+ "BgradHandler",
12
+ "ReluAuxHandler",
13
+ "DReluAuxHandler",
14
+ "GeluAuxHandler",
15
+ "DGeluAuxHandler",
16
+ "EpilogInputHandler",
17
+ "EpilogOutputHandler",
18
+ ]
19
+
20
+ import math
21
+ from abc import abstractmethod
22
+ from typing import Protocol, runtime_checkable
23
+
24
+ from nvmath.bindings import cublasMp # type: ignore
25
+ from nvmath.internal import typemaps
26
+ from nvmath.linalg._internal.utils import axis_order_in_memory, calculate_strides, check_batch_tileable
27
+
28
+ Epilog = cublasMp.MatmulEpilogue
29
+
30
+
31
+ @runtime_checkable
32
+ class EpilogInputHandler(Protocol):
33
+ """
34
+ Protocol for epilog handler input validation and setting the appropriate MM descriptor
35
+ attributes.
36
+ """
37
+
38
+ @abstractmethod
39
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
40
+ raise NotImplementedError
41
+
42
+ @property
43
+ @abstractmethod
44
+ def name(self):
45
+ """
46
+ The name of the epilog input that is handled (bias, ...).
47
+ """
48
+ raise NotImplementedError
49
+
50
+ @abstractmethod
51
+ def validate(self, epilog_input):
52
+ """
53
+ Validate the provided epilog input.
54
+
55
+ Args:
56
+ epilog_input: The epilog input to validate.
57
+
58
+ """
59
+ raise NotImplementedError
60
+
61
+ @abstractmethod
62
+ def update(self, mm_desc_ifc, epilog_input):
63
+ """
64
+ Update the matmul descriptor attributes for this epilog from the given input.
65
+
66
+ Args:
67
+ mm_desc_ifc: The MM descriptor to update, provided as
68
+ a MatmulDescInterface object.
69
+ epilog_input: The epilog input.
70
+ """
71
+ raise NotImplementedError
72
+
73
+ @abstractmethod
74
+ def update_pointer(self, mm_desc_ifc, data_ptr) -> None:
75
+ """
76
+ Update the matmul descriptor data pointer for this epilog.
77
+
78
+ Unlike ``update``, this only sets the pointer, assuming all other
79
+ descriptor attributes (batch stride, leading dimension, data type)
80
+ are already valid.
81
+
82
+ Args:
83
+ mm_desc_ifc: The MM descriptor to update, provided
84
+ as a MatmulDescInterface object.
85
+ data_ptr: The device pointer value to set.
86
+ """
87
+ raise NotImplementedError
88
+
89
+
90
+ @runtime_checkable
91
+ class EpilogOutputHandler(Protocol):
92
+ """
93
+ Protocol for epilog handler output validation and setting the appropriate MM descriptor
94
+ attributes.
95
+ """
96
+
97
+ @abstractmethod
98
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
99
+ raise NotImplementedError
100
+
101
+ @property
102
+ @abstractmethod
103
+ def name(self):
104
+ """
105
+ The name of the epilog output that is handled (relu_aux, gelu_aux, bgrad, bragda,
106
+ bgradb, ...).
107
+ """
108
+ raise NotImplementedError
109
+
110
+ @abstractmethod
111
+ def attributes(self):
112
+ """
113
+ The shape, stride, and dtype name of the output tensor.
114
+ """
115
+ raise NotImplementedError
116
+
117
+ @abstractmethod
118
+ def update(self, mm_desc_ifc):
119
+ """
120
+ Update all the attributes for this epilog, except the pointer.
121
+
122
+ Args:
123
+ mm_desc_ifc: The MM descriptor to update, provided as a MatmulDescInterface
124
+ object.
125
+ """
126
+ raise NotImplementedError
127
+
128
+ @abstractmethod
129
+ def update_pointer(self, mm_desc_ifc, ptr):
130
+ """
131
+ Set the pointer for this epilog.
132
+
133
+ Args:
134
+ mm_desc_ifc: The MM descriptor to update, provided as a MatmulDescInterface
135
+ object.
136
+
137
+ ptr: The pointer to set.
138
+
139
+ """
140
+ raise NotImplementedError
141
+
142
+
143
+ class BiasHandler(EpilogInputHandler):
144
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
145
+ self.logger = logger
146
+ self.mm_traits = mm_traits
147
+
148
+ assert enumerator in [
149
+ Epilog.BIAS,
150
+ Epilog.RELU_BIAS,
151
+ Epilog.RELU_AUX_BIAS,
152
+ Epilog.GELU_BIAS,
153
+ Epilog.GELU_AUX_BIAS,
154
+ ], "Internal error."
155
+ self.enumerator = enumerator
156
+
157
+ self.d_dtype_name = d_dtype_name
158
+
159
+ self._name = "bias"
160
+
161
+ @property
162
+ def name(self):
163
+ return self._name
164
+
165
+ def validate(self, bias_tensor):
166
+ # The bias_tensor must be of rank 1, or rank 2 with (M, 1).
167
+
168
+ bias_shape = list(bias_tensor.shape)
169
+ bias_strides = list(bias_tensor.strides)
170
+
171
+ mm_traits = self.mm_traits
172
+
173
+ # Determine the rank of bias_tensor input.
174
+ bias_batch_shape, bias_mm_shape = bias_shape[:-2], bias_shape[-2:]
175
+ bias_mm_strides = bias_strides[-2:]
176
+ if len(bias_mm_shape) == 1:
177
+ s, d = bias_mm_shape[0], bias_mm_strides[0]
178
+ bias_mm_shape += [1]
179
+ bias_mm_strides += [s * d]
180
+ self.logger.debug(f"The MM shape for the bias is {bias_mm_shape} with strides {bias_mm_strides}.")
181
+
182
+ Mb, Nb = bias_mm_shape
183
+ if Mb != mm_traits.d_layout.shape[0]:
184
+ raise ValueError(f"The M dimension of the bias vector ({Mb}) must match the local M dimension of A.")
185
+
186
+ if Nb != 1:
187
+ raise ValueError(f"The N dimension of the bias vector ({Nb}) must be equal to 1.")
188
+
189
+ # Check if the bias_tensor batch shape and axis order match that of the MM, and it's
190
+ # tileable.
191
+ if len(bias_batch_shape) > 0:
192
+ raise ValueError("Batched matmul is currently not supported.")
193
+
194
+ if bias_mm_strides[0] != 1:
195
+ raise ValueError(
196
+ f"The stride of the bias {bias_strides} must be 1 along the dimension {len(bias_strides) - 2}, "
197
+ f"which corresponds to the M dimension."
198
+ )
199
+
200
+ def update_pointer(self, mm_desc_ifc, data_ptr):
201
+ mm_desc_ifc.bias_pointer = data_ptr
202
+
203
+ def update(self, mm_desc_ifc, bias_tensor):
204
+ # Set the bias pointer.
205
+ mm_desc_ifc.bias_pointer = bias_tensor.data_ptr
206
+ # Set the bias data type.
207
+ if bias_tensor.dtype != self.d_dtype_name:
208
+ mm_desc_ifc.bias_data_type = typemaps.NAME_TO_DATA_TYPE[bias_tensor.dtype]
209
+
210
+
211
+ def round_up(m, base):
212
+ return m + (base - m) % base
213
+
214
+
215
+ def relu_aux_mm_shape(m, n):
216
+ """
217
+ Return the RELU auxiliary bitmask matrix shape when stored as uint8 and M is padded to
218
+ 128-bit/16-byte multiples.
219
+ """
220
+ # Store bitflag mask using int8 dtype, padded to (128//8 ==) 16 bytes.
221
+ m = round_up(math.ceil(m / 8), base=16)
222
+ return m, n
223
+
224
+
225
+ def gelu_aux_mm_shape(m, n):
226
+ """
227
+ Return the GELU auxiliary matrix shape when M is padded to 8-byte multiples.
228
+ """
229
+ m = round_up(m, base=8)
230
+ return m, n
231
+
232
+
233
+ class ReluAuxHandler(EpilogOutputHandler):
234
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
235
+ self.logger = logger
236
+ self.mm_traits = mm_traits
237
+
238
+ assert enumerator in [Epilog.RELU_AUX, Epilog.RELU_AUX_BIAS], "Internal error."
239
+ self.enumerator = enumerator
240
+
241
+ self._name = "relu_aux"
242
+
243
+ m, n = relu_aux_mm_shape(*mm_traits.d_layout.shape)
244
+ batch_len = len(mm_traits.batch_axis_order)
245
+
246
+ self.aux_shape = mm_traits.batch_shape + [m, n]
247
+ aux_axis_order = [batch_len, batch_len + 1] + list(mm_traits.batch_axis_order) # Column order for the bitmask.
248
+ self.aux_strides = calculate_strides(self.aux_shape, aux_axis_order)
249
+ if aux_dtype_name is not None:
250
+ raise ValueError("Custom type for auxiliary outputs is not supported for RELU epilogs.")
251
+ self.aux_dtype_name = "uint8"
252
+
253
+ # We store bitmask using int8 dtype but the values below are in number of elements.
254
+ self.aux_ld = m * 8 # should be consistent with order (currently COL).
255
+ self.aux_batch_offset = m * 8 * n
256
+
257
+ @property
258
+ def name(self):
259
+ return self._name
260
+
261
+ def attributes(self):
262
+ return self.aux_shape, self.aux_strides, self.aux_dtype_name
263
+
264
+ def update(self, mm_desc_ifc):
265
+ # Set the aux LD.
266
+ mm_desc_ifc.epilogue_aux_ld = self.aux_ld
267
+ # Set the pointer to 0x1 to bypass the cuBLAS check.
268
+ mm_desc_ifc.epilogue_aux_pointer = 0x1
269
+
270
+ def update_pointer(self, mm_desc_ifc, ptr):
271
+ # Set the aux pointer.
272
+ mm_desc_ifc.epilogue_aux_pointer = ptr
273
+
274
+
275
+ class GeluAuxHandler(EpilogOutputHandler):
276
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
277
+ self.logger = logger
278
+ self.mm_traits = mm_traits
279
+
280
+ assert enumerator in [Epilog.GELU_AUX, Epilog.GELU_AUX_BIAS], "Internal error."
281
+ self.enumerator = enumerator
282
+
283
+ self.d_dtype_name = d_dtype_name
284
+
285
+ self._name = "gelu_aux"
286
+
287
+ m, n = gelu_aux_mm_shape(*mm_traits.d_layout.shape)
288
+ batch_len = len(mm_traits.batch_axis_order)
289
+
290
+ self.aux_shape = mm_traits.batch_shape + [m, n]
291
+ aux_axis_order = [batch_len, batch_len + 1] + list(mm_traits.batch_axis_order) # Column order for the GELU inputs.
292
+ self.aux_strides = calculate_strides(self.aux_shape, aux_axis_order)
293
+
294
+ if aux_dtype_name:
295
+ self.aux_dtype_name = aux_dtype_name
296
+ else:
297
+ self.aux_dtype_name = c_dtype_name if "float8" in d_dtype_name else d_dtype_name
298
+
299
+ self.aux_ld = m # should be consistent with order (currently COL).
300
+ self.aux_batch_offset = m * n
301
+
302
+ @property
303
+ def name(self):
304
+ return self._name
305
+
306
+ def attributes(self):
307
+ return self.aux_shape, self.aux_strides, self.aux_dtype_name
308
+
309
+ def update(self, mm_desc_ifc):
310
+ # Set the aux LD.
311
+ mm_desc_ifc.epilogue_aux_ld = self.aux_ld
312
+ # Set the pointer to 0x1 to bypass the cuBLAS check.
313
+ mm_desc_ifc.epilogue_aux_pointer = 0x1
314
+ if self.aux_dtype_name is not None:
315
+ mm_desc_ifc.epilogue_aux_data_type = typemaps.NAME_TO_DATA_TYPE[self.aux_dtype_name]
316
+
317
+ def update_pointer(self, mm_desc_ifc, ptr):
318
+ # Set the aux pointer.
319
+ mm_desc_ifc.epilogue_aux_pointer = ptr
320
+
321
+
322
+ class BgradHandler(EpilogOutputHandler):
323
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
324
+ self.logger = logger
325
+ self.mm_traits = mm_traits
326
+
327
+ assert enumerator in [Epilog.DRELU_BGRAD, Epilog.DGELU_BGRAD, Epilog.BGRADA, Epilog.BGRADB], "Internal error."
328
+ self.enumerator = enumerator
329
+
330
+ self._name = enumerator.name.lower()
331
+
332
+ if aux_dtype_name is not None:
333
+ raise ValueError("Custom type for auxiliary outputs is not supported for BGRAD epilogs.")
334
+
335
+ # For BGRADB with BIAS_RESULT_SCHEME=FULL the cuBLASMp output is always replicated.
336
+ m = mm_traits.N if enumerator == Epilog.BGRADB else mm_traits.d_layout.shape[0]
337
+ batch_len = len(mm_traits.batch_axis_order)
338
+
339
+ self.bgrad_shape = shape = [m]
340
+ if mm_traits.batch_shape:
341
+ shape = shape + [1]
342
+ self.bgrad_shape = mm_traits.batch_shape + self.bgrad_shape + [1]
343
+
344
+ bgrad_axis_order = [batch_len + a for a in range(len(shape))] + list(mm_traits.batch_axis_order) # Column order.
345
+ self.bgrad_strides = calculate_strides(self.bgrad_shape, bgrad_axis_order)
346
+
347
+ self.d_dtype_name = d_dtype_name
348
+ self.bgrad_dtype_name = d_dtype_name
349
+ self.bgrad_batch_offset = m
350
+
351
+ @property
352
+ def name(self):
353
+ return self._name
354
+
355
+ def attributes(self):
356
+ return self.bgrad_shape, self.bgrad_strides, self.bgrad_dtype_name
357
+
358
+ def update(self, mm_desc_ifc):
359
+ # The bgrad data type is by default the data type of the result for all the cases we
360
+ # support.
361
+ assert self.bgrad_dtype_name == self.d_dtype_name, "Internal error."
362
+
363
+ def update_pointer(self, mm_desc_ifc, ptr):
364
+ # Set the bgrad pointer.
365
+ mm_desc_ifc.bias_pointer = ptr
366
+
367
+
368
+ class DReluAuxHandler(EpilogInputHandler):
369
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
370
+ self.mm_traits = mm_traits
371
+
372
+ assert enumerator in [Epilog.DRELU, Epilog.DRELU_BGRAD], "Internal error."
373
+ self.enumerator = enumerator
374
+
375
+ self._name = "relu_aux"
376
+
377
+ # The bitmask int8 matrix local shape, including padding.
378
+ self.mm_m, self.mm_n = relu_aux_mm_shape(*mm_traits.d_layout.shape)
379
+
380
+ # We store bitmask using int8 dtype but the values below are in number of elements.
381
+ self.aux_ld = self.mm_m * 8 # should be consistent with order (currently COL).
382
+
383
+ # K=1 is not supported by cuBLAS
384
+ if mm_traits.K == 1:
385
+ raise ValueError("K=1 is not supported for DRELU epilogs")
386
+
387
+ @property
388
+ def name(self):
389
+ return self._name
390
+
391
+ def validate(self, relu_aux_tensor):
392
+ # The relu_aux_tensor must be of rank 2.
393
+ if len(relu_aux_tensor.shape) != 2:
394
+ raise ValueError(f"RELU auxiliary input must be of rank 2, its shape is {relu_aux_tensor.shape}")
395
+
396
+ # The dtype must be uint8.
397
+ if relu_aux_tensor.dtype != "uint8":
398
+ raise ValueError(
399
+ f"The dtype of the RELU auxiliary input for epilog {self.enumerator.name} must be 'uint8'. "
400
+ f"The epilog input's dtype is '{relu_aux_tensor.dtype}'."
401
+ )
402
+
403
+ # The MM shape must match, the MM must be in col order, and the batch order must
404
+ # match.
405
+ Ma, Na = relu_aux_tensor.shape
406
+ if Ma != self.mm_m or Na != self.mm_n:
407
+ raise ValueError(
408
+ f"The auxiliary epilog input for epilog {self.enumerator.name} must have the MM shape "
409
+ f"(..., {self.mm_m}, {self.mm_n}). The epilog input's MM shape is ({Ma}, {Na})."
410
+ )
411
+
412
+ if relu_aux_tensor.strides[0] != 1:
413
+ raise ValueError(
414
+ f"The stride of the RELU auxiliary input {relu_aux_tensor.strides} must be 1 "
415
+ f"along the dimension 0, which corresponds to the M dimension."
416
+ )
417
+
418
+ def update_pointer(self, mm_desc_ifc, data_ptr):
419
+ mm_desc_ifc.epilogue_aux_pointer = data_ptr
420
+
421
+ def update(self, mm_desc_ifc, relu_aux_tensor):
422
+ # Set the epilog aux pointer.
423
+ mm_desc_ifc.epilogue_aux_pointer = relu_aux_tensor.data_ptr
424
+ # Set the aux LD.
425
+ mm_desc_ifc.epilogue_aux_ld = self.aux_ld
426
+ # The relu aux data type is bitmask, don't set.
427
+
428
+
429
+ class DGeluAuxHandler(EpilogInputHandler):
430
+ def __init__(self, logger, mm_traits, enumerator, c_dtype_name, d_dtype_name, aux_dtype_name):
431
+ self.logger = logger
432
+ self.mm_traits = mm_traits
433
+
434
+ assert enumerator in [Epilog.DGELU, Epilog.DGELU_BGRAD], "Internal error."
435
+ self.enumerator = enumerator
436
+
437
+ self.d_dtype_name = d_dtype_name
438
+
439
+ self.batch_offset = None
440
+
441
+ self._name = "gelu_aux"
442
+
443
+ # The GELU aux matrix shape, including padding.
444
+ self.mm_m, self.mm_n = gelu_aux_mm_shape(*mm_traits.d_layout.shape)
445
+
446
+ self.aux_ld = self.mm_m # should be consistent with order (currently COL).
447
+
448
+ # K=1 is not supported by cuBLAS
449
+ if mm_traits.K == 1:
450
+ raise ValueError("K=1 is not supported for DGELU epilogs")
451
+
452
+ @property
453
+ def name(self):
454
+ return self._name
455
+
456
+ def validate(self, gelu_aux_tensor):
457
+ # The gelu_aux_tensor must be of rank 2 or its batched version of the latter (...,
458
+ # M, N).
459
+ gelu_aux_shape = list(gelu_aux_tensor.shape)
460
+ gelu_aux_strides = list(gelu_aux_tensor.strides)
461
+
462
+ # The dtype must be the same as that of D.
463
+ if gelu_aux_tensor.dtype != self.d_dtype_name:
464
+ raise ValueError(
465
+ f"The dtype of the GELU auxiliary input for epilog {self.enumerator.name} must be '{self.d_dtype_name}'. "
466
+ f"The epilog input's dtype is '{gelu_aux_tensor.dtype}'."
467
+ )
468
+
469
+ mm_traits = self.mm_traits
470
+
471
+ # Determine the rank of gelu_aux_tensor input.
472
+ gelu_aux_batch_shape, gelu_aux_mm_shape = gelu_aux_shape[:-2], gelu_aux_shape[-2:]
473
+ gelu_aux_batch_strides, gelu_aux_mm_strides = gelu_aux_strides[:-2], gelu_aux_strides[-2:]
474
+
475
+ # The MM shape must match, the MM must be in col order, and the batch order must
476
+ # match.
477
+ Ma, Na = gelu_aux_mm_shape
478
+ if Ma != self.mm_m or Na != self.mm_n:
479
+ raise ValueError(
480
+ f"The auxiliary epilog input for epilog {self.enumerator.name} must have "
481
+ f"the MM shape (..., {self.mm_m}, {self.mm_n}). The epilog input's MM shape is (..., {Ma}, {Na})."
482
+ )
483
+
484
+ # Check if the gelu_aux_tensor batch shape and axis order match that of the MM, and
485
+ # it's tileable.
486
+ if len(gelu_aux_batch_shape) > 0:
487
+ if gelu_aux_batch_shape != mm_traits.batch_shape:
488
+ raise ValueError(
489
+ f"The batch dimensions of the GELU auxiliary input {gelu_aux_batch_shape} must match with that "
490
+ f"of the matrix multiplication definition {mm_traits.batch_shape}."
491
+ )
492
+
493
+ if (gelu_aux_batch_axis_order := axis_order_in_memory(gelu_aux_batch_strides)) != mm_traits.batch_axis_order:
494
+ raise ValueError(
495
+ f"The batch axis order of the GELU auxiliary input {gelu_aux_batch_axis_order} "
496
+ f"must match with that of the other operands {mm_traits.batch_axis_order}."
497
+ )
498
+
499
+ if not check_batch_tileable(gelu_aux_batch_shape, gelu_aux_batch_strides):
500
+ message = (
501
+ f"The batch layout for GELU auxiliary input corresponding to shape = {gelu_aux_batch_shape} and "
502
+ f"strides = {gelu_aux_batch_strides} is currently not supported because it is not tileable."
503
+ )
504
+ raise ValueError(message)
505
+
506
+ if gelu_aux_mm_strides[0] != 1:
507
+ raise ValueError(
508
+ f"The stride of the GELU auxiliary input {gelu_aux_strides} must be 1 "
509
+ f"along the dimension {len(gelu_aux_strides) - 2}, which corresponds to the M dimension."
510
+ )
511
+
512
+ self.batch_offset = min(gelu_aux_batch_strides) if gelu_aux_batch_strides else 0 # gelu_aux broadcast
513
+
514
+ if self.batch_offset > 0:
515
+ assert self.batch_offset >= self.mm_m * self.mm_n, "Tensor data must not overlap."
516
+
517
+ def update_pointer(self, mm_desc_ifc, data_ptr):
518
+ mm_desc_ifc.epilogue_aux_pointer = data_ptr
519
+
520
+ def update(self, mm_desc_ifc, gelu_aux_tensor):
521
+ # Set the epilog aux pointer.
522
+ mm_desc_ifc.epilogue_aux_pointer = gelu_aux_tensor.data_ptr
523
+ # Set the aux LD.
524
+ mm_desc_ifc.epilogue_aux_ld = self.aux_ld
525
+ # Set the gelu aux data type.
526
+ if gelu_aux_tensor.dtype != self.d_dtype_name:
527
+ mm_desc_ifc.epilogue_aux_data_type = typemaps.NAME_TO_DATA_TYPE[gelu_aux_tensor.dtype]
528
+
529
+
530
+ EPILOG_INPUT_HANDLERS_MAP: dict[cublasMp.MatmulEpilogue, list[type[EpilogInputHandler]]] = {
531
+ Epilog.ALLREDUCE: [],
532
+ Epilog.RELU: [],
533
+ Epilog.RELU_AUX: [],
534
+ Epilog.GELU: [],
535
+ Epilog.GELU_AUX: [],
536
+ Epilog.BIAS: [BiasHandler],
537
+ Epilog.RELU_BIAS: [BiasHandler],
538
+ Epilog.RELU_AUX_BIAS: [BiasHandler],
539
+ Epilog.GELU_BIAS: [BiasHandler],
540
+ Epilog.GELU_AUX_BIAS: [BiasHandler],
541
+ Epilog.DRELU: [DReluAuxHandler],
542
+ Epilog.DRELU_BGRAD: [DReluAuxHandler],
543
+ Epilog.DGELU: [DGeluAuxHandler],
544
+ Epilog.DGELU_BGRAD: [DGeluAuxHandler],
545
+ Epilog.BGRADA: [],
546
+ Epilog.BGRADB: [],
547
+ }
548
+
549
+ EPILOG_OUTPUT_HANDLERS_MAP: dict[cublasMp.MatmulEpilogue, list[type[EpilogOutputHandler]]] = {
550
+ Epilog.ALLREDUCE: [],
551
+ Epilog.RELU: [],
552
+ Epilog.RELU_AUX: [ReluAuxHandler],
553
+ Epilog.GELU: [],
554
+ Epilog.GELU_AUX: [GeluAuxHandler],
555
+ Epilog.BIAS: [],
556
+ Epilog.RELU_BIAS: [],
557
+ Epilog.RELU_AUX_BIAS: [ReluAuxHandler],
558
+ Epilog.GELU_BIAS: [],
559
+ Epilog.GELU_AUX_BIAS: [GeluAuxHandler],
560
+ Epilog.DRELU: [],
561
+ Epilog.DRELU_BGRAD: [BgradHandler],
562
+ Epilog.DGELU: [],
563
+ Epilog.DGELU_BGRAD: [BgradHandler],
564
+ Epilog.BGRADA: [BgradHandler],
565
+ Epilog.BGRADB: [BgradHandler],
566
+ }
567
+
568
+ EPILOG_MINIMUM_VERSIONS_MAP: dict[cublasMp.MatmulEpilogue | None, dict[str, int]] = {
569
+ None: {"cublasMp": 00000},
570
+ Epilog.ALLREDUCE: {"cublasMp": 800},
571
+ Epilog.RELU: {"cublasMp": 800},
572
+ Epilog.GELU: {"cublasMp": 800},
573
+ Epilog.BIAS: {"cublasMp": 800},
574
+ Epilog.RELU_AUX: {"cublasMp": 800},
575
+ Epilog.GELU_AUX: {"cublasMp": 800},
576
+ Epilog.RELU_BIAS: {"cublasMp": 800},
577
+ Epilog.RELU_AUX_BIAS: {"cublasMp": 800},
578
+ Epilog.GELU_BIAS: {"cublasMp": 800},
579
+ Epilog.GELU_AUX_BIAS: {"cublasMp": 800},
580
+ Epilog.DRELU: {"cublasMp": 801},
581
+ Epilog.DGELU: {"cublasMp": 800},
582
+ Epilog.BGRADA: {"cublasMp": 800},
583
+ Epilog.BGRADB: {"cublasMp": 800},
584
+ Epilog.DRELU_BGRAD: {"cublasMp": 801},
585
+ Epilog.DGELU_BGRAD: {"cublasMp": 800},
586
+ }
@@ -0,0 +1,28 @@
1
+ # Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ """
6
+ Interface class to encapsulate low-level calls to get and set matmul descriptor attributes.
7
+ """
8
+
9
+ __all__ = ["MatmulDescInterface"]
10
+
11
+ from nvmath._internal.attribute_ifc_factory import make_cublas_attribute_interface
12
+ from nvmath.bindings import cublasMp # type: ignore
13
+
14
+ # Create a class, MatmulDescInterface, such that each enum member in
15
+ # MatmulDescriptorAttribute is exposed as a lowercase property (getter + setter)
16
+ # and a ``set_<attr>_unchecked`` method (setter without debug logging).
17
+ # For example, if the class instance is stored as ``desc_ifc``,
18
+ # then the enum member ``ALGO_TYPE`` becomes the property
19
+ # ``desc_ifc.algo_type``.
20
+ MatmulDescInterface = make_cublas_attribute_interface(
21
+ class_module=__name__,
22
+ class_name="MatmulDescInterface",
23
+ attribute_enum=cublasMp.MatmulDescriptorAttribute,
24
+ get_attribute_dtype_fn=cublasMp.get_matmul_descriptor_attribute_dtype,
25
+ get_attribute_fn=cublasMp.matmul_descriptor_get_attribute,
26
+ set_attribute_fn=cublasMp.matmul_descriptor_set_attribute,
27
+ with_unchecked=True, # Consistent with the non-distributed MatmulDescInterface.
28
+ )
@@ -0,0 +1,8 @@
1
+ # Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ from nvmath.linalg.advanced import helpers as helpers # noqa: F403
6
+
7
+ from ._configuration import * # noqa: F403
8
+ from .matmulmod import * # noqa: F403