Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/INSTALLER +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/METADATA +46 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/RECORD +468 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/WHEEL +6 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/entry_points.txt +7 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/licenses/LICENSE +23 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/top_level.txt +1 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_double_functions.hpp +197 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_fp128_functions.h +1217 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_functions.h +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_functions.hpp +1163 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/func_macro.h +57 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/host_config.h +310 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/host_defines.h +283 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/host_runtime.h +306 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/math_functions.h +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/math_functions.hpp +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/mma.h +761 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/mma.hpp +1128 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/nvfunctional +621 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_100_rt.h +252 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_100_rt.hpp +157 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_70_rt.h +139 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_70_rt.hpp +192 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_80_rt.h +164 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_80_rt.hpp +148 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_90_rt.h +282 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_90_rt.hpp +248 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/storage_class.h +142 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/__init__.py +7 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/code_generator.py +1639 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/compiler.py +501 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/errors.py +51 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/make_launcher.py +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/__init__.py +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/__init__.py +6 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/_compiler.py +0 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/_runtime.py +102 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/amd/__init__.py +3 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/amd/gfx1250.py +46 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/__init__.py +137 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_core.py +592 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_layouts.py +676 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_math.py +20 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_semantic.py +573 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_standard.py +81 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/__init__.py +6 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/_layouts.py +187 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/_ops.py +77 -0
- miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/cdna3/__init__.py +238 -0
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: triton
|
| 3 |
+
Version: 3.6.0
|
| 4 |
+
Summary: A language and compiler for custom Deep Learning operations
|
| 5 |
+
Home-page: https://github.com/triton-lang/triton/
|
| 6 |
+
Author: Philippe Tillet
|
| 7 |
+
Author-email: phil@openai.com
|
| 8 |
+
Keywords: Compiler,Deep Learning
|
| 9 |
+
Classifier: Development Status :: 4 - Beta
|
| 10 |
+
Classifier: Intended Audience :: Developers
|
| 11 |
+
Classifier: Topic :: Software Development :: Build Tools
|
| 12 |
+
Classifier: License :: OSI Approved :: MIT License
|
| 13 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 18 |
+
Requires-Python: >=3.10,<3.15
|
| 19 |
+
License-File: LICENSE
|
| 20 |
+
Requires-Dist: importlib-metadata; python_version < "3.10"
|
| 21 |
+
Provides-Extra: build
|
| 22 |
+
Requires-Dist: cmake<4.0,>=3.20; extra == "build"
|
| 23 |
+
Requires-Dist: lit; extra == "build"
|
| 24 |
+
Provides-Extra: tests
|
| 25 |
+
Requires-Dist: autopep8; extra == "tests"
|
| 26 |
+
Requires-Dist: isort; extra == "tests"
|
| 27 |
+
Requires-Dist: numpy; extra == "tests"
|
| 28 |
+
Requires-Dist: pytest; extra == "tests"
|
| 29 |
+
Requires-Dist: pytest-forked; extra == "tests"
|
| 30 |
+
Requires-Dist: pytest-xdist; extra == "tests"
|
| 31 |
+
Requires-Dist: scipy>=1.7.1; extra == "tests"
|
| 32 |
+
Requires-Dist: llnl-hatchet; extra == "tests"
|
| 33 |
+
Provides-Extra: tutorials
|
| 34 |
+
Requires-Dist: matplotlib; extra == "tutorials"
|
| 35 |
+
Requires-Dist: pandas; extra == "tutorials"
|
| 36 |
+
Requires-Dist: tabulate; extra == "tutorials"
|
| 37 |
+
Dynamic: author
|
| 38 |
+
Dynamic: author-email
|
| 39 |
+
Dynamic: classifier
|
| 40 |
+
Dynamic: home-page
|
| 41 |
+
Dynamic: keywords
|
| 42 |
+
Dynamic: license-file
|
| 43 |
+
Dynamic: provides-extra
|
| 44 |
+
Dynamic: requires-dist
|
| 45 |
+
Dynamic: requires-python
|
| 46 |
+
Dynamic: summary
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
../../../bin/proton,sha256=9kGWY-skHgepyDWNvisL-0Y5WG1IqPulvAdOSPXfnII,219
|
| 2 |
+
../../../bin/proton-viewer,sha256=55s59q0jvmeBJI3lzZIcvFHbnyQn6a7CUgKmcSvDU3k,219
|
| 3 |
+
triton-3.6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 4 |
+
triton-3.6.0.dist-info/METADATA,sha256=XJBx25sFe-yJzW1_dvYeXyil6NNxf_bIVCDPgBXuAyE,1663
|
| 5 |
+
triton-3.6.0.dist-info/RECORD,,
|
| 6 |
+
triton-3.6.0.dist-info/WHEEL,sha256=Obtqci3x5vy5ZivY2BiOH9GHO8-xQ0d4HFhTOtXMNhw,152
|
| 7 |
+
triton-3.6.0.dist-info/entry_points.txt,sha256=js6289FRk18_JLmbNfGsmtKP77D6aYawJOSIHv3X89I,176
|
| 8 |
+
triton-3.6.0.dist-info/licenses/LICENSE,sha256=kmQPuXIi_Qppj_KM4MN4LBcmI_jWxgm1V2NqgPKPuUY,1132
|
| 9 |
+
triton-3.6.0.dist-info/top_level.txt,sha256=WBiIZyv6n9Y7MIh-HPHSv2w1RDk7EFL__7ZgQRrmHYs,7
|
| 10 |
+
triton/FileCheck,sha256=RuSjRod4j3qusHirPi_lw_LUqhFJi_bAVINOUxk-3S0,1087824
|
| 11 |
+
triton/_C/libproton.so,sha256=h28LFUAt0ygMCCUJck5GBhkF5ZVwD2W7zUXiO515kkU,19354728
|
| 12 |
+
triton/_C/libtriton.so,sha256=dUbB1zHe0hXZZHFwnCi1HAJoR28fq9gj0rrrVGoBVno,415012112
|
| 13 |
+
triton/_C/libtriton/linear_layout.pyi,sha256=W6ebLarvNBCOkf2XLyao8r8xkUPCPVe66yV52Fz178k,2054
|
| 14 |
+
triton/__init__.py,sha256=luaBksq13RH6MNXcldVsKc7s2lNHf8Ovjze-4Ca3oCE,1661
|
| 15 |
+
triton/__pycache__/__init__.cpython-310.pyc,,
|
| 16 |
+
triton/__pycache__/_filecheck.cpython-310.pyc,,
|
| 17 |
+
triton/__pycache__/_internal_testing.cpython-310.pyc,,
|
| 18 |
+
triton/__pycache__/_utils.cpython-310.pyc,,
|
| 19 |
+
triton/__pycache__/errors.cpython-310.pyc,,
|
| 20 |
+
triton/__pycache__/knobs.cpython-310.pyc,,
|
| 21 |
+
triton/__pycache__/testing.cpython-310.pyc,,
|
| 22 |
+
triton/_filecheck.py,sha256=wUYaN_dlm57TuAWnRVUV4vzALLPyVD2x1o8_VSf05_M,3137
|
| 23 |
+
triton/_internal_testing.py,sha256=o_E1dnddiYl0kh0pSQYTjyUBXjsbRft1EygGgWYGHhk,8800
|
| 24 |
+
triton/_utils.py,sha256=Yx34bOz5Cl-_IQOy0dPQ8L3F_GjX5XHfmnbjrpedk24,3825
|
| 25 |
+
triton/backends/__init__.py,sha256=yL1El3IOc2ovinwBZnqALUlFCDpK7nfTrEv-QwXEeok,2554
|
| 26 |
+
triton/backends/__pycache__/__init__.cpython-310.pyc,,
|
| 27 |
+
triton/backends/__pycache__/compiler.cpython-310.pyc,,
|
| 28 |
+
triton/backends/__pycache__/driver.cpython-310.pyc,,
|
| 29 |
+
triton/backends/amd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 30 |
+
triton/backends/amd/__pycache__/__init__.cpython-310.pyc,,
|
| 31 |
+
triton/backends/amd/__pycache__/compiler.cpython-310.pyc,,
|
| 32 |
+
triton/backends/amd/__pycache__/driver.cpython-310.pyc,,
|
| 33 |
+
triton/backends/amd/compiler.py,sha256=YlVvkFNJzu1ihvmSb3LO2cXpkIB-B5GHOUXpPKjih9I,22981
|
| 34 |
+
triton/backends/amd/driver.c,sha256=4drnvEqTrPG86P2ErUyBQe299Q1i7MqW--EtkuFkRHk,18123
|
| 35 |
+
triton/backends/amd/driver.py,sha256=j2Vpo1dUUIsn0qcOEDTTPuGfDvnySp6qXk_5mc3fIEQ,32542
|
| 36 |
+
triton/backends/amd/include/hip/amd_detail/amd_channel_descriptor.h,sha256=vtPhkbVsVETTmNsAbxe9ZrAw0x0uehymm14ETYaxKH4,11574
|
| 37 |
+
triton/backends/amd/include/hip/amd_detail/amd_device_functions.h,sha256=TEndX0aKosjoo70nVwMm1fuQZUvnPSejVytf4GfjFn0,31924
|
| 38 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_atomic.h,sha256=bz1Vxv2ijOY2FODLQ6cDGKVz8rQAeLbgzvSB5idoXww,29043
|
| 39 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_common.h,sha256=snManECE3JbCl7YYKV3VyUdLTOeszT9zUt2CtNlLQtE,1371
|
| 40 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_gl_interop.h,sha256=VmiBrEVZcPaPA0I8bJR70gYAps_YkmZrW4uh7VeUR3M,3976
|
| 41 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_runtime.h,sha256=5RqXP9XdngcwDLfFpR-9IFlTGrwz9npF1_583veVUsg,14276
|
| 42 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_runtime_pt_api.h,sha256=voQP0IJlaAvPj8YsPGKTR54kx8v2F7RrAabH7lNt1jw,10359
|
| 43 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_unsafe_atomics.h,sha256=teqqASYBdrZB6cjCWgqPyVJzGNzRHMR1TgvRSC3e3Zc,25567
|
| 44 |
+
triton/backends/amd/include/hip/amd_detail/amd_hip_vector_types.h,sha256=YR8uozOKmRHjZSff9CLfpYKba8zmhYiL8Y8NnYKEoVY,56477
|
| 45 |
+
triton/backends/amd/include/hip/amd_detail/amd_math_functions.h,sha256=WFUwJdsr9otWS7jqQHHTEkEmtgzeiIx7NlVgovTnvv8,3048
|
| 46 |
+
triton/backends/amd/include/hip/amd_detail/amd_surface_functions.h,sha256=9GhglyiG94nDH0CiTmoK7dgCbBnfPtjk6h3QyYw9o8w,18608
|
| 47 |
+
triton/backends/amd/include/hip/amd_detail/amd_warp_functions.h,sha256=o8guSyIFursD0kHy9s56j0iYgAR887N0YPUtAHwp11w,22072
|
| 48 |
+
triton/backends/amd/include/hip/amd_detail/amd_warp_sync_functions.h,sha256=EZVx4RQ0L36iN_JWBOjAjOyoIbEgAUmWTvfOXj-MSiE,30172
|
| 49 |
+
triton/backends/amd/include/hip/amd_detail/device_library_decls.h,sha256=_IKANb9bN46MiU4tsT-ZY3VjT3SRQqL95jgz1ynkho4,7396
|
| 50 |
+
triton/backends/amd/include/hip/amd_detail/hip_assert.h,sha256=GZkGAptK0ZkyDXOEGdu00ys3paNhnnqy48OULLsVyqo,4360
|
| 51 |
+
triton/backends/amd/include/hip/amd_detail/hip_fp16_math_fwd.h,sha256=5u1Z_BWZlZ59jYOvXbWsgsPWO9kQGPH0jNliK5RxtAo,4923
|
| 52 |
+
triton/backends/amd/include/hip/amd_detail/hip_ldg.h,sha256=KAEZb9H4z4DDrkaloMOeWzahiDfI2V6c68vWT3jb5fU,3652
|
| 53 |
+
triton/backends/amd/include/hip/amd_detail/hip_prof_str.h,sha256=P3s3HmKJ_CGUoBDeh1dbGcA6hzgiNIx-ZTxr7WeVECk,738681
|
| 54 |
+
triton/backends/amd/include/hip/amd_detail/hip_runtime_prof.h,sha256=9u5l0FtaYCEKKSYLec2jVcie1edy6xyCcsmlN0Eb2Vs,2696
|
| 55 |
+
triton/backends/amd/include/hip/amd_detail/host_defines.h,sha256=w6H10dznswMgXo6jJBTIvhjOOQGznhgNrHm5R_hMv7U,10131
|
| 56 |
+
triton/backends/amd/include/hip/amd_detail/math_fwd.h,sha256=GgWSJPI_qWGfd50oPIhk95lZiHdkjrpWkTR7ddwpEB4,17219
|
| 57 |
+
triton/backends/amd/include/hip/amd_detail/ockl_image.h,sha256=yzE8YZpmpWJEs-ZpOAGEtDYDm3gEpY02hZVHcpRJf2c,14969
|
| 58 |
+
triton/backends/amd/include/hip/amd_detail/texture_fetch_functions.h,sha256=wOrUmdco-etPqO5QlKlUP0-SpFwUV3w_dfxuPsBCplU,18998
|
| 59 |
+
triton/backends/amd/include/hip/amd_detail/texture_indirect_functions.h,sha256=JWs-5xj-ubwOzNEp6QJI7kuAsqfxKthkwRvOKXTH3qM,23136
|
| 60 |
+
triton/backends/amd/include/hip/channel_descriptor.h,sha256=1tWF4ITCAYKWndpEigF5pwFUwkmYIknaW_ffi4JO8WI,1774
|
| 61 |
+
triton/backends/amd/include/hip/driver_types.h,sha256=0fnfIiFFbBV-jcDY0VRgYnanTDK-0f8cdNhJ4ccTIE8,31339
|
| 62 |
+
triton/backends/amd/include/hip/hip_common.h,sha256=QeUd37rxYiDd4Cfp4OI8O6TwGeG1GC34SOI_9bqgZUU,3430
|
| 63 |
+
triton/backends/amd/include/hip/hip_deprecated.h,sha256=kzTJMz9uKKPDhbYrKdAD1p7XmMPzpr-Uyk1vO37Zsz0,7758
|
| 64 |
+
triton/backends/amd/include/hip/hip_runtime.h,sha256=p_vihvfN-dHeztb7bWY7SJUDFfwyyuyWQ1v3hZnDuvo,2869
|
| 65 |
+
triton/backends/amd/include/hip/hip_runtime_api.h,sha256=8O2BTE-c2Lz4kF81is2jl_-8u4OVuxpllzxbVH7EVcA,444378
|
| 66 |
+
triton/backends/amd/include/hip/hip_texture_types.h,sha256=AhkvjG4cDjf_ZFLg5SsSTfBnXG614PBK1XVPa7irZbk,1237
|
| 67 |
+
triton/backends/amd/include/hip/hip_vector_types.h,sha256=wVhfPuNZ4wNsq2X_fWXrLgWCt6QyXuhkAGFMO5K6IEE,1631
|
| 68 |
+
triton/backends/amd/include/hip/hip_version.h,sha256=8vSeRMzQUJWCVmoy_5zxsQTkWzpd_CNWIIuPUre2w94,408
|
| 69 |
+
triton/backends/amd/include/hip/library_types.h,sha256=2ahq0onhFBlpb3iRf7loed4vqZY8J_vS1BQWqf8yfxE,2433
|
| 70 |
+
triton/backends/amd/include/hip/linker_types.h,sha256=BXq6VlLniYTCzypCz0yWuay2ucZzqxNek7onllpifXs,6691
|
| 71 |
+
triton/backends/amd/include/hip/surface_types.h,sha256=5e3ceH_JBjhxO8c0HiLS7iMBEFGWK1DcjDOQCixsnxU,1953
|
| 72 |
+
triton/backends/amd/include/hip/texture_types.h,sha256=8lyBxvKtY1QFURKN1pK2yngRvAwS2YGgrSDOH6HgTSw,6499
|
| 73 |
+
triton/backends/amd/include/hipblas-common/hipblas-common.h,sha256=nZLH2WYrcDDFefz9a08p2ygP-YaYIOuxUiObGvwXPTs,5450
|
| 74 |
+
triton/backends/amd/include/hsa/amd_hsa_kernel_code.h,sha256=L0ix__VDL7lqpGDTxawLzLLomWrfpezbUIci85Ef-dA,12754
|
| 75 |
+
triton/backends/amd/include/hsa/hsa.h,sha256=8NxQmaFcgSy2zfM89n7DXxOGviIqbQ8FiWz_8WkW5RQ,191415
|
| 76 |
+
triton/backends/amd/include/hsa/hsa_ext_amd.h,sha256=sVr04PILBcYLiyGdFf2UnBMsnZm66WxIU16bTsaerKo,136290
|
| 77 |
+
triton/backends/amd/include/hsa/hsa_ext_image.h,sha256=DFLmv3Z5C00pZ4hrKlAZleDwjXigU7I2IBdKuXS3txw,56383
|
| 78 |
+
triton/backends/amd/include/hsa/hsa_ven_amd_loader.h,sha256=c6cxPAzAox7u6IbFzEkQZfCuRl-Kr39WhY2_w23X1R4,26146
|
| 79 |
+
triton/backends/amd/include/hsa/hsa_ven_amd_pc_sampling.h,sha256=1jQvi96s94-GjOGktmvpqjVRsTGANugOsV6XmgMfivk,18767
|
| 80 |
+
triton/backends/amd/include/roctracer/ext/prof_protocol.h,sha256=6FAcvVD-dNM7uulFs2B-aTxw5xOAWGy6evdD4yUaebA,3849
|
| 81 |
+
triton/backends/amd/include/roctracer/roctracer.h,sha256=B8sHz2DMNprP7EqNWIGwVLY1KQMpxmhfVy4UoR8dzzY,23849
|
| 82 |
+
triton/backends/amd/include/roctracer/roctracer_ext.h,sha256=vLaZ8peAxSy0cwrdEalKnUApkKspfa04iw1Mr_Zcio0,2940
|
| 83 |
+
triton/backends/amd/include/roctracer/roctracer_hip.h,sha256=RCzYuNw1vLR7xK4rb06TtM9TU546UYKHJ83IMHmZEm8,1432
|
| 84 |
+
triton/backends/amd/include/roctracer/roctracer_roctx.h,sha256=gBjBk5vb0l3PbBSQ7V9iFtaM_RzkIDJEW1A_PXBihBM,2014
|
| 85 |
+
triton/backends/amd/include/roctracer/roctx.h,sha256=RhJXUXRhSJ5LRE_1gm7E6-bjEMrfcFBLDLuf3UxAIh8,6717
|
| 86 |
+
triton/backends/amd/lib/asanrtl.bc,sha256=1xv2RlU3WvbdsghHlmhwiHewGM2B5dKts5bERM6S89o,24508
|
| 87 |
+
triton/backends/amd/lib/ockl.bc,sha256=wQKCzkKukIHbu0lyjKUYlhndc7S27xto6L54J0Bn-C0,246124
|
| 88 |
+
triton/backends/amd/lib/ocml.bc,sha256=UPNTXW0gCXUNB-c6orSYwb-mz9_mjUc7zny_vfFza44,205964
|
| 89 |
+
triton/backends/compiler.py,sha256=xdNAO4i1u3KPiseMVRYxmOQYQw8SbIQoksaMtLa6qng,2834
|
| 90 |
+
triton/backends/driver.py,sha256=JcsL7pVHSIM13i1JWvc4KYum1MIPHTeUHcF3UcV6IR4,1802
|
| 91 |
+
triton/backends/nvidia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 92 |
+
triton/backends/nvidia/__pycache__/__init__.cpython-310.pyc,,
|
| 93 |
+
triton/backends/nvidia/__pycache__/compiler.cpython-310.pyc,,
|
| 94 |
+
triton/backends/nvidia/__pycache__/driver.cpython-310.pyc,,
|
| 95 |
+
triton/backends/nvidia/bin/cuobjdump,sha256=rR0PBpn0ZgNBbrWOe5_fmik-lfkxLJ33_W_aVqbDDUE,569008
|
| 96 |
+
triton/backends/nvidia/bin/nvdisasm,sha256=EIC8kJowIHYf9MeKm3vZtJN725wJeHCcvlI4HeYSofI,5894744
|
| 97 |
+
triton/backends/nvidia/bin/ptxas,sha256=yWCk8jixfVxdPAGtK7wevSxa7MRZy00iO_8QtF-bj8o,31912192
|
| 98 |
+
triton/backends/nvidia/bin/ptxas-blackwell,sha256=mDsOkoOFWXn0LOv9gNQ_m254brhPA_dXC_lBxNOjxGE,34931056
|
| 99 |
+
triton/backends/nvidia/compiler.py,sha256=7qVWmLqwDHJrPR1JWzkLcqY6qo0Wd4GmXqUhLTlNdvY,23589
|
| 100 |
+
triton/backends/nvidia/driver.c,sha256=Q5weiG-p6sc0bXUj0DugpMUqpMm1GOqG2GWbXAfrfck,19555
|
| 101 |
+
triton/backends/nvidia/driver.py,sha256=StS0RAqkpe4VrCOCrninqoApmGwi7CrL0HKpGBDoXpQ,25625
|
| 102 |
+
triton/backends/nvidia/include/Openacc/cupti_openacc.h,sha256=Z0OM5e_hbd3cxdXyn3SCHqBBQawLg4QORnlm57Cr2-M,3513
|
| 103 |
+
triton/backends/nvidia/include/Openmp/cupti_openmp.h,sha256=E1WNmeb_7HaUSmBegtUNe4IV1i7pXeNxgzIlyKn1zrM,3491
|
| 104 |
+
triton/backends/nvidia/include/Openmp/omp-tools.h,sha256=AmuC_xPC7VPu3B-W4PmXuCNufFawhY8PjNXePaQFAOg,37403
|
| 105 |
+
triton/backends/nvidia/include/builtin_types.h,sha256=JxT9Vf2q2snxTBOL9ACzNmYzTWACO2VOVUu1KdFt7_g,3150
|
| 106 |
+
triton/backends/nvidia/include/channel_descriptor.h,sha256=oZIDO1kdexPb9jltUx1AsXAFknvRWAAr1456925Pqig,21846
|
| 107 |
+
triton/backends/nvidia/include/common_functions.h,sha256=22LTZRVcPZzEH6MJda7nNMCvMgIjSTe0OKR7sEQj6kc,3410
|
| 108 |
+
triton/backends/nvidia/include/cooperative_groups.h,sha256=y2cFxa6e-saEFA9aW22ZuTwi0wud7eEHq7XN3v30LT0,60684
|
| 109 |
+
triton/backends/nvidia/include/cooperative_groups/details/async.h,sha256=xsEHCZP3nuEY3l2p8SU2d1226XiXumUvDP_Gyh8PdVY,19122
|
| 110 |
+
triton/backends/nvidia/include/cooperative_groups/details/coalesced_reduce.h,sha256=pBQgFY7i64V87XNATg1UEIQHVNYOItQtHjS5B4yn8pc,4257
|
| 111 |
+
triton/backends/nvidia/include/cooperative_groups/details/coalesced_scan.h,sha256=DfZv5d5W0XJv-tZVhgrIdjLjs6aCx_u0oy1lDIpjo1Q,7314
|
| 112 |
+
triton/backends/nvidia/include/cooperative_groups/details/driver_abi.h,sha256=v-ZUb4UgGKJk6NR2WCWHD3x_42y-togI1urFn70Gi-g,3964
|
| 113 |
+
triton/backends/nvidia/include/cooperative_groups/details/functional.h,sha256=2BV8i8Bidz0kgxuYkJCAbwFxOIZRyzHgG-c_rVKhRzc,8905
|
| 114 |
+
triton/backends/nvidia/include/cooperative_groups/details/helpers.h,sha256=K9jvxnXc5-6Fum1KG4EQKJJrVZ4BhHOSAJbZR4uDL0c,26476
|
| 115 |
+
triton/backends/nvidia/include/cooperative_groups/details/info.h,sha256=FOrp3Ltt4PcbK2fAM5UX9jssFZtj_LqVShzLFcKiSaY,12465
|
| 116 |
+
triton/backends/nvidia/include/cooperative_groups/details/invoke.h,sha256=Osq3K-tZuXHVCMQJ708PjPo-BwMhjhjApO4b0TYLFJg,8616
|
| 117 |
+
triton/backends/nvidia/include/cooperative_groups/details/memory.h,sha256=hES3SfgXIBsj2MFrC_M5COXlOirSBuuhPMAJnWoI92w,5606
|
| 118 |
+
triton/backends/nvidia/include/cooperative_groups/details/partitioning.h,sha256=AQz-TheqX3onqX2RmIUipzYUVB273zhLlHJw_kX9D2U,7153
|
| 119 |
+
triton/backends/nvidia/include/cooperative_groups/details/reduce.h,sha256=MjqMDwT0TyWZk4JWcF3WHw8xtwMqyizA4C3zy7f8ee0,23296
|
| 120 |
+
triton/backends/nvidia/include/cooperative_groups/details/scan.h,sha256=-Ttwb2AfEEY_tsmqJjR2dojkPpoRx387SoqxgvfdBtQ,17166
|
| 121 |
+
triton/backends/nvidia/include/cooperative_groups/details/sync.h,sha256=Ed4K9QrPZi43ddSqZwv1X8NG_CTsXUowSQndoUv82LU,10795
|
| 122 |
+
triton/backends/nvidia/include/cooperative_groups/memcpy_async.h,sha256=erOIHuObdfxRhBWfrXE3wsZF4B2GUuqwzQrsPwKPpbg,2960
|
| 123 |
+
triton/backends/nvidia/include/cooperative_groups/reduce.h,sha256=B0hgDkqM-6ueqTTgb3b34A0RH4vGz8mBf5e2jT1dJ1o,2949
|
| 124 |
+
triton/backends/nvidia/include/cooperative_groups/scan.h,sha256=2EU6T5cWNwftm2B7FicV31PojoI61yo5fHXGRYkGk40,2940
|
| 125 |
+
triton/backends/nvidia/include/crt/common_functions.h,sha256=-U44f4yUGmwDPwd7Q_3Cz5if05xHGPSlAzz5zMylLSQ,13559
|
| 126 |
+
triton/backends/nvidia/include/crt/cudacc_ext.h,sha256=KW6n0ImOZKS0VqVmBHWTXtHI816hh88YeEgUg2aYdVU,3224
|
| 127 |
+
triton/backends/nvidia/include/crt/device_double_functions.h,sha256=A1vB3g0qwnNEfcpT1d9RiGDaxqPXXgYr-Vxe2oMHyxY,39938
|
| 128 |
+
triton/backends/nvidia/include/crt/device_double_functions.hpp,sha256=YYIbqYhb5Qmf8c4YfcC_jytg4FRwcXPjv3TFTwhb24E,8568
|
| 129 |
+
triton/backends/nvidia/include/crt/device_fp128_functions.h,sha256=3iCKrdmPp1NIjrlGR47dCZOgV9X6MmdfmjugrF6DEts,51047
|
| 130 |
+
triton/backends/nvidia/include/crt/device_functions.h,sha256=T4INuRBIlLmd3JEA8H6B5XHVANGV6j8gwyUTj5h_F18,137919
|
| 131 |
+
triton/backends/nvidia/include/crt/device_functions.hpp,sha256=OVHiqBjday_aUFnDKJxTeI0VDZI8ZA6JIdUKeAKR4pA,37991
|
| 132 |
+
triton/backends/nvidia/include/crt/func_macro.h,sha256=EOpDlaM917bh9cwBiFBPF689DCMBw5hFarxLxFt-i74,1755
|
| 133 |
+
triton/backends/nvidia/include/crt/host_config.h,sha256=1eki3w5xuY00gIkdYbmSfZO2SoI8giZWYSTRIL2uFs0,12169
|
| 134 |
+
triton/backends/nvidia/include/crt/host_defines.h,sha256=fDU_0cQdtIvEdM0zZFKY0OboMANEMgHLblifPalPGLk,10102
|
| 135 |
+
triton/backends/nvidia/include/crt/host_runtime.h,sha256=lOpmkxFZVkEp8dcMAGEZRITsh-19o9jy39kdSNLc3Ng,10284
|
| 136 |
+
triton/backends/nvidia/include/crt/math_functions.h,sha256=LyGJ0XUthi6WEi-YVITInha9A6SFoB4fEUUU9zii7U8,238284
|
| 137 |
+
triton/backends/nvidia/include/crt/math_functions.hpp,sha256=u-CGbd0R2FZWdKG-6bdmGSor9KT_wnmISj63lPQKASM,100207
|
| 138 |
+
triton/backends/nvidia/include/crt/mma.h,sha256=BooWALDWATvZupJaL7-GFQRQYOotNe_Fy11I5NGh2FA,62695
|
| 139 |
+
triton/backends/nvidia/include/crt/mma.hpp,sha256=spo0LX71tUCipxK517Bssj0nc-ZHf8oMWzvHoYYB_6I,66599
|
| 140 |
+
triton/backends/nvidia/include/crt/nvfunctional,sha256=FDM0zqWO6bl9jpJKz9U8CMbjt6iTKh18tQalxAvRsag,16900
|
| 141 |
+
triton/backends/nvidia/include/crt/sm_100_rt.h,sha256=3cBiCU11OcjGYpr85edCN1q4m2z91FaGhBtuO0is4To,8987
|
| 142 |
+
triton/backends/nvidia/include/crt/sm_100_rt.hpp,sha256=vbI2CNCY08dDI7zXwp6BNceZKl0ceXG1lveq4w-VNao,6855
|
| 143 |
+
triton/backends/nvidia/include/crt/sm_70_rt.h,sha256=Kf830xymA-zmF7LsunFHLSNyhhT5UiJMocgoHBQeNns,6837
|
| 144 |
+
triton/backends/nvidia/include/crt/sm_70_rt.hpp,sha256=3a_rU-Y0MSB4htBDFY4PCQ_jXiWFTe7WT1ZyhMuCJOA,7837
|
| 145 |
+
triton/backends/nvidia/include/crt/sm_80_rt.h,sha256=MdJHWCRzLM__nDDf1go61rDsl9ydOW3oi6SZBfjUyc8,7743
|
| 146 |
+
triton/backends/nvidia/include/crt/sm_80_rt.hpp,sha256=o-rJu-jpehCeyABGgv-8dYRB7oJTCwuNdvSCq0VURdE,6705
|
| 147 |
+
triton/backends/nvidia/include/crt/sm_90_rt.h,sha256=an47m0XFBaJ3pUX9MlE4-nktP1jb3eJUXhQ3ntZtzc8,11445
|
| 148 |
+
triton/backends/nvidia/include/crt/sm_90_rt.hpp,sha256=YuqVygGV6rgtWtx1J9cPpEI3BXKQBII-Ez6oZFP3wrE,9228
|
| 149 |
+
triton/backends/nvidia/include/crt/storage_class.h,sha256=dzcOZ16pLaN8ejqHaXw4iHbBJ6fXWxfaU-sj2QjYzzg,4791
|
| 150 |
+
triton/backends/nvidia/include/cuComplex.h,sha256=WpcgpaiPhU_o9sTPMcNTEZuyXDIc8x3sz4dUWSztL2g,12186
|
| 151 |
+
triton/backends/nvidia/include/cuda.h,sha256=RWjMnnoyHkdwfNZAOYDyGsLi5VFwUA0OCj9U_rA6mss,1156988
|
| 152 |
+
triton/backends/nvidia/include/cudaEGL.h,sha256=iruZU9xSGAcJ29OEX4K_Uo1o4NGP9hggv2fiOZOfDQo,39955
|
| 153 |
+
triton/backends/nvidia/include/cudaEGLTypedefs.h,sha256=xF_FAN1Kar9oyHJ3cCU7jztTpxX8WylpiuYyYpGGHek,5645
|
| 154 |
+
triton/backends/nvidia/include/cudaGL.h,sha256=gMT1HPGa-siuji0gAsKYr4X45Lc29HKglC_ttNSGyUM,22501
|
| 155 |
+
triton/backends/nvidia/include/cudaGLTypedefs.h,sha256=dClpQI-LuXgF9rPSBsj7OkIg8g_fXDjT0hLZS8TGpOg,6576
|
| 156 |
+
triton/backends/nvidia/include/cudaProfilerTypedefs.h,sha256=F2aWLIKv_AhNbxNOaZVcRsxIh0kuscnV8UMWWxkBAlY,3297
|
| 157 |
+
triton/backends/nvidia/include/cudaTypedefs.h,sha256=SKfAvTOj19zxsiLGKhoxXPiopKqoe5hjj5iXkR2_v6E,115169
|
| 158 |
+
triton/backends/nvidia/include/cudaVDPAU.h,sha256=Np7Nc2Wjaz--hkpbhW6f9aapr-NbcPDAgkot0sJerco,12694
|
| 159 |
+
triton/backends/nvidia/include/cudaVDPAUTypedefs.h,sha256=wz8nyOUdwM9mH9JO3QZW-A9dyxt-IufSX7nggSXpCNs,4144
|
| 160 |
+
triton/backends/nvidia/include/cuda_awbarrier.h,sha256=3ZH-ZlXODhSiwSY9rqSni_EQwi25QMHP6Tm-zOdxBwE,9340
|
| 161 |
+
triton/backends/nvidia/include/cuda_awbarrier_helpers.h,sha256=OCskCts5bCKl_RKBe9M74zKSIsVpePn44S_aJp1tFXE,12489
|
| 162 |
+
triton/backends/nvidia/include/cuda_awbarrier_primitives.h,sha256=n5__E1jYYDhlgH-f3u8MQjtz57UZ7v5VshhMye1eicM,4699
|
| 163 |
+
triton/backends/nvidia/include/cuda_bf16.h,sha256=TVoq2IrbF5g67wUF7W7SoGA0l8ecEDu6gskoMB6hIxA,204512
|
| 164 |
+
triton/backends/nvidia/include/cuda_bf16.hpp,sha256=OukWXoN6bgRlC-p8CFbhUN0G0uAJb_zos1mCPagscnI,136544
|
| 165 |
+
triton/backends/nvidia/include/cuda_device_runtime_api.h,sha256=54l66QbwerX0wPKoJC2y7qCdGP8nv1_GgdmMV8A0x4k,46986
|
| 166 |
+
triton/backends/nvidia/include/cuda_egl_interop.h,sha256=awWBBEYvUFM7AURNp2mND8H7_5kGQLRswRveXYBy-3s,37509
|
| 167 |
+
triton/backends/nvidia/include/cuda_fp16.h,sha256=jrFgCo4uM9QFcr_-cAGif2BGp0lJ2ANT_gLPiLJWPdo,206851
|
| 168 |
+
triton/backends/nvidia/include/cuda_fp16.hpp,sha256=o1ITDmuN67N8YUGUcvTpV3IdpS-6wwlm65M_H-8LYKs,120927
|
| 169 |
+
triton/backends/nvidia/include/cuda_fp4.h,sha256=pTEQf5rLfiaU_UMXgnnsS13NH5H9FtHgdeiNuW_NkHY,13823
|
| 170 |
+
triton/backends/nvidia/include/cuda_fp4.hpp,sha256=YYaUu-YRgYdj9xYu4ZDh_uPVffxkDlEr0CD_bhlF8BE,35423
|
| 171 |
+
triton/backends/nvidia/include/cuda_fp6.h,sha256=6xh0E4SNmjmJZD3H5_HoZe08bQ0loUE8y3cbO19-Ad4,13963
|
| 172 |
+
triton/backends/nvidia/include/cuda_fp6.hpp,sha256=qa838buZeLP32xBVqbo71uFSW5RnBWx9qp5D-SR_xc0,56455
|
| 173 |
+
triton/backends/nvidia/include/cuda_fp8.h,sha256=QSTMRb9l7I9mnvT1_8KXNqLO48wWaWEgG97bDjEh1ic,18072
|
| 174 |
+
triton/backends/nvidia/include/cuda_fp8.hpp,sha256=6AABZPfPlK-jmQyMdbTEE0PZTlULjuLOrsQ0Z_cubBw,97230
|
| 175 |
+
triton/backends/nvidia/include/cuda_gl_interop.h,sha256=VQEswFeOBF6JN6Q0pdlkvc5WT7bD1FnTfKewvANulCc,19150
|
| 176 |
+
triton/backends/nvidia/include/cuda_occupancy.h,sha256=0HavrMIWXGxIujaq72iX31-73Zprx0WBYdiln3ZNP2w,71302
|
| 177 |
+
triton/backends/nvidia/include/cuda_pipeline.h,sha256=0enXG49wN4JajlQi3ahbp2ei_ufTY_Mznic7zfWmKHM,8130
|
| 178 |
+
triton/backends/nvidia/include/cuda_pipeline_helpers.h,sha256=bo1L7e6vCuM-K3Il8K1z4wJUja5DyXQKdo_hSWUME-E,13852
|
| 179 |
+
triton/backends/nvidia/include/cuda_pipeline_primitives.h,sha256=FnJJtuV6rHr6LgL56XDwilcSbFr6W1Hj6mf1AJaMI20,8675
|
| 180 |
+
triton/backends/nvidia/include/cuda_runtime.h,sha256=GqqE7SrECGrN-Qg5Dk90LSjs-xvKlHZpRLlpH7LUehM,98570
|
| 181 |
+
triton/backends/nvidia/include/cuda_runtime_api.h,sha256=EWhSESFT_vV5eYZpTBEu4EvgNtE9rhmHP503XnIGHIs,655943
|
| 182 |
+
triton/backends/nvidia/include/cuda_stdint.h,sha256=XbFOk9CtJjKqk7PpYNqbSVsDxAsVM8avA4rWpPi0BjQ,4093
|
| 183 |
+
triton/backends/nvidia/include/cuda_surface_types.h,sha256=Mw5Lo4b8Q-f9mogOvATGyHhu9d2t2K6XOxuqtZrSh3A,3688
|
| 184 |
+
triton/backends/nvidia/include/cuda_texture_types.h,sha256=ITbX-JNnP7Rm-JSgNVdJ9pq6k8FVor8RbnruDsKq6sk,3688
|
| 185 |
+
triton/backends/nvidia/include/cuda_vdpau_interop.h,sha256=bXQanWc2IFXZAKWNGl2xAz9nLvFmQpWyGrsDvfeS9FA,7727
|
| 186 |
+
triton/backends/nvidia/include/cudart_platform.h,sha256=YN6sKhB0b9w5tGX1IYL7ulJVPrWAiX9A44qLv4EtW5Q,2717
|
| 187 |
+
triton/backends/nvidia/include/cupti.h,sha256=JkVyAGTIMYzwm62dfVqas3nMcILhgP_Wdz6fh4_NED0,4697
|
| 188 |
+
triton/backends/nvidia/include/cupti_activity.h,sha256=gJKGlG2JifW36Lx-ujJcKBlnUrNOoTxar51k28GrUtU,229848
|
| 189 |
+
triton/backends/nvidia/include/cupti_activity_deprecated.h,sha256=B0p4zbll2vUn1j0ImTG6QIbpp6Hiw8y-X021Zmf7flE,137602
|
| 190 |
+
triton/backends/nvidia/include/cupti_callbacks.h,sha256=aZ-SE0YMFfT9R-Uh5MHboPg0ypHMjeSSAJw3zdP7OCs,29689
|
| 191 |
+
triton/backends/nvidia/include/cupti_checkpoint.h,sha256=rTz8JoWxqESBXyZWUhZJGm4xeYcx4OJOtJ7Ld13T_b0,5264
|
| 192 |
+
triton/backends/nvidia/include/cupti_common.h,sha256=85m74bxUgXp3tEaPQpezeazmpsNMw41PsjNSYmQdT20,3514
|
| 193 |
+
triton/backends/nvidia/include/cupti_driver_cbid.h,sha256=mkBNPYkLfcExhQZFDo0iYHlaHJWGD2vOMdtzaV-lEUk,77280
|
| 194 |
+
triton/backends/nvidia/include/cupti_events.h,sha256=81wcvFvvHj8RmECbbEp5FfgjJIQDoC_81FhvqznFupY,51923
|
| 195 |
+
triton/backends/nvidia/include/cupti_metrics.h,sha256=zmfZxq5VkUJp6Tj7oXEkP9oycRNw1zB9VNhoQlbhiN4,32175
|
| 196 |
+
triton/backends/nvidia/include/cupti_nvtx_cbid.h,sha256=_azPtR1g4qivvX7qbvHRUg0RHCWF7iEOJyHMN9qZe9E,5912
|
| 197 |
+
triton/backends/nvidia/include/cupti_pcsampling.h,sha256=ycJHT36DmPIaVzHsB3xxjXkhFyEfMCJOl3LbCsHFgyA,32144
|
| 198 |
+
triton/backends/nvidia/include/cupti_pcsampling_util.h,sha256=lx8CaNXowJe5Zvc06LE-u_Zry_jODs1mM6j9Q5WIX9E,12430
|
| 199 |
+
triton/backends/nvidia/include/cupti_pmsampling.h,sha256=U95hKOwIkZSbGNVP11QSmMawB8qdJsljY_tUJY4vedc,20440
|
| 200 |
+
triton/backends/nvidia/include/cupti_profiler_host.h,sha256=MkkfXlKBRrRL4NfaPFiuE4D4z_gpmxiBWWTBixyyMTk,22155
|
| 201 |
+
triton/backends/nvidia/include/cupti_profiler_target.h,sha256=MdLutIefwdMTI7wsce0LO3NuCm3FRgFR3GxAkqadMs4,32294
|
| 202 |
+
triton/backends/nvidia/include/cupti_range_profiler.h,sha256=ue5bUA-3xCwAtQGyDe5O1d5rAmRbVbcrXKfITd4xM1I,18779
|
| 203 |
+
triton/backends/nvidia/include/cupti_result.h,sha256=xQqBsZRoicBSWdk1lZAE_WeZj88MLH6ClTo58oshx-8,13114
|
| 204 |
+
triton/backends/nvidia/include/cupti_runtime_cbid.h,sha256=BZJnzsvf2RjRlHKEhPjCk0CdjLI9_L-nClTwe4v9NUc,48372
|
| 205 |
+
triton/backends/nvidia/include/cupti_sass_metrics.h,sha256=3RW9snJuFQdOhrEn3wDJOru05q0V_zssWrqD7tvVJKw,19674
|
| 206 |
+
triton/backends/nvidia/include/cupti_target.h,sha256=x4Vz1Upb6m9ixmVpmGaKQldDWYQI3OZ-ocEXGzNK0EE,1263
|
| 207 |
+
triton/backends/nvidia/include/cupti_version.h,sha256=KFXmjB4o-iZGvO8la9Sf9Urg4q4srmEimnxbPCyd2N8,4506
|
| 208 |
+
triton/backends/nvidia/include/device_atomic_functions.h,sha256=OR2jNSfSKzaFri74zh4Vtz5M0z9UDBU3rKeC1rYaVQs,9500
|
| 209 |
+
triton/backends/nvidia/include/device_atomic_functions.hpp,sha256=0e7MOiNNUnnloXpB_r9WT5YOws5cxgzQQAzRCYvgaFA,10486
|
| 210 |
+
triton/backends/nvidia/include/device_double_functions.h,sha256=KUxId5Z1fx8SWfLRTxPD7RB-zN7zslzb4n7JaJLfL3I,3452
|
| 211 |
+
triton/backends/nvidia/include/device_functions.h,sha256=bWSrhTYE9NQlss7xMSMEVusvto9j2fgUDXWVH2W_cOA,3410
|
| 212 |
+
triton/backends/nvidia/include/device_launch_parameters.h,sha256=H1_CC-vvAaS26ys4XsTFkMgTxUTciAjdjswjizkisvQ,3846
|
| 213 |
+
triton/backends/nvidia/include/device_types.h,sha256=2LFxoZBJPoA5V0H1EbKTEaXDi3GDJPtzOPdRHDaucIQ,3588
|
| 214 |
+
triton/backends/nvidia/include/driver_functions.h,sha256=cN3IjRAz2Mj2Pj35SyxJIkZNDDusnJqaqzBdMzpQKbA,4625
|
| 215 |
+
triton/backends/nvidia/include/driver_types.h,sha256=mMNbiIwg5E3k7Sk685YCSvnKYmfQ3bxWv3bkEgzOtNU,200083
|
| 216 |
+
triton/backends/nvidia/include/fatbinary_section.h,sha256=NnuUfy358yGJx4enq0pBnetjv17UWa-nOlgYToUitrw,1809
|
| 217 |
+
triton/backends/nvidia/include/generated_cudaGL_meta.h,sha256=dfd2QuaRdEjbStOKvaQLi1Md_qrpRQh8PfyZznJ8bWY,3115
|
| 218 |
+
triton/backends/nvidia/include/generated_cudaVDPAU_meta.h,sha256=fAedsoQxaU3hIAApAWDOKsa9kgcuQw4tdyf8klLm-3k,1453
|
| 219 |
+
triton/backends/nvidia/include/generated_cuda_gl_interop_meta.h,sha256=LXOqvQCej0sCgAT1LUKKYZ466EFxN4hIwf9oIhXOLF0,2250
|
| 220 |
+
triton/backends/nvidia/include/generated_cuda_meta.h,sha256=DDdgfW84GVtsGbr7daNJchmmZDS_xfvDHvFCm3I1OEc,98664
|
| 221 |
+
triton/backends/nvidia/include/generated_cuda_runtime_api_meta.h,sha256=CuziaDwO2Mh33paCLGKqi73PQfYNmzp38wYrhAK-fng,72208
|
| 222 |
+
triton/backends/nvidia/include/generated_cuda_vdpau_interop_meta.h,sha256=8OLqWN26aEYpTWUXtbHJvA5GYhVv3ybYVOTW7yK37z8,1367
|
| 223 |
+
triton/backends/nvidia/include/generated_cudart_removed_meta.h,sha256=X3I5WXmhtsJNNlgY7coJ5vg4t11G5FRR6Xo7MboIeck,5172
|
| 224 |
+
triton/backends/nvidia/include/generated_nvtx_meta.h,sha256=YHb_RD8g3s4m8PJn7Z0wnxvUHarl7BOAX5ADr-BL3HI,7513
|
| 225 |
+
triton/backends/nvidia/include/host_config.h,sha256=BscH_GazAZbbotddVzL5RmafbQ-QjRx8f-I1O01IBW8,3380
|
| 226 |
+
triton/backends/nvidia/include/host_defines.h,sha256=bBQwQF5C1N1c2qpLV56g1c-weu9Ysgz-gIf2Kn3uz_A,3386
|
| 227 |
+
triton/backends/nvidia/include/library_types.h,sha256=i-GFcw92wvcixs2bQjOj4I_q26HYY_VY4DpDvHWQCjY,5156
|
| 228 |
+
triton/backends/nvidia/include/math_constants.h,sha256=cV6hAyQe8X7f7MBtaKjjIJq3BycOUDp6I5cizJX5HLw,7608
|
| 229 |
+
triton/backends/nvidia/include/math_functions.h,sha256=5XcC6j-fJKttvhwc4hZNoLHNw808a2ZYIOtZ7ry7yd0,3398
|
| 230 |
+
triton/backends/nvidia/include/mma.h,sha256=IY_VenxuEncwGq92MhrWUb-Xswh0ekAXLy9Rbxhxa2Y,2932
|
| 231 |
+
triton/backends/nvidia/include/nvPTXCompiler.h,sha256=lF1ssKlrjsNWCsp0UdhbB6GyOgFCDO1q0ZBDzOswlj0,14471
|
| 232 |
+
triton/backends/nvidia/include/nvfunctional,sha256=IkFoCi_Q4OhP9nEuBI-5jWwFlR_PfG05hJH7lSMsfWc,2975
|
| 233 |
+
triton/backends/nvidia/include/nvperf_common.h,sha256=ykeTJ5I6c0z8KqMQh13hlJaMaHiqqVUB60oGXOCu7Bg,17255
|
| 234 |
+
triton/backends/nvidia/include/nvperf_cuda_host.h,sha256=gC0JWoUdTyAOJs8y4uoJIhie9Xq4yF4HzoumLsYNVzU,7562
|
| 235 |
+
triton/backends/nvidia/include/nvperf_host.h,sha256=wCB4mR8aIHWiqT1TsxztQgWBRh_yiq5ABFm8sb3_jwg,49197
|
| 236 |
+
triton/backends/nvidia/include/nvperf_target.h,sha256=jRqQtuNLTrCzPDdyeANkTrPEijSCTjLy2A1qjKu0SdM,23607
|
| 237 |
+
triton/backends/nvidia/include/sm_20_atomic_functions.h,sha256=x4ycINVq__l9B4SQPD-I48jQbKxxdBmgp8Vf2GO0Qfg,4478
|
| 238 |
+
triton/backends/nvidia/include/sm_20_atomic_functions.hpp,sha256=1l5NLM8DhDbqYZ_E51LoqElQJXObkbwo57d3r-4uEbE,4107
|
| 239 |
+
triton/backends/nvidia/include/sm_20_intrinsics.h,sha256=axeDr7y6nT1V6LzrSWNSaHUwXgiNjPbXn1T6Uh7hlNM,57702
|
| 240 |
+
triton/backends/nvidia/include/sm_20_intrinsics.hpp,sha256=mJTejRhw1prNiP_ax1OPbkYlhEqBqO4nVI3DRDXIzpo,8392
|
| 241 |
+
triton/backends/nvidia/include/sm_30_intrinsics.h,sha256=b6W8Vxp9vD9OCJI6lZuGyZYXEdQ3Ei8PTAloHNkwCcQ,16978
|
| 242 |
+
triton/backends/nvidia/include/sm_30_intrinsics.hpp,sha256=yX0ebd265tJ-BDhvluP2BhadPuWXpRZPI2eeQFFt5ys,24567
|
| 243 |
+
triton/backends/nvidia/include/sm_32_atomic_functions.h,sha256=HGnZgQHACE2AAb6zabGUURc53IsVZelc2BSJqvs9OgY,5703
|
| 244 |
+
triton/backends/nvidia/include/sm_32_atomic_functions.hpp,sha256=CQTTvOEYp-s5hqAgLvAon11vLYDrDp8cTHdel-XRzBQ,6592
|
| 245 |
+
triton/backends/nvidia/include/sm_32_intrinsics.h,sha256=Xdkogdsjy1vh8u3eGu0i5xTmHxBGAjj6_vVGR-spdOE,33539
|
| 246 |
+
triton/backends/nvidia/include/sm_32_intrinsics.hpp,sha256=Gl8aSLDLcit4W3pKQS19GsDG8RYcwD65HwYB_CeZe8M,70616
|
| 247 |
+
triton/backends/nvidia/include/sm_35_atomic_functions.h,sha256=a3XoEsKRCEOf0Q_5Y__rMfmC4pScv4VkUggVgVJVn44,2909
|
| 248 |
+
triton/backends/nvidia/include/sm_35_intrinsics.h,sha256=0mS5-LCgvZiTvL7-MG_4YwI-zWGvM-s4xyRuMkunMC8,2664
|
| 249 |
+
triton/backends/nvidia/include/sm_60_atomic_functions.h,sha256=_anfNaJsvQpDEorYeUKIkbizYkwrinBcG_ZCiECtLqI,13178
|
| 250 |
+
triton/backends/nvidia/include/sm_60_atomic_functions.hpp,sha256=cgIKddDn2B3QzYlzeBILAP1IRys74QCCxsH0QqaVGls,22903
|
| 251 |
+
triton/backends/nvidia/include/sm_61_intrinsics.h,sha256=h_MBL1UUDxQX_qOddSImzqyFjcrhhm_63G97pGDyreU,10902
|
| 252 |
+
triton/backends/nvidia/include/sm_61_intrinsics.hpp,sha256=N-nQvcBsPMT2Umy5zR69c9K1q366W-Jqe7NpoLTqTmg,6787
|
| 253 |
+
triton/backends/nvidia/include/surface_functions.h,sha256=b1O82SAvEgWWxA9uZTWQcGimzZUoem2QbAET3wh3fZc,6782
|
| 254 |
+
triton/backends/nvidia/include/surface_indirect_functions.h,sha256=vy9QuFVV-ezZP-x2RT9RLp2qIUgdngACOCmalSfVFPA,10877
|
| 255 |
+
triton/backends/nvidia/include/surface_types.h,sha256=XkFXD1nHbeSMgajR-UJE9uQ7TByzJnjdnUL4-yGiufk,4530
|
| 256 |
+
triton/backends/nvidia/include/texture_fetch_functions.h,sha256=KLCmUxf5aY5_UalX8tSFB6e4TrjA8hyUPxLOkMFltAo,12468
|
| 257 |
+
triton/backends/nvidia/include/texture_indirect_functions.h,sha256=lH_y3Ni-hq4RZ0_PMFbBM0th5-OmTn3TtqtpkHHhA8w,21163
|
| 258 |
+
triton/backends/nvidia/include/texture_types.h,sha256=73ntVyg8r8fzKy5VIk6yuvC45GDeWepaLIqIk-M3Ri8,6360
|
| 259 |
+
triton/backends/nvidia/include/vector_functions.h,sha256=WypGkL-IDbGOlay7g_G0p3HO7OLGRE0Do__JtiFoWxY,8003
|
| 260 |
+
triton/backends/nvidia/include/vector_functions.hpp,sha256=afXhNSd3LFTZo96EPtesTLfvxd4nTmLVzgkj967rTRg,10060
|
| 261 |
+
triton/backends/nvidia/include/vector_types.h,sha256=6CJ4yt3KD7zQVfm1NhrgqNYYEDEIZWwaivlFx12nhNg,13396
|
| 262 |
+
triton/backends/nvidia/lib/cupti/libcheckpoint.so,sha256=BrqCvQkje5NM8W2iFy7VlDxYLKo1x5tSz8_rD_cfclA,1644872
|
| 263 |
+
triton/backends/nvidia/lib/cupti/libcupti.so,sha256=_M3F_MfDL4z0s-2bF_fxh6GFpvoKW8wG40NMvRaHyAg,7595792
|
| 264 |
+
triton/backends/nvidia/lib/cupti/libcupti.so.12,sha256=_M3F_MfDL4z0s-2bF_fxh6GFpvoKW8wG40NMvRaHyAg,7595792
|
| 265 |
+
triton/backends/nvidia/lib/cupti/libcupti.so.2025.1.1,sha256=_M3F_MfDL4z0s-2bF_fxh6GFpvoKW8wG40NMvRaHyAg,7595792
|
| 266 |
+
triton/backends/nvidia/lib/cupti/libcupti_static.a,sha256=q22dskj52HUn40wsJ6-5g9AFD_aYtOSqIlNJrbRqOko,43563448
|
| 267 |
+
triton/backends/nvidia/lib/cupti/libnvperf_host.so,sha256=YJ9UBjwlPa_277p5_kklL90jJDCKsP-5kcwSXT6aHqs,25825936
|
| 268 |
+
triton/backends/nvidia/lib/cupti/libnvperf_host_static.a,sha256=sTLoX5YG81JXBoSKm3fLo0RAdP3HqISmgtx8L47XF-4,33480030
|
| 269 |
+
triton/backends/nvidia/lib/cupti/libnvperf_target.so,sha256=LxDhEJ_DQaV0NMKOQAa0WokkeAHiD1rOE1wwLBc-B3A,5275312
|
| 270 |
+
triton/backends/nvidia/lib/cupti/libpcsamplingutil.so,sha256=5vongwd5dPsnZb-py66_mAc233Tuv5lMWcdZaYiuyDs,970064
|
| 271 |
+
triton/backends/nvidia/lib/libdevice.10.bc,sha256=XC-uN8huaMOjhgWpX1EtfRLV89uYYxC-R_VzBKpype4,473728
|
| 272 |
+
triton/compiler/__init__.py,sha256=S0iIXHTRJL8MUqThupDtPyJVT0PA882c2dN5VwqOGxE,284
|
| 273 |
+
triton/compiler/__pycache__/__init__.cpython-310.pyc,,
|
| 274 |
+
triton/compiler/__pycache__/code_generator.cpython-310.pyc,,
|
| 275 |
+
triton/compiler/__pycache__/compiler.cpython-310.pyc,,
|
| 276 |
+
triton/compiler/__pycache__/errors.cpython-310.pyc,,
|
| 277 |
+
triton/compiler/__pycache__/make_launcher.cpython-310.pyc,,
|
| 278 |
+
triton/compiler/code_generator.py,sha256=yLgvcMg60QvAGQ-meGQ0i4lfcz1nZYo77K8TdGGY93g,72793
|
| 279 |
+
triton/compiler/compiler.py,sha256=KgY7t5CXd9NlmUUkQnfpANn3z8Nd6adYV4Rp7kuQ_Ok,20548
|
| 280 |
+
triton/compiler/errors.py,sha256=I9Y15pDWcL9heY4SWWdLeMDtW6Iiq2pFXzKfJ6dY_C0,1732
|
| 281 |
+
triton/compiler/make_launcher.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 282 |
+
triton/errors.py,sha256=8WfnuRKLG578mgY6cBA3ECruVMf9ULEKFNgRcJ6IhWM,89
|
| 283 |
+
triton/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 284 |
+
triton/experimental/__pycache__/__init__.cpython-310.pyc,,
|
| 285 |
+
triton/experimental/gluon/__init__.py,sha256=lcSGCgXqtSNqQxDuZhP4s7BStqgb81AULbtKY_nEjv4,211
|
| 286 |
+
triton/experimental/gluon/__pycache__/__init__.cpython-310.pyc,,
|
| 287 |
+
triton/experimental/gluon/__pycache__/_compiler.cpython-310.pyc,,
|
| 288 |
+
triton/experimental/gluon/__pycache__/_runtime.cpython-310.pyc,,
|
| 289 |
+
triton/experimental/gluon/_compiler.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 290 |
+
triton/experimental/gluon/_runtime.py,sha256=AVoWQuzXSKD02gZLAzbZ6iHw4uccf0rH-KpWVH-7ceI,3461
|
| 291 |
+
triton/experimental/gluon/amd/__init__.py,sha256=s4d3xgEuuCxSAA-0whosZP1av9RpDfiJjq-73B8mdlc,45
|
| 292 |
+
triton/experimental/gluon/amd/__pycache__/__init__.cpython-310.pyc,,
|
| 293 |
+
triton/experimental/gluon/amd/__pycache__/gfx1250.cpython-310.pyc,,
|
| 294 |
+
triton/experimental/gluon/amd/gfx1250.py,sha256=vltp7sQ3yydl42yTaK9wLt_inGtkVoVLblxzHuPp5rU,2005
|
| 295 |
+
triton/experimental/gluon/language/__init__.py,sha256=EWaK8cYuu82grq_CZtrIskXSYmLoojjHcGZKiep1Xto,2056
|
| 296 |
+
triton/experimental/gluon/language/__pycache__/__init__.cpython-310.pyc,,
|
| 297 |
+
triton/experimental/gluon/language/__pycache__/_core.cpython-310.pyc,,
|
| 298 |
+
triton/experimental/gluon/language/__pycache__/_layouts.cpython-310.pyc,,
|
| 299 |
+
triton/experimental/gluon/language/__pycache__/_math.cpython-310.pyc,,
|
| 300 |
+
triton/experimental/gluon/language/__pycache__/_semantic.cpython-310.pyc,,
|
| 301 |
+
triton/experimental/gluon/language/__pycache__/_standard.cpython-310.pyc,,
|
| 302 |
+
triton/experimental/gluon/language/_core.py,sha256=rfN2Wi6cHc5YmL5Q6ZUQAfJARYSAcu6LEODopT_0jeA,19736
|
| 303 |
+
triton/experimental/gluon/language/_layouts.py,sha256=mvf1zlM_ADn3TdUQS9atvRb0oGuxXq3ltwihI-l-P4w,24444
|
| 304 |
+
triton/experimental/gluon/language/_math.py,sha256=MN9Fvt8FaQTpxEUCKhw83IGbkwBD2Whdp686av4vv04,564
|
| 305 |
+
triton/experimental/gluon/language/_semantic.py,sha256=JGrIMOK0U_Og3NDDJJ4TJsB51Cuh49I47hzZ6GleQlk,28303
|
| 306 |
+
triton/experimental/gluon/language/_standard.py,sha256=378S3ehrgIBfyhIHD4vzyaEf-3OIBNURMHgtQg4Oou8,2765
|
| 307 |
+
triton/experimental/gluon/language/amd/__init__.py,sha256=80NUK1RoDQdRMbwJIqK79asQadcCI5rD2TlO3-H9F8o,220
|
| 308 |
+
triton/experimental/gluon/language/amd/__pycache__/__init__.cpython-310.pyc,,
|
| 309 |
+
triton/experimental/gluon/language/amd/__pycache__/_layouts.cpython-310.pyc,,
|
| 310 |
+
triton/experimental/gluon/language/amd/__pycache__/_ops.cpython-310.pyc,,
|
| 311 |
+
triton/experimental/gluon/language/amd/_layouts.py,sha256=i6S0zl-8ZpR6Ns6YKNPOiVPLB-FWwZr_QtQY2aDjgKs,7244
|
| 312 |
+
triton/experimental/gluon/language/amd/_ops.py,sha256=l5PInTbyrBIp3IkGAoQj7IVLNz8fD6JAsq8936Q-2js,3373
|
| 313 |
+
triton/experimental/gluon/language/amd/cdna3/__init__.py,sha256=DVt8NOVa6LY08fapFqrYoMNXYON90iVx_b9_8VVEx1o,10397
|
| 314 |
+
triton/experimental/gluon/language/amd/cdna3/__pycache__/__init__.cpython-310.pyc,,
|
| 315 |
+
triton/experimental/gluon/language/amd/cdna4/__init__.py,sha256=0e7PtofvZc1Ye5lXoCL-KdFez-TDbj5mtUue3ffH4os,5163
|
| 316 |
+
triton/experimental/gluon/language/amd/cdna4/__pycache__/__init__.cpython-310.pyc,,
|
| 317 |
+
triton/experimental/gluon/language/amd/cdna4/__pycache__/async_copy.cpython-310.pyc,,
|
| 318 |
+
triton/experimental/gluon/language/amd/cdna4/async_copy.py,sha256=5U-g1PxqJAbYdv_YZZ3g0z8C94WkoZ35gPGqZCe6JJg,7994
|
| 319 |
+
triton/experimental/gluon/language/amd/gfx1250/__init__.py,sha256=PXAxGE6lou0tKUS6zEA99x0eGPkJzHRaJg5cMDDB-j4,3622
|
| 320 |
+
triton/experimental/gluon/language/amd/gfx1250/__pycache__/__init__.cpython-310.pyc,,
|
| 321 |
+
triton/experimental/gluon/language/amd/gfx1250/__pycache__/async_copy.cpython-310.pyc,,
|
| 322 |
+
triton/experimental/gluon/language/amd/gfx1250/__pycache__/mbarrier.cpython-310.pyc,,
|
| 323 |
+
triton/experimental/gluon/language/amd/gfx1250/__pycache__/tdm.cpython-310.pyc,,
|
| 324 |
+
triton/experimental/gluon/language/amd/gfx1250/async_copy.py,sha256=XiVdff5KahNi7vR0YJBRvA7wUhfo9kRttU_W9sA52B0,2589
|
| 325 |
+
triton/experimental/gluon/language/amd/gfx1250/mbarrier.py,sha256=i1AbMgNiCdJDMJTI5iHtCRIECX0qD8g3s5c6jrqeCZg,2631
|
| 326 |
+
triton/experimental/gluon/language/amd/gfx1250/tdm.py,sha256=MR55lnc_Am4kGTMFqYP8W6xy0sguTRUBjlKj9KjhaDQ,7383
|
| 327 |
+
triton/experimental/gluon/language/amd/rdna3/__init__.py,sha256=J9a-Pw7Y86qewAvjahhG1UU3QDHKwOMVlSZeW0SiaIU,419
|
| 328 |
+
triton/experimental/gluon/language/amd/rdna3/__pycache__/__init__.cpython-310.pyc,,
|
| 329 |
+
triton/experimental/gluon/language/amd/rdna4/__init__.py,sha256=s5_7PQYh0m1YZN9NPr_eDYckIr-jrPDobsVl3DU9jJM,419
|
| 330 |
+
triton/experimental/gluon/language/amd/rdna4/__pycache__/__init__.cpython-310.pyc,,
|
| 331 |
+
triton/experimental/gluon/language/extra/__init__.py,sha256=FaDqvKRb8M8K47C3YceyfF3ZiZayLC8xZN248jNlxeQ,69
|
| 332 |
+
triton/experimental/gluon/language/extra/__pycache__/__init__.cpython-310.pyc,,
|
| 333 |
+
triton/experimental/gluon/language/nvidia/__init__.py,sha256=SFBuACK5P2XoYcutHEnKjqgRTboU4CPDmJz0hT6dFRQ,80
|
| 334 |
+
triton/experimental/gluon/language/nvidia/__pycache__/__init__.cpython-310.pyc,,
|
| 335 |
+
triton/experimental/gluon/language/nvidia/ampere/__init__.py,sha256=TZtb8V4yjN_ee7R5BPTbp7Qx7fPeYcaJBgl6EPlH0eU,1605
|
| 336 |
+
triton/experimental/gluon/language/nvidia/ampere/__pycache__/__init__.cpython-310.pyc,,
|
| 337 |
+
triton/experimental/gluon/language/nvidia/ampere/__pycache__/async_copy.cpython-310.pyc,,
|
| 338 |
+
triton/experimental/gluon/language/nvidia/ampere/__pycache__/mbarrier.cpython-310.pyc,,
|
| 339 |
+
triton/experimental/gluon/language/nvidia/ampere/async_copy.py,sha256=YfB0AN1hcEKWU2WTyef4ggWtp-HBnoSHJGoWhUTMmis,2817
|
| 340 |
+
triton/experimental/gluon/language/nvidia/ampere/mbarrier.py,sha256=UznWgajIlkZzk3Jf0T_elJR9f8BUX-y2qJ1Ee_pqv7Q,2455
|
| 341 |
+
triton/experimental/gluon/language/nvidia/blackwell/__init__.py,sha256=KlGdHEU7KugJ8xBwkACEUui4UKvqk9pKtMI0Wqp8VOI,17858
|
| 342 |
+
triton/experimental/gluon/language/nvidia/blackwell/__pycache__/__init__.cpython-310.pyc,,
|
| 343 |
+
triton/experimental/gluon/language/nvidia/blackwell/__pycache__/float2.cpython-310.pyc,,
|
| 344 |
+
triton/experimental/gluon/language/nvidia/blackwell/__pycache__/tma.cpython-310.pyc,,
|
| 345 |
+
triton/experimental/gluon/language/nvidia/blackwell/float2.py,sha256=WoFL-wMhsBTgHXyJhvjhbEOhF1NeiPdYOeardZGkWdM,3926
|
| 346 |
+
triton/experimental/gluon/language/nvidia/blackwell/tma.py,sha256=wlBEA-dfP6zhz-5TBFTH9xVN0vePt2vlXEBj9z37d7g,2065
|
| 347 |
+
triton/experimental/gluon/language/nvidia/hopper/__init__.py,sha256=6GVGQn67Di7YA5uH4Pu6iOS66S3P20fltFOKYvl4MZY,5369
|
| 348 |
+
triton/experimental/gluon/language/nvidia/hopper/__pycache__/__init__.cpython-310.pyc,,
|
| 349 |
+
triton/experimental/gluon/language/nvidia/hopper/__pycache__/mbarrier.cpython-310.pyc,,
|
| 350 |
+
triton/experimental/gluon/language/nvidia/hopper/__pycache__/tma.cpython-310.pyc,,
|
| 351 |
+
triton/experimental/gluon/language/nvidia/hopper/mbarrier.py,sha256=NF2dvXMKWzQ0mtWZQpCWKJKZzkINCZ24d8cKdqDT60Q,1339
|
| 352 |
+
triton/experimental/gluon/language/nvidia/hopper/tma.py,sha256=QRIK0Gb_QI3Al0ra4chyTK8xFFCWBoEkYxQjDyI_Uxc,6463
|
| 353 |
+
triton/experimental/gluon/nvidia/__init__.py,sha256=ISXB4RV7RcCLsU-JhcRFeA29gCBDVk8cTwO2j99ivLc,80
|
| 354 |
+
triton/experimental/gluon/nvidia/__pycache__/__init__.cpython-310.pyc,,
|
| 355 |
+
triton/experimental/gluon/nvidia/__pycache__/blackwell.cpython-310.pyc,,
|
| 356 |
+
triton/experimental/gluon/nvidia/__pycache__/hopper.cpython-310.pyc,,
|
| 357 |
+
triton/experimental/gluon/nvidia/blackwell.py,sha256=cllwlUCE5_YKWqySQZk7wt7Fierz345E5VwztxNRGMs,69
|
| 358 |
+
triton/experimental/gluon/nvidia/hopper.py,sha256=sGuSjjCjuKaefhW-tBcyQZUNCum-7-7TwmG0gy0h8X8,1925
|
| 359 |
+
triton/instrumentation/libGPUInstrumentationTestLib.so,sha256=0rA-19tttn3X5AQ92ztC1_Y1HsMijAAwrNmAGrRxn_M,6526160
|
| 360 |
+
triton/instrumentation/libPrintLoadStoreMemSpaces.so,sha256=02KBRgFQRYYk4YV1ELLY1ijPec2DOLcuj_ABrjN8LgY,9017144
|
| 361 |
+
triton/knobs.py,sha256=2EvaZk9zPwVH-fQ5fC2rEdofnFj5dKhAo_HGHqSMdvo,17262
|
| 362 |
+
triton/language/__init__.py,sha256=WOurIQ31Sk6pYA0FbEnUNrKkPgIxO_OdmQ1sT9SSdyg,6986
|
| 363 |
+
triton/language/__pycache__/__init__.cpython-310.pyc,,
|
| 364 |
+
triton/language/__pycache__/core.cpython-310.pyc,,
|
| 365 |
+
triton/language/__pycache__/math.cpython-310.pyc,,
|
| 366 |
+
triton/language/__pycache__/random.cpython-310.pyc,,
|
| 367 |
+
triton/language/__pycache__/semantic.cpython-310.pyc,,
|
| 368 |
+
triton/language/__pycache__/standard.cpython-310.pyc,,
|
| 369 |
+
triton/language/__pycache__/target_info.cpython-310.pyc,,
|
| 370 |
+
triton/language/core.py,sha256=k5TGAHHqC7ymwpDESlo3G4tKAmg9Up3rw74EQB2T4Zg,123101
|
| 371 |
+
triton/language/extra/__init__.py,sha256=XRXFvr7416pRsh_Rh-X6qV66SiEyVDVbxp4GSAE1mfc,655
|
| 372 |
+
triton/language/extra/__pycache__/__init__.cpython-310.pyc,,
|
| 373 |
+
triton/language/extra/__pycache__/libdevice.cpython-310.pyc,,
|
| 374 |
+
triton/language/extra/cuda/__init__.py,sha256=MBBu2EUYxsp6ygjiwO4Yh1X1EswMstfaiRTMSMGtbcw,407
|
| 375 |
+
triton/language/extra/cuda/__pycache__/__init__.cpython-310.pyc,,
|
| 376 |
+
triton/language/extra/cuda/__pycache__/gdc.cpython-310.pyc,,
|
| 377 |
+
triton/language/extra/cuda/__pycache__/libdevice.cpython-310.pyc,,
|
| 378 |
+
triton/language/extra/cuda/__pycache__/utils.cpython-310.pyc,,
|
| 379 |
+
triton/language/extra/cuda/gdc.py,sha256=rbVOcdD_w72sQ3-8l5KXafu-Tr0D5jYcY1fyok98WVQ,2193
|
| 380 |
+
triton/language/extra/cuda/libdevice.py,sha256=J7Kl0ejbAIus7-YBn2OSK71lkm3pC7G1J-5ZdHfS82U,56764
|
| 381 |
+
triton/language/extra/cuda/utils.py,sha256=phDcXCFViaq3p4ThwHrO8-FtU-8A8I3nk4mZZJVvTio,4426
|
| 382 |
+
triton/language/extra/hip/__init__.py,sha256=GFcuM-R0qCB5kDbysvjD5U2KUmOGNWcWzM8r8yqDI3Y,96
|
| 383 |
+
triton/language/extra/hip/__pycache__/__init__.cpython-310.pyc,,
|
| 384 |
+
triton/language/extra/hip/__pycache__/libdevice.cpython-310.pyc,,
|
| 385 |
+
triton/language/extra/hip/__pycache__/utils.cpython-310.pyc,,
|
| 386 |
+
triton/language/extra/hip/libdevice.py,sha256=LNynTEKXgE3PSZp-nUMVq4ft_i1y9Tao_cAvKKPn2s0,17542
|
| 387 |
+
triton/language/extra/hip/utils.py,sha256=tTq-k0c-s32IvDeGkgZcmosb9UtkF8sZEaE9EJGMbSA,877
|
| 388 |
+
triton/language/extra/libdevice.py,sha256=9gwrstjuvhwZH0uLgZhEQU3RvOJDZFY1oJT5-SZlpY4,6350
|
| 389 |
+
triton/language/math.py,sha256=CKvuIc5iMKhz7Qgx9w-VcLfOOZadv5svKK4aGZLuHMc,7399
|
| 390 |
+
triton/language/random.py,sha256=9EpDURuXQg6CQ4dG0XMNtq6jEmGQMgd2h_s2_-I3J7o,7116
|
| 391 |
+
triton/language/semantic.py,sha256=vjQp9tBpoi3cLKBI2A4WFt-F3lGksOHiDjBUJkpY8fg,101212
|
| 392 |
+
triton/language/standard.py,sha256=Gip7Fwb-mWWd2Gsp1jl9YD19DP70-Cf-kCpJRyjM3cE,16041
|
| 393 |
+
triton/language/target_info.py,sha256=UwWJDDsTPe9E4vPTQF4Psf1s540KKLISdnChlbvhHGY,1364
|
| 394 |
+
triton/profiler/__init__.py,sha256=b0XtXi8lPkxUEhD9DHkS9Rzi2JvWj57RbakLGui1jA8,284
|
| 395 |
+
triton/profiler/__pycache__/__init__.cpython-310.pyc,,
|
| 396 |
+
triton/profiler/__pycache__/context.cpython-310.pyc,,
|
| 397 |
+
triton/profiler/__pycache__/flags.cpython-310.pyc,,
|
| 398 |
+
triton/profiler/__pycache__/language.cpython-310.pyc,,
|
| 399 |
+
triton/profiler/__pycache__/mode.cpython-310.pyc,,
|
| 400 |
+
triton/profiler/__pycache__/profile.cpython-310.pyc,,
|
| 401 |
+
triton/profiler/__pycache__/proton.cpython-310.pyc,,
|
| 402 |
+
triton/profiler/__pycache__/scope.cpython-310.pyc,,
|
| 403 |
+
triton/profiler/__pycache__/specs.cpython-310.pyc,,
|
| 404 |
+
triton/profiler/__pycache__/state.cpython-310.pyc,,
|
| 405 |
+
triton/profiler/__pycache__/viewer.cpython-310.pyc,,
|
| 406 |
+
triton/profiler/context.py,sha256=JGQ1C2bPwpPvva3eITd8RxEgWcmvAkxAuB1mlKz9Jo0,506
|
| 407 |
+
triton/profiler/flags.py,sha256=5GBc3Oi-d9mWY0Sq3hAadARmv4TDNtAZ64hTO5vkoag,663
|
| 408 |
+
triton/profiler/hooks/__init__.py,sha256=qwb8ypLQ0oOFA3h9M3RtU1OhJR_wd2EZTKJ2pFNHeuo,123
|
| 409 |
+
triton/profiler/hooks/__pycache__/__init__.cpython-310.pyc,,
|
| 410 |
+
triton/profiler/hooks/__pycache__/hook.cpython-310.pyc,,
|
| 411 |
+
triton/profiler/hooks/__pycache__/instrumentation.cpython-310.pyc,,
|
| 412 |
+
triton/profiler/hooks/__pycache__/launch.cpython-310.pyc,,
|
| 413 |
+
triton/profiler/hooks/hook.py,sha256=7x5SI016VKj5a8t3LsO8tnFRR8OVN-p8E0aE_6VQnlo,4793
|
| 414 |
+
triton/profiler/hooks/instrumentation.py,sha256=2oYy9FXGU478a0zVxWWcU9ZSuIVzDfLA5JyIg0_HJOU,14849
|
| 415 |
+
triton/profiler/hooks/launch.py,sha256=PTKrBs85fGT-19soqcPg0DtefAYEi95T8BCEXdktOQU,1493
|
| 416 |
+
triton/profiler/language.py,sha256=u3JSs5YHQOS2uBZ-jEb2yDEo6iyuLmkTZKgLQlyOvl4,2116
|
| 417 |
+
triton/profiler/mode.py,sha256=-7P8jeG7SiEUOmBuAfQWv3nzTvmsHJBvgYUh-FJXD4Y,4367
|
| 418 |
+
triton/profiler/profile.py,sha256=wYXUmmEVpUEjdtdDWyp4r3FUnjjsx7Gz3m1eRxO6Jsg,8823
|
| 419 |
+
triton/profiler/proton.py,sha256=9SI06y225SFh-VrPwfDoU2B78Cy4GpWe1vGlMDOY32Y,3086
|
| 420 |
+
triton/profiler/scope.py,sha256=3GrGLominS6TjdfAJJyc1Gqgo0Nh--A0avskGDxwmls,3831
|
| 421 |
+
triton/profiler/specs.py,sha256=3v554WIsHHREMFxofDSMEQz18i0g0W_MJZKh6Op3nqM,2341
|
| 422 |
+
triton/profiler/state.py,sha256=SyXdwGYvKdpAOfFpW3OU0MVklnhPXHAX9yoIbvb26wA,1335
|
| 423 |
+
triton/profiler/viewer.py,sha256=zvnpPQbUfKyfyYDqr7wKKLgFAVJhSswxqHE_W_taK0s,18191
|
| 424 |
+
triton/runtime/__init__.py,sha256=mKL5cqIBDUw2WO80NRCh4s1G8KYaqgM59TTAbTkPPjQ,621
|
| 425 |
+
triton/runtime/__pycache__/__init__.cpython-310.pyc,,
|
| 426 |
+
triton/runtime/__pycache__/_allocation.cpython-310.pyc,,
|
| 427 |
+
triton/runtime/__pycache__/_async_compile.cpython-310.pyc,,
|
| 428 |
+
triton/runtime/__pycache__/autotuner.cpython-310.pyc,,
|
| 429 |
+
triton/runtime/__pycache__/build.cpython-310.pyc,,
|
| 430 |
+
triton/runtime/__pycache__/cache.cpython-310.pyc,,
|
| 431 |
+
triton/runtime/__pycache__/driver.cpython-310.pyc,,
|
| 432 |
+
triton/runtime/__pycache__/errors.cpython-310.pyc,,
|
| 433 |
+
triton/runtime/__pycache__/interpreter.cpython-310.pyc,,
|
| 434 |
+
triton/runtime/__pycache__/jit.cpython-310.pyc,,
|
| 435 |
+
triton/runtime/_allocation.py,sha256=XnujNofa5UAFq5D7r0APY6sOf9dDekoKSD7h14NohCk,1846
|
| 436 |
+
triton/runtime/_async_compile.py,sha256=JwPgzz-ofKn8TaNfMhR1agnCyDk_w27hzC-n63qsHRw,1953
|
| 437 |
+
triton/runtime/autotuner.py,sha256=QPXhQoBiGZQlhaFnQunzch1b_viBRbVxzzifmuxkYLs,20692
|
| 438 |
+
triton/runtime/build.py,sha256=Jsbd1NujU0zlR5DxLSt1cp9R5GfEiy90DdYrfHWoWzk,3928
|
| 439 |
+
triton/runtime/cache.py,sha256=A1XD40UvpFABIiRLj_-IZPIrwFxBej1vXa2p8ukvgEA,11041
|
| 440 |
+
triton/runtime/driver.py,sha256=2qxsJH3SFxYDSIffj2wXMGSviEatUQLkHFcmVboeK-A,1025
|
| 441 |
+
triton/runtime/errors.py,sha256=oM0HonEnBlnOx8e8XZidoAVQZ2Pg_YrA1NmIXAQxf6g,1325
|
| 442 |
+
triton/runtime/interpreter.py,sha256=PLbtL9oHDkshHy_2X93vhCKHvzIaYeiHTryT9sVwyVM,65073
|
| 443 |
+
triton/runtime/jit.py,sha256=C3A1jZAa_XCTejRKeBHkorzRDtyop8JB5HhC3JrGYMg,41084
|
| 444 |
+
triton/testing.py,sha256=ROP657TMQbTbO4tBpPCoGNf-nQNs_k4PTwgDanXqr-Q,20476
|
| 445 |
+
triton/tools/__init__.py,sha256=N18MiJ8bxNa1Odq3YjYSAFtAV35Vs4R87c2O8QwCamM,59
|
| 446 |
+
triton/tools/__pycache__/__init__.cpython-310.pyc,,
|
| 447 |
+
triton/tools/__pycache__/build_extern.cpython-310.pyc,,
|
| 448 |
+
triton/tools/__pycache__/compile.cpython-310.pyc,,
|
| 449 |
+
triton/tools/__pycache__/disasm.cpython-310.pyc,,
|
| 450 |
+
triton/tools/__pycache__/link.cpython-310.pyc,,
|
| 451 |
+
triton/tools/__pycache__/mxfp.cpython-310.pyc,,
|
| 452 |
+
triton/tools/__pycache__/ragged_tma.cpython-310.pyc,,
|
| 453 |
+
triton/tools/__pycache__/tensor_descriptor.cpython-310.pyc,,
|
| 454 |
+
triton/tools/build_extern.py,sha256=jCr-2hu3nLGBIJhCGUQ1jAyzLttughjkiPGEwRFjLR0,13673
|
| 455 |
+
triton/tools/compile.py,sha256=WpJ8HZlDaR3OGvrT3XSFlGdUyInd4g9EqsL2rXBGZ-Y,8786
|
| 456 |
+
triton/tools/disasm.py,sha256=T9jiTkdK_0nI3R_4uea0zvfioYdcR-zIZwTfuucgw6g,5026
|
| 457 |
+
triton/tools/extra/cuda/compile.c,sha256=F3K725kTI03oATPBdRbSnGHpOo11fGbE1aOelPTcRD8,2172
|
| 458 |
+
triton/tools/extra/cuda/compile.h,sha256=n9QKIFZTL4RSsiXtAxBP9XGSnxjyaevQQ9bBpwDsvAg,332
|
| 459 |
+
triton/tools/extra/hip/compile.cpp,sha256=IGdoA-52Nrk4S87Va6WJOIIi7G_4lhWZ6yjq8wkgG7k,1862
|
| 460 |
+
triton/tools/extra/hip/compile.h,sha256=BIRh2lo4kKXWcsomk89DKx3sY3_XLMGoCyJ5HYvl3GU,348
|
| 461 |
+
triton/tools/link.py,sha256=u7qtfZRLriZkAMEGNvj8YF-k1cthmLL7BwHYqBgT63E,11871
|
| 462 |
+
triton/tools/mxfp.py,sha256=YQdpBrGkOVNOtnLeRjMCeVFHWkSwUubGeWsItIjO8TU,11737
|
| 463 |
+
triton/tools/ragged_tma.py,sha256=KXiAhMTmyEclFHoUa92yQWdfHLYd1c8HyG1JTIZnEGM,3782
|
| 464 |
+
triton/tools/tensor_descriptor.py,sha256=1uA6pZF8j7W0BLXcv4KOfSdh7BLY_7VN5Kk3XGG2vlM,1562
|
| 465 |
+
triton/tools/triton_to_gluon_translater/__pycache__/translator.cpython-310.pyc,,
|
| 466 |
+
triton/tools/triton_to_gluon_translater/__pycache__/translator_helpers.cpython-310.pyc,,
|
| 467 |
+
triton/tools/triton_to_gluon_translater/translator.py,sha256=YQeCu6pROgo9m7ONdl5XSSrrJ0atzGQCC603vjlmHog,19912
|
| 468 |
+
triton/tools/triton_to_gluon_translater/translator_helpers.py,sha256=Hc1lUVwnyOtgdPziBLb9ybxNvVnB8pkGpEHvREQQs7w,26428
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (80.9.0)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp310-cp310-manylinux_2_27_x86_64
|
| 5 |
+
Tag: cp310-cp310-manylinux_2_28_x86_64
|
| 6 |
+
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
proton = triton.profiler.proton:main
|
| 3 |
+
proton-viewer = triton.profiler.viewer:main
|
| 4 |
+
|
| 5 |
+
[triton.backends]
|
| 6 |
+
amd = triton.backends.amd
|
| 7 |
+
nvidia = triton.backends.nvidia
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2018-2020 Philippe Tillet
|
| 3 |
+
* Copyright 2020-2022 OpenAI
|
| 4 |
+
*
|
| 5 |
+
* Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
* a copy of this software and associated documentation files
|
| 7 |
+
* (the "Software"), to deal in the Software without restriction,
|
| 8 |
+
* including without limitation the rights to use, copy, modify, merge,
|
| 9 |
+
* publish, distribute, sublicense, and/or sell copies of the Software,
|
| 10 |
+
* and to permit persons to whom the Software is furnished to do so,
|
| 11 |
+
* subject to the following conditions:
|
| 12 |
+
*
|
| 13 |
+
* The above copyright notice and this permission notice shall be
|
| 14 |
+
* included in all copies or substantial portions of the Software.
|
| 15 |
+
*
|
| 16 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
| 23 |
+
*/
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton-3.6.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
triton
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_double_functions.hpp
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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*
|
| 2 |
+
* Copyright 1993-2017 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/device_double_functions.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/device_double_functions.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_DOUBLE_FUNCTIONS_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__DEVICE_DOUBLE_FUNCTIONS_HPP__)
|
| 61 |
+
#define __DEVICE_DOUBLE_FUNCTIONS_HPP__
|
| 62 |
+
|
| 63 |
+
/*******************************************************************************
|
| 64 |
+
* *
|
| 65 |
+
* *
|
| 66 |
+
* *
|
| 67 |
+
*******************************************************************************/
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
/*******************************************************************************
|
| 72 |
+
* *
|
| 73 |
+
* *
|
| 74 |
+
* *
|
| 75 |
+
*******************************************************************************/
|
| 76 |
+
|
| 77 |
+
#if defined(__CUDACC_RTC__)
|
| 78 |
+
#define __DEVICE_DOUBLE_FUNCTIONS_DECL__ __device__
|
| 79 |
+
#else
|
| 80 |
+
#define __DEVICE_DOUBLE_FUNCTIONS_DECL__ static __inline__ __device__
|
| 81 |
+
#endif /* __CUDACC_RTC__ */
|
| 82 |
+
|
| 83 |
+
#include "builtin_types.h"
|
| 84 |
+
#include "device_types.h"
|
| 85 |
+
#include "host_defines.h"
|
| 86 |
+
|
| 87 |
+
/*******************************************************************************
|
| 88 |
+
* *
|
| 89 |
+
* *
|
| 90 |
+
* *
|
| 91 |
+
*******************************************************************************/
|
| 92 |
+
|
| 93 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double fma(double a, double b, double c, enum cudaRoundMode mode)
|
| 94 |
+
{
|
| 95 |
+
return mode == cudaRoundZero ? __fma_rz(a, b, c) :
|
| 96 |
+
mode == cudaRoundPosInf ? __fma_ru(a, b, c) :
|
| 97 |
+
mode == cudaRoundMinInf ? __fma_rd(a, b, c) :
|
| 98 |
+
__fma_rn(a, b, c);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double dmul(double a, double b, enum cudaRoundMode mode)
|
| 102 |
+
{
|
| 103 |
+
return mode == cudaRoundZero ? __dmul_rz(a, b) :
|
| 104 |
+
mode == cudaRoundPosInf ? __dmul_ru(a, b) :
|
| 105 |
+
mode == cudaRoundMinInf ? __dmul_rd(a, b) :
|
| 106 |
+
__dmul_rn(a, b);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double dadd(double a, double b, enum cudaRoundMode mode)
|
| 110 |
+
{
|
| 111 |
+
return mode == cudaRoundZero ? __dadd_rz(a, b) :
|
| 112 |
+
mode == cudaRoundPosInf ? __dadd_ru(a, b) :
|
| 113 |
+
mode == cudaRoundMinInf ? __dadd_rd(a, b) :
|
| 114 |
+
__dadd_rn(a, b);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double dsub(double a, double b, enum cudaRoundMode mode)
|
| 118 |
+
{
|
| 119 |
+
return mode == cudaRoundZero ? __dsub_rz(a, b) :
|
| 120 |
+
mode == cudaRoundPosInf ? __dsub_ru(a, b) :
|
| 121 |
+
mode == cudaRoundMinInf ? __dsub_rd(a, b) :
|
| 122 |
+
__dsub_rn(a, b);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ int double2int(double a, enum cudaRoundMode mode)
|
| 126 |
+
{
|
| 127 |
+
return mode == cudaRoundNearest ? __double2int_rn(a) :
|
| 128 |
+
mode == cudaRoundPosInf ? __double2int_ru(a) :
|
| 129 |
+
mode == cudaRoundMinInf ? __double2int_rd(a) :
|
| 130 |
+
__double2int_rz(a);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ unsigned int double2uint(double a, enum cudaRoundMode mode)
|
| 134 |
+
{
|
| 135 |
+
return mode == cudaRoundNearest ? __double2uint_rn(a) :
|
| 136 |
+
mode == cudaRoundPosInf ? __double2uint_ru(a) :
|
| 137 |
+
mode == cudaRoundMinInf ? __double2uint_rd(a) :
|
| 138 |
+
__double2uint_rz(a);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ long long int double2ll(double a, enum cudaRoundMode mode)
|
| 142 |
+
{
|
| 143 |
+
return mode == cudaRoundNearest ? __double2ll_rn(a) :
|
| 144 |
+
mode == cudaRoundPosInf ? __double2ll_ru(a) :
|
| 145 |
+
mode == cudaRoundMinInf ? __double2ll_rd(a) :
|
| 146 |
+
__double2ll_rz(a);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ unsigned long long int double2ull(double a, enum cudaRoundMode mode)
|
| 150 |
+
{
|
| 151 |
+
return mode == cudaRoundNearest ? __double2ull_rn(a) :
|
| 152 |
+
mode == cudaRoundPosInf ? __double2ull_ru(a) :
|
| 153 |
+
mode == cudaRoundMinInf ? __double2ull_rd(a) :
|
| 154 |
+
__double2ull_rz(a);
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double ll2double(long long int a, enum cudaRoundMode mode)
|
| 158 |
+
{
|
| 159 |
+
return mode == cudaRoundZero ? __ll2double_rz(a) :
|
| 160 |
+
mode == cudaRoundPosInf ? __ll2double_ru(a) :
|
| 161 |
+
mode == cudaRoundMinInf ? __ll2double_rd(a) :
|
| 162 |
+
__ll2double_rn(a);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double ull2double(unsigned long long int a, enum cudaRoundMode mode)
|
| 166 |
+
{
|
| 167 |
+
return mode == cudaRoundZero ? __ull2double_rz(a) :
|
| 168 |
+
mode == cudaRoundPosInf ? __ull2double_ru(a) :
|
| 169 |
+
mode == cudaRoundMinInf ? __ull2double_rd(a) :
|
| 170 |
+
__ull2double_rn(a);
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double int2double(int a, enum cudaRoundMode mode)
|
| 174 |
+
{
|
| 175 |
+
return (double)a;
|
| 176 |
+
}
|
| 177 |
+
|
| 178 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double uint2double(unsigned int a, enum cudaRoundMode mode)
|
| 179 |
+
{
|
| 180 |
+
return (double)a;
|
| 181 |
+
}
|
| 182 |
+
|
| 183 |
+
__DEVICE_DOUBLE_FUNCTIONS_DECL__ double float2double(float a, enum cudaRoundMode mode)
|
| 184 |
+
{
|
| 185 |
+
return (double)a;
|
| 186 |
+
}
|
| 187 |
+
|
| 188 |
+
#undef __DEVICE_DOUBLE_FUNCTIONS_DECL__
|
| 189 |
+
|
| 190 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 191 |
+
|
| 192 |
+
#endif /* !__DEVICE_DOUBLE_FUNCTIONS_HPP__ */
|
| 193 |
+
|
| 194 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_DOUBLE_FUNCTIONS_HPP__)
|
| 195 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 196 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_DOUBLE_FUNCTIONS_HPP__
|
| 197 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_fp128_functions.h
ADDED
|
@@ -0,0 +1,1217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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verables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
// to easily switch off fp128 device functions if needed
|
| 51 |
+
#ifndef __NV_DISABLE_DEVICE_FP128_FUNCTIONS__
|
| 52 |
+
|
| 53 |
+
#if !defined(__DEVICE_FP128_FUNCTIONS_H__)
|
| 54 |
+
#define __DEVICE_FP128_FUNCTIONS_H__
|
| 55 |
+
|
| 56 |
+
/*******************************************************************************
|
| 57 |
+
* *
|
| 58 |
+
* *
|
| 59 |
+
* *
|
| 60 |
+
*******************************************************************************/
|
| 61 |
+
|
| 62 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 63 |
+
|
| 64 |
+
/*******************************************************************************
|
| 65 |
+
* *
|
| 66 |
+
* *
|
| 67 |
+
* *
|
| 68 |
+
*******************************************************************************/
|
| 69 |
+
|
| 70 |
+
#include "builtin_types.h"
|
| 71 |
+
#include "device_types.h"
|
| 72 |
+
|
| 73 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 74 |
+
#define __DEF_IF_HOST { }
|
| 75 |
+
#define __INLINE_IF_HOST__ __inline__
|
| 76 |
+
#else /* !__CUDA_ARCH__ */
|
| 77 |
+
#define __DEF_IF_HOST ;
|
| 78 |
+
#define __INLINE_IF_HOST__
|
| 79 |
+
#endif /* __CUDA_ARCH__ */
|
| 80 |
+
|
| 81 |
+
#define __DEVICE_FP128_FUNCTIONS_DECL__ __device__ __cudart_builtin__ __INLINE_IF_HOST__
|
| 82 |
+
|
| 83 |
+
/*******************************************************************************
|
| 84 |
+
* *
|
| 85 |
+
* Support for __float128 on: *
|
| 86 |
+
* - NVRTC on Linux *
|
| 87 |
+
* - GCC version 4.1 or later on x86_64/amd64 *
|
| 88 |
+
* - Clang version 3.9 or later on x86_64/amd64 *
|
| 89 |
+
* - NVHPC version 21.1 or later on x86_64/amd64 *
|
| 90 |
+
* *
|
| 91 |
+
*******************************************************************************/
|
| 92 |
+
#if defined(__CUDACC_RTC__)
|
| 93 |
+
#if !_WIN64
|
| 94 |
+
#define __FLOAT128_CPP_SPELLING_ENABLED__
|
| 95 |
+
#endif
|
| 96 |
+
#else /* !__CUDACC_RTC__ */
|
| 97 |
+
|
| 98 |
+
#if (defined __NVCOMPILER_MAJOR__)
|
| 99 |
+
#if (defined(__x86_64__) || defined(__amd64__)) && \
|
| 100 |
+
((__NVCOMPILER_MAJOR__ > 21) || \
|
| 101 |
+
(__NVCOMPILER_MAJOR__ == 21 && __NVCOMPILER_MINOR__ >= 1))
|
| 102 |
+
#define __FLOAT128_CPP_SPELLING_ENABLED__
|
| 103 |
+
#endif
|
| 104 |
+
#elif defined(__clang__)
|
| 105 |
+
#if (defined(__x86_64__) || defined(__amd64__)) && \
|
| 106 |
+
((__clang_major__ > 3) || \
|
| 107 |
+
(__clang_major__ == 3 && __clang_minor__ >= 9))
|
| 108 |
+
#define __FLOAT128_CPP_SPELLING_ENABLED__
|
| 109 |
+
#endif
|
| 110 |
+
#elif defined(__GNUC__)
|
| 111 |
+
// check gcc version if no other host compiler is used
|
| 112 |
+
#if (defined(__x86_64__) || defined(__amd64__)) && \
|
| 113 |
+
((__GNUC__ > 4) || \
|
| 114 |
+
(__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
|
| 115 |
+
#define __FLOAT128_CPP_SPELLING_ENABLED__
|
| 116 |
+
#endif
|
| 117 |
+
#endif /* (defined __NVCOMPILER_MAJOR__) */
|
| 118 |
+
|
| 119 |
+
#endif /* !__CUDACC_RTC__ */
|
| 120 |
+
|
| 121 |
+
/*******************************************************************************
|
| 122 |
+
* *
|
| 123 |
+
* Support for _Float128 on: *
|
| 124 |
+
* - GCC version 13.1 or later on x86_64/amd64/aarch64 *
|
| 125 |
+
* *
|
| 126 |
+
*******************************************************************************/
|
| 127 |
+
#if defined(__GNUC__) && !defined(__clang__) && !defined(__NVCOMPILER_MAJOR__)
|
| 128 |
+
// check gcc version if no other host compiler is used
|
| 129 |
+
#if (defined(__x86_64__) || defined(__amd64__) || defined(__aarch64__)) && \
|
| 130 |
+
((__GNUC__ > 13) || \
|
| 131 |
+
(__GNUC__ == 13 && __GNUC_MINOR__ >= 1))
|
| 132 |
+
#define __FLOAT128_C_SPELLING_ENABLED__
|
| 133 |
+
#endif
|
| 134 |
+
#endif /* defined(__GNUC__) && !defined(__clang__) && !defined(__NVCOMPILER_MAJOR__) */
|
| 135 |
+
|
| 136 |
+
/**
|
| 137 |
+
* \defgroup CUDA_MATH_QUAD FP128 Quad Precision Mathematical Functions
|
| 138 |
+
* This section describes quad precision mathematical functions.
|
| 139 |
+
* To use these functions, include the header file \p device_fp128_functions.h in your program.
|
| 140 |
+
*
|
| 141 |
+
* Functions declared here have \p __nv_fp128_ prefix to distinguish them
|
| 142 |
+
* from other global namespace symbols.
|
| 143 |
+
*
|
| 144 |
+
* Note that FP128 CUDA Math functions are only available to device programs
|
| 145 |
+
* on platforms where host compiler supports the basic quad precision datatype
|
| 146 |
+
* \p __float128 or \p _Float128.
|
| 147 |
+
*
|
| 148 |
+
* Every FP128 CUDA Math function name is overloaded to support either of these
|
| 149 |
+
* host-compiler-specific types, whenever the types are available. See for example:
|
| 150 |
+
* \code
|
| 151 |
+
* #ifdef __FLOAT128_CPP_SPELLING_ENABLED__
|
| 152 |
+
* __float128 __nv_fp128_sqrt(__float128 x);
|
| 153 |
+
* #endif
|
| 154 |
+
* #ifdef __FLOAT128_C_SPELLING_ENABLED__
|
| 155 |
+
* _Float128 __nv_fp128_sqrt(_Float128 x);
|
| 156 |
+
* #endif
|
| 157 |
+
* \endcode
|
| 158 |
+
*
|
| 159 |
+
* \note_fp128_target_arch
|
| 160 |
+
*/
|
| 161 |
+
|
| 162 |
+
#ifdef __FLOAT128_CPP_SPELLING_ENABLED__
|
| 163 |
+
/**
|
| 164 |
+
* \ingroup CUDA_MATH_QUAD
|
| 165 |
+
* \brief Calculate \cuda_math_formula \sqrt{x} \end_cuda_math_formula, the square root of the input argument.
|
| 166 |
+
*
|
| 167 |
+
* \return
|
| 168 |
+
* \cuda_math_formula \sqrt{x} \end_cuda_math_formula.
|
| 169 |
+
* - __nv_fp128_sqrt(
|
| 170 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 171 |
+
* ) returns
|
| 172 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 173 |
+
* - __nv_fp128_sqrt(
|
| 174 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 175 |
+
* ) returns
|
| 176 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 177 |
+
* - __nv_fp128_sqrt(\p x) returns NaN if \p x is less than 0.
|
| 178 |
+
* - __nv_fp128_sqrt(NaN) returns NaN.
|
| 179 |
+
*
|
| 180 |
+
* \note_accuracy_quad
|
| 181 |
+
* \note_fp128_target_arch
|
| 182 |
+
*/
|
| 183 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_sqrt(__float128 x) __DEF_IF_HOST
|
| 184 |
+
/**
|
| 185 |
+
* \ingroup CUDA_MATH_QUAD
|
| 186 |
+
* \brief Calculate \cuda_math_formula \sin{x} \end_cuda_math_formula, the sine of input argument (measured in radians).
|
| 187 |
+
*
|
| 188 |
+
* \return
|
| 189 |
+
* \cuda_math_formula \sin{x} \end_cuda_math_formula.
|
| 190 |
+
* - __nv_fp128_sin(
|
| 191 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 192 |
+
* ) returns
|
| 193 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 194 |
+
* - __nv_fp128_sin(
|
| 195 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 196 |
+
* ) returns NaN.
|
| 197 |
+
* - __nv_fp128_sin(NaN) returns NaN.
|
| 198 |
+
*
|
| 199 |
+
* \note_accuracy_quad
|
| 200 |
+
* \note_fp128_target_arch
|
| 201 |
+
*/
|
| 202 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_sin(__float128 x) __DEF_IF_HOST
|
| 203 |
+
/**
|
| 204 |
+
* \ingroup CUDA_MATH_QUAD
|
| 205 |
+
* \brief Calculate \cuda_math_formula \cos{x} \end_cuda_math_formula, the cosine of input argument (measured in radians).
|
| 206 |
+
*
|
| 207 |
+
* \return
|
| 208 |
+
* \cuda_math_formula \cos{x} \end_cuda_math_formula.
|
| 209 |
+
* - __nv_fp128_cos(
|
| 210 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 211 |
+
* ) returns
|
| 212 |
+
* \cuda_math_formula 1 \end_cuda_math_formula.
|
| 213 |
+
* - __nv_fp128_cos(
|
| 214 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 215 |
+
* ) returns NaN.
|
| 216 |
+
* - __nv_fp128_cos(NaN) returns NaN.
|
| 217 |
+
*
|
| 218 |
+
* \note_accuracy_quad
|
| 219 |
+
* \note_fp128_target_arch
|
| 220 |
+
*/
|
| 221 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_cos(__float128 x) __DEF_IF_HOST
|
| 222 |
+
/**
|
| 223 |
+
* \ingroup CUDA_MATH_QUAD
|
| 224 |
+
* \brief Calculate \cuda_math_formula \tan{x} \end_cuda_math_formula, the tangent of input argument (measured in radians).
|
| 225 |
+
*
|
| 226 |
+
* \return
|
| 227 |
+
* \cuda_math_formula \tan{x} \end_cuda_math_formula.
|
| 228 |
+
* - __nv_fp128_tan(
|
| 229 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 230 |
+
* ) returns
|
| 231 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 232 |
+
* - __nv_fp128_tan(
|
| 233 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 234 |
+
* ) returns NaN.
|
| 235 |
+
* - __nv_fp128_tan(NaN) returns NaN.
|
| 236 |
+
*
|
| 237 |
+
* \note_accuracy_quad
|
| 238 |
+
* \note_fp128_target_arch
|
| 239 |
+
*/
|
| 240 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_tan(__float128 x) __DEF_IF_HOST
|
| 241 |
+
/**
|
| 242 |
+
* \ingroup CUDA_MATH_QUAD
|
| 243 |
+
* \brief Calculate \cuda_math_formula \sin^{-1}{x} \end_cuda_math_formula, the arc sine of input argument.
|
| 244 |
+
*
|
| 245 |
+
* \return
|
| 246 |
+
* The principal value of the arc sine of the input argument \p x.
|
| 247 |
+
* Result will be in radians, in the interval [-
|
| 248 |
+
* \cuda_math_formula \pi/2 \end_cuda_math_formula
|
| 249 |
+
* , +
|
| 250 |
+
* \cuda_math_formula \pi/2 \end_cuda_math_formula
|
| 251 |
+
* ] for \p x inside [-1, +1].
|
| 252 |
+
* - __nv_fp128_asin(
|
| 253 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 254 |
+
* ) returns
|
| 255 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 256 |
+
* - __nv_fp128_asin(\p x) returns NaN for \p x outside [-1, +1].
|
| 257 |
+
* - __nv_fp128_asin(NaN) returns NaN.
|
| 258 |
+
*
|
| 259 |
+
* \note_accuracy_quad
|
| 260 |
+
* \note_fp128_target_arch
|
| 261 |
+
*/
|
| 262 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_asin(__float128 x) __DEF_IF_HOST
|
| 263 |
+
/**
|
| 264 |
+
* \ingroup CUDA_MATH_QUAD
|
| 265 |
+
* \brief Calculate \cuda_math_formula \cos^{-1}{x} \end_cuda_math_formula, the arc cosine of input argument.
|
| 266 |
+
*
|
| 267 |
+
* \return
|
| 268 |
+
* The principal value of the arc cosine of the input argument \p x.
|
| 269 |
+
* Result will be in radians, in the interval [0,
|
| 270 |
+
* \cuda_math_formula \pi \end_cuda_math_formula
|
| 271 |
+
* ] for \p x inside [-1, +1].
|
| 272 |
+
* - __nv_fp128_acos(1) returns +0.
|
| 273 |
+
* - __nv_fp128_acos(\p x) returns NaN for \p x outside [-1, +1].
|
| 274 |
+
* - __nv_fp128_acos(NaN) returns NaN.
|
| 275 |
+
*
|
| 276 |
+
* \note_accuracy_quad
|
| 277 |
+
* \note_fp128_target_arch
|
| 278 |
+
*/
|
| 279 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_acos(__float128 x) __DEF_IF_HOST
|
| 280 |
+
/**
|
| 281 |
+
* \ingroup CUDA_MATH_QUAD
|
| 282 |
+
* \brief Calculate \cuda_math_formula \tan^{-1}{x} \end_cuda_math_formula, the arc tangent of input argument.
|
| 283 |
+
*
|
| 284 |
+
* \return
|
| 285 |
+
* The principal value of the arc tangent of the input argument \p x.
|
| 286 |
+
* Result will be in radians, in the interval [-
|
| 287 |
+
* \cuda_math_formula \pi/2 \end_cuda_math_formula
|
| 288 |
+
* , +
|
| 289 |
+
* \cuda_math_formula \pi/2 \end_cuda_math_formula
|
| 290 |
+
* ].
|
| 291 |
+
* - __nv_fp128_atan(
|
| 292 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 293 |
+
* ) returns
|
| 294 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 295 |
+
* - __nv_fp128_atan(
|
| 296 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 297 |
+
* ) returns
|
| 298 |
+
* \cuda_math_formula \pm \pi \end_cuda_math_formula
|
| 299 |
+
* /2.
|
| 300 |
+
* - __nv_fp128_atan(NaN) returns NaN.
|
| 301 |
+
*
|
| 302 |
+
* \note_accuracy_quad
|
| 303 |
+
* \note_fp128_target_arch
|
| 304 |
+
*/
|
| 305 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_atan(__float128 x) __DEF_IF_HOST
|
| 306 |
+
/**
|
| 307 |
+
* \ingroup CUDA_MATH_QUAD
|
| 308 |
+
* \brief Calculate \cuda_math_formula e^x \end_cuda_math_formula, the base
|
| 309 |
+
* \cuda_math_formula e \end_cuda_math_formula
|
| 310 |
+
* exponential of the input argument.
|
| 311 |
+
*
|
| 312 |
+
* \return
|
| 313 |
+
* - __nv_fp128_exp(
|
| 314 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 315 |
+
* ) returns 1.
|
| 316 |
+
* - __nv_fp128_exp(
|
| 317 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 318 |
+
* ) returns +0.
|
| 319 |
+
* - __nv_fp128_exp(
|
| 320 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 321 |
+
* ) returns
|
| 322 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 323 |
+
* - __nv_fp128_exp(NaN) returns NaN.
|
| 324 |
+
*
|
| 325 |
+
* \note_accuracy_quad
|
| 326 |
+
* \note_fp128_target_arch
|
| 327 |
+
*/
|
| 328 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_exp(__float128 x) __DEF_IF_HOST
|
| 329 |
+
/**
|
| 330 |
+
* \ingroup CUDA_MATH_QUAD
|
| 331 |
+
* \brief Calculate \cuda_math_formula 2^x \end_cuda_math_formula, the base 2 exponential of the input argument.
|
| 332 |
+
*
|
| 333 |
+
* \return
|
| 334 |
+
* - __nv_fp128_exp2(
|
| 335 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 336 |
+
* ) returns 1.
|
| 337 |
+
* - ex__nv_fp128_exp2p2f(
|
| 338 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 339 |
+
* ) returns +0.
|
| 340 |
+
* - __nv_fp128_exp2(
|
| 341 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 342 |
+
* ) returns
|
| 343 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 344 |
+
* - __nv_fp128_exp2(NaN) returns NaN.
|
| 345 |
+
*
|
| 346 |
+
* \note_accuracy_quad
|
| 347 |
+
* \note_fp128_target_arch
|
| 348 |
+
*/
|
| 349 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_exp2(__float128 x) __DEF_IF_HOST
|
| 350 |
+
/**
|
| 351 |
+
* \ingroup CUDA_MATH_QUAD
|
| 352 |
+
* \brief Calculate \cuda_math_formula 10^x \end_cuda_math_formula, the base 10 exponential of the input argument.
|
| 353 |
+
*
|
| 354 |
+
* \return
|
| 355 |
+
* - __nv_fp128_exp10(
|
| 356 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 357 |
+
* ) returns 1.
|
| 358 |
+
* - __nv_fp128_exp10(
|
| 359 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 360 |
+
* ) returns +0.
|
| 361 |
+
* - __nv_fp128_exp10(
|
| 362 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 363 |
+
* ) returns
|
| 364 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 365 |
+
* - __nv_fp128_exp10(NaN) returns NaN.
|
| 366 |
+
*
|
| 367 |
+
* \note_accuracy_quad
|
| 368 |
+
* \note_fp128_target_arch
|
| 369 |
+
*/
|
| 370 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_exp10(__float128 x) __DEF_IF_HOST
|
| 371 |
+
/**
|
| 372 |
+
* \ingroup CUDA_MATH_QUAD
|
| 373 |
+
* \brief Calculate
|
| 374 |
+
* \cuda_math_formula e^x - 1 \end_cuda_math_formula,
|
| 375 |
+
* the base e exponential of the input argument, minus 1.
|
| 376 |
+
*
|
| 377 |
+
* \return
|
| 378 |
+
* - __nv_fp128_expm1(
|
| 379 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 380 |
+
* ) returns
|
| 381 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 382 |
+
* - __nv_fp128_expm1(
|
| 383 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 384 |
+
* ) returns -1.
|
| 385 |
+
* - __nv_fp128_expm1(
|
| 386 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 387 |
+
* ) returns
|
| 388 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 389 |
+
* - __nv_fp128_expm1(NaN) returns NaN.
|
| 390 |
+
*
|
| 391 |
+
* \note_accuracy_quad
|
| 392 |
+
* \note_fp128_target_arch
|
| 393 |
+
*/
|
| 394 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_expm1(__float128 x) __DEF_IF_HOST
|
| 395 |
+
/**
|
| 396 |
+
* \ingroup CUDA_MATH_QUAD
|
| 397 |
+
* \brief Calculate \cuda_math_formula \log_{e}{x} \end_cuda_math_formula, the base
|
| 398 |
+
* \cuda_math_formula e \end_cuda_math_formula
|
| 399 |
+
* logarithm of the input argument.
|
| 400 |
+
*
|
| 401 |
+
* \return
|
| 402 |
+
* - __nv_fp128_log(
|
| 403 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 404 |
+
* ) returns
|
| 405 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula.
|
| 406 |
+
* - __nv_fp128_log(1) returns +0.
|
| 407 |
+
* - __nv_fp128_log(\p x) returns NaN for \p x < 0.
|
| 408 |
+
* - __nv_fp128_log(
|
| 409 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 410 |
+
* ) returns
|
| 411 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 412 |
+
* - __nv_fp128_log(NaN) returns NaN.
|
| 413 |
+
*
|
| 414 |
+
* \note_accuracy_quad
|
| 415 |
+
* \note_fp128_target_arch
|
| 416 |
+
*/
|
| 417 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_log(__float128 x) __DEF_IF_HOST
|
| 418 |
+
/**
|
| 419 |
+
* \ingroup CUDA_MATH_QUAD
|
| 420 |
+
* \brief Calculate \cuda_math_formula \log_{2}{x} \end_cuda_math_formula, the base 2 logarithm of the input argument.
|
| 421 |
+
*
|
| 422 |
+
* \return
|
| 423 |
+
* - __nv_fp128_log2(
|
| 424 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 425 |
+
* ) returns
|
| 426 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula.
|
| 427 |
+
* - __nv_fp128_log2(1) returns +0.
|
| 428 |
+
* - __nv_fp128_log2(\p x) returns NaN for \p x < 0.
|
| 429 |
+
* - __nv_fp128_log2(
|
| 430 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 431 |
+
* ) returns
|
| 432 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 433 |
+
* - __nv_fp128_log2(NaN) returns NaN.
|
| 434 |
+
*
|
| 435 |
+
* \note_accuracy_quad
|
| 436 |
+
* \note_fp128_target_arch
|
| 437 |
+
*/
|
| 438 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_log2(__float128 x) __DEF_IF_HOST
|
| 439 |
+
/**
|
| 440 |
+
* \ingroup CUDA_MATH_QUAD
|
| 441 |
+
* \brief Calculate \cuda_math_formula \log_{10}{x} \end_cuda_math_formula, the base 10 logarithm of the input argument.
|
| 442 |
+
*
|
| 443 |
+
* \return
|
| 444 |
+
* - __nv_fp128_log10(
|
| 445 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 446 |
+
* ) returns
|
| 447 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula.
|
| 448 |
+
* - __nv_fp128_log10(1) returns +0.
|
| 449 |
+
* - __nv_fp128_log10(\p x) returns NaN for \p x < 0.
|
| 450 |
+
* - __nv_fp128_log10(
|
| 451 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 452 |
+
* ) returns
|
| 453 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 454 |
+
* - __nv_fp128_log10(NaN) returns NaN.
|
| 455 |
+
*
|
| 456 |
+
* \note_accuracy_quad
|
| 457 |
+
* \note_fp128_target_arch
|
| 458 |
+
*/
|
| 459 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_log10(__float128 x) __DEF_IF_HOST
|
| 460 |
+
/**
|
| 461 |
+
* \ingroup CUDA_MATH_QUAD
|
| 462 |
+
* \brief Calculate the value of
|
| 463 |
+
* \cuda_math_formula \log_{e}(1+x) \end_cuda_math_formula.
|
| 464 |
+
*
|
| 465 |
+
* \return
|
| 466 |
+
* - __nv_fp128_log1p(
|
| 467 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 468 |
+
* ) returns
|
| 469 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 470 |
+
* - __nv_fp128_log1p(-1) returns
|
| 471 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula.
|
| 472 |
+
* - __nv_fp128_log1p(\p x) returns NaN for \p x < -1.
|
| 473 |
+
* - __nv_fp128_log1p(
|
| 474 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 475 |
+
* ) returns
|
| 476 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 477 |
+
* - __nv_fp128_log1p(NaN) returns NaN.
|
| 478 |
+
*
|
| 479 |
+
* \note_accuracy_quad
|
| 480 |
+
* \note_fp128_target_arch
|
| 481 |
+
*/
|
| 482 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_log1p(__float128 x) __DEF_IF_HOST
|
| 483 |
+
/**
|
| 484 |
+
* \ingroup CUDA_MATH_QUAD
|
| 485 |
+
* \brief Calculate the value of \cuda_math_formula x^{y} \end_cuda_math_formula, first argument to the power of second argument.
|
| 486 |
+
*
|
| 487 |
+
* \return
|
| 488 |
+
* - __nv_fp128_pow(
|
| 489 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 490 |
+
* , \p y) returns
|
| 491 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 492 |
+
* for \p y an odd integer less than 0.
|
| 493 |
+
* - __nv_fp128_pow(
|
| 494 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 495 |
+
* , \p y) returns
|
| 496 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 497 |
+
* for \p y less than 0 and not an odd integer.
|
| 498 |
+
* - __nv_fp128_pow(
|
| 499 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 500 |
+
* , \p y) returns
|
| 501 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 502 |
+
* for \p y an odd integer greater than 0.
|
| 503 |
+
* - __nv_fp128_pow(
|
| 504 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 505 |
+
* , \p y) returns +0 for \p y > 0 and not an odd integer.
|
| 506 |
+
* - __nv_fp128_pow(-1,
|
| 507 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 508 |
+
* ) returns 1.
|
| 509 |
+
* - __nv_fp128_pow(+1, \p y) returns 1 for any \p y, even a NaN.
|
| 510 |
+
* - __nv_fp128_pow(\p x,
|
| 511 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 512 |
+
* ) returns 1 for any \p x, even a NaN.
|
| 513 |
+
* - __nv_fp128_pow(\p x, \p y) returns a NaN for finite \p x < 0 and finite non-integer \p y.
|
| 514 |
+
* - __nv_fp128_pow(\p x,
|
| 515 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 516 |
+
* ) returns
|
| 517 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 518 |
+
* for
|
| 519 |
+
* \cuda_math_formula | x | < 1 \end_cuda_math_formula.
|
| 520 |
+
* - __nv_fp128_pow(\p x,
|
| 521 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 522 |
+
* ) returns +0 for
|
| 523 |
+
* \cuda_math_formula | x | > 1 \end_cuda_math_formula.
|
| 524 |
+
* - __nv_fp128_pow(\p x,
|
| 525 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 526 |
+
* ) returns +0 for
|
| 527 |
+
* \cuda_math_formula | x | < 1 \end_cuda_math_formula.
|
| 528 |
+
* - __nv_fp128_pow(\p x,
|
| 529 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 530 |
+
* ) returns
|
| 531 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 532 |
+
* for
|
| 533 |
+
* \cuda_math_formula | x | > 1 \end_cuda_math_formula.
|
| 534 |
+
* - __nv_fp128_pow(
|
| 535 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 536 |
+
* , \p y) returns -0 for \p y an odd integer less than 0.
|
| 537 |
+
* - __nv_fp128_pow(
|
| 538 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 539 |
+
* , \p y) returns +0 for \p y < 0 and not an odd integer.
|
| 540 |
+
* - __nv_fp128_pow(
|
| 541 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 542 |
+
* , \p y) returns
|
| 543 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 544 |
+
* for \p y an odd integer greater than 0.
|
| 545 |
+
* - __nv_fp128_pow(
|
| 546 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 547 |
+
* , \p y) returns
|
| 548 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 549 |
+
* for \p y > 0 and not an odd integer.
|
| 550 |
+
* - __nv_fp128_pow(
|
| 551 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 552 |
+
* , \p y) returns +0 for \p y < 0.
|
| 553 |
+
* - __nv_fp128_pow(
|
| 554 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 555 |
+
* , \p y) returns
|
| 556 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 557 |
+
* for \p y > 0.
|
| 558 |
+
* - __nv_fp128_pow(\p x, \p y) returns NaN if either \p x or \p y or both are NaN and \p x \cuda_math_formula \neq \end_cuda_math_formula +1 and \p y \cuda_math_formula \neq\pm 0 \end_cuda_math_formula.
|
| 559 |
+
*
|
| 560 |
+
* \note_accuracy_quad
|
| 561 |
+
* \note_fp128_target_arch
|
| 562 |
+
*/
|
| 563 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_pow(__float128 x, __float128 y) __DEF_IF_HOST
|
| 564 |
+
/**
|
| 565 |
+
* \ingroup CUDA_MATH_QUAD
|
| 566 |
+
* \brief Calculate \cuda_math_formula \sinh{x} \end_cuda_math_formula, the hyperbolic sine of the input argument.
|
| 567 |
+
*
|
| 568 |
+
* Calculate \cuda_math_formula \sinh{x} \end_cuda_math_formula, the hyperbolic sine of the input argument \p x.
|
| 569 |
+
*
|
| 570 |
+
* \return
|
| 571 |
+
* - __nv_fp128_sinhinh(
|
| 572 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 573 |
+
* ) returns
|
| 574 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 575 |
+
* - __nv_fp128_sinh(
|
| 576 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 577 |
+
* ) returns
|
| 578 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 579 |
+
* - __nv_fp128_sinh(NaN) returns NaN.
|
| 580 |
+
*
|
| 581 |
+
* \note_accuracy_quad
|
| 582 |
+
* \note_fp128_target_arch
|
| 583 |
+
*/
|
| 584 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_sinh(__float128 x) __DEF_IF_HOST
|
| 585 |
+
/**
|
| 586 |
+
* \ingroup CUDA_MATH_QUAD
|
| 587 |
+
* \brief Calculate \cuda_math_formula \cosh{x} \end_cuda_math_formula, the hyperbolic cosine of the input argument.
|
| 588 |
+
*
|
| 589 |
+
* \return
|
| 590 |
+
* - __nv_fp128_cosh(
|
| 591 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 592 |
+
* ) returns 1.
|
| 593 |
+
* - __nv_fp128_cosh(
|
| 594 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 595 |
+
* ) returns
|
| 596 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 597 |
+
* - __nv_fp128_cosh(NaN) returns NaN.
|
| 598 |
+
*
|
| 599 |
+
* \note_accuracy_quad
|
| 600 |
+
* \note_fp128_target_arch
|
| 601 |
+
*/
|
| 602 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_cosh(__float128 x) __DEF_IF_HOST
|
| 603 |
+
/**
|
| 604 |
+
* \ingroup CUDA_MATH_QUAD
|
| 605 |
+
* \brief Calculate \cuda_math_formula \tanh{x} \end_cuda_math_formula, the hyperbolic tangent of the input argument.
|
| 606 |
+
*
|
| 607 |
+
* \return
|
| 608 |
+
* - __nv_fp128_tanh(
|
| 609 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 610 |
+
* ) returns
|
| 611 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 612 |
+
* - __nv_fp128_tanh(
|
| 613 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 614 |
+
* ) returns
|
| 615 |
+
* \cuda_math_formula \pm 1 \end_cuda_math_formula.
|
| 616 |
+
* - __nv_fp128_tanh(NaN) returns NaN.
|
| 617 |
+
*
|
| 618 |
+
* \note_accuracy_quad
|
| 619 |
+
* \note_fp128_target_arch
|
| 620 |
+
*/
|
| 621 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_tanh(__float128 x) __DEF_IF_HOST
|
| 622 |
+
/**
|
| 623 |
+
* \ingroup CUDA_MATH_QUAD
|
| 624 |
+
* \brief Calculate \cuda_math_formula \sinh^{-1}{x} \end_cuda_math_formula, the inverse hyperbolic sine of the input argument.
|
| 625 |
+
*
|
| 626 |
+
* \return
|
| 627 |
+
* - __nv_fp128_asinh(
|
| 628 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 629 |
+
* ) returns
|
| 630 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 631 |
+
* - __nv_fp128_asinh(
|
| 632 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 633 |
+
* ) returns
|
| 634 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 635 |
+
* - __nv_fp128_asinh(NaN) returns NaN.
|
| 636 |
+
*
|
| 637 |
+
* \note_accuracy_quad
|
| 638 |
+
* \note_fp128_target_arch
|
| 639 |
+
*/
|
| 640 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_asinh(__float128 x) __DEF_IF_HOST
|
| 641 |
+
/**
|
| 642 |
+
* \ingroup CUDA_MATH_QUAD
|
| 643 |
+
* \brief Calculate \cuda_math_formula \cosh^{-1}{x} \end_cuda_math_formula, the nonnegative inverse hyperbolic cosine of the input argument.
|
| 644 |
+
*
|
| 645 |
+
* \return
|
| 646 |
+
* Result will be in the interval [0,
|
| 647 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 648 |
+
* ].
|
| 649 |
+
* - __nv_fp128_acosh(1) returns 0.
|
| 650 |
+
* - __nv_fp128_acosh(\p x) returns NaN for \p x in the interval [
|
| 651 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 652 |
+
* , 1).
|
| 653 |
+
* - __nv_fp128_acosh(
|
| 654 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 655 |
+
* ) returns
|
| 656 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 657 |
+
* - __nv_fp128_acosh(NaN) returns NaN.
|
| 658 |
+
*
|
| 659 |
+
* \note_accuracy_quad
|
| 660 |
+
* \note_fp128_target_arch
|
| 661 |
+
*/
|
| 662 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_acosh(__float128 x) __DEF_IF_HOST
|
| 663 |
+
/**
|
| 664 |
+
* \ingroup CUDA_MATH_QUAD
|
| 665 |
+
* \brief Calculate \cuda_math_formula \tanh^{-1}{x} \end_cuda_math_formula, the inverse hyperbolic tangent of the input argument.
|
| 666 |
+
*
|
| 667 |
+
* \return
|
| 668 |
+
* - __nv_fp128_atanh(
|
| 669 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 670 |
+
* ) returns
|
| 671 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 672 |
+
* - __nv_fp128_atanh(
|
| 673 |
+
* \cuda_math_formula \pm 1 \end_cuda_math_formula
|
| 674 |
+
* ) returns
|
| 675 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 676 |
+
* - __nv_fp128_atanh(\p x) returns NaN for \p x outside interval [-1, 1].
|
| 677 |
+
* - __nv_fp128_atanh(NaN) returns NaN.
|
| 678 |
+
*
|
| 679 |
+
* \note_accuracy_quad
|
| 680 |
+
* \note_fp128_target_arch
|
| 681 |
+
*/
|
| 682 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_atanh(__float128 x) __DEF_IF_HOST
|
| 683 |
+
/**
|
| 684 |
+
* \ingroup CUDA_MATH_QUAD
|
| 685 |
+
* \brief Truncate input argument to the integral part.
|
| 686 |
+
*
|
| 687 |
+
* \return
|
| 688 |
+
* Rounded \p x to the nearest integer value in floating-point format, that does not exceed \p x in
|
| 689 |
+
* magnitude.
|
| 690 |
+
* - __nv_fp128_trunc(
|
| 691 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 692 |
+
* ) returns
|
| 693 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 694 |
+
* - __nv_fp128_trunc(
|
| 695 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 696 |
+
* ) returns
|
| 697 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 698 |
+
* - __nv_fp128_trunc(NaN) returns NaN.
|
| 699 |
+
*
|
| 700 |
+
* \note_accuracy_quad
|
| 701 |
+
* \note_fp128_target_arch
|
| 702 |
+
*/
|
| 703 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_trunc(__float128 x) __DEF_IF_HOST
|
| 704 |
+
/**
|
| 705 |
+
* \ingroup CUDA_MATH_QUAD
|
| 706 |
+
* \brief Calculate \cuda_math_formula \lfloor x \rfloor \end_cuda_math_formula, the largest integer less than or equal to \p x.
|
| 707 |
+
*
|
| 708 |
+
* \return
|
| 709 |
+
* \cuda_math_formula \lfloor x \rfloor \end_cuda_math_formula
|
| 710 |
+
* expressed as a floating-point number.
|
| 711 |
+
* - __nv_fp128_floor(
|
| 712 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 713 |
+
* ) returns
|
| 714 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 715 |
+
* - __nv_fp128_floor(
|
| 716 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 717 |
+
* ) returns
|
| 718 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 719 |
+
* - __nv_fp128_floor(NaN) returns NaN.
|
| 720 |
+
*
|
| 721 |
+
* \note_accuracy_quad
|
| 722 |
+
* \note_fp128_target_arch
|
| 723 |
+
*/
|
| 724 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_floor(__float128 x) __DEF_IF_HOST
|
| 725 |
+
/**
|
| 726 |
+
* \ingroup CUDA_MATH_QUAD
|
| 727 |
+
* \brief Calculate \cuda_math_formula \lceil x \rceil \end_cuda_math_formula, the smallest integer greater than or equal to \p x.
|
| 728 |
+
*
|
| 729 |
+
* \return
|
| 730 |
+
* \cuda_math_formula \lceil x \rceil \end_cuda_math_formula
|
| 731 |
+
* expressed as a floating-point number.
|
| 732 |
+
* - __nv_fp128_ceil(
|
| 733 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 734 |
+
* ) returns
|
| 735 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 736 |
+
* - __nv_fp128_ceil(
|
| 737 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 738 |
+
* ) returns
|
| 739 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 740 |
+
* - __nv_fp128_ceil(NaN) returns NaN.
|
| 741 |
+
*
|
| 742 |
+
* \note_accuracy_quad
|
| 743 |
+
* \note_fp128_target_arch
|
| 744 |
+
*/
|
| 745 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_ceil(__float128 x) __DEF_IF_HOST
|
| 746 |
+
/**
|
| 747 |
+
* \ingroup CUDA_MATH_QUAD
|
| 748 |
+
* \brief Round to nearest integer value in floating-point format,
|
| 749 |
+
* with halfway cases rounded away from zero.
|
| 750 |
+
*
|
| 751 |
+
* \return
|
| 752 |
+
* - __nv_fp128_round(
|
| 753 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 754 |
+
* ) returns
|
| 755 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 756 |
+
* - __nv_fp128_round(
|
| 757 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 758 |
+
* ) returns
|
| 759 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 760 |
+
* - __nv_fp128_round(NaN) returns NaN.
|
| 761 |
+
*
|
| 762 |
+
* \note_accuracy_quad
|
| 763 |
+
* \note_fp128_target_arch
|
| 764 |
+
*/
|
| 765 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_round(__float128 x) __DEF_IF_HOST
|
| 766 |
+
/**
|
| 767 |
+
* \ingroup CUDA_MATH_QUAD
|
| 768 |
+
* \brief Round to nearest integer value in floating-point format,
|
| 769 |
+
* with halfway cases rounded to the nearest even integer value.
|
| 770 |
+
*
|
| 771 |
+
* \return
|
| 772 |
+
* - __nv_fp128_rint(
|
| 773 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 774 |
+
* ) returns
|
| 775 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 776 |
+
* - __nv_fp128_rint(
|
| 777 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 778 |
+
* ) returns
|
| 779 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 780 |
+
* - __nv_fp128_rint(NaN) returns NaN.
|
| 781 |
+
*
|
| 782 |
+
* \note_accuracy_quad
|
| 783 |
+
* \note_fp128_target_arch
|
| 784 |
+
*/
|
| 785 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_rint(__float128 x) __DEF_IF_HOST
|
| 786 |
+
/**
|
| 787 |
+
* \ingroup CUDA_MATH_QUAD
|
| 788 |
+
* \brief Calculate \cuda_math_formula |x| \end_cuda_math_formula, the absolute value of the input argument.
|
| 789 |
+
*
|
| 790 |
+
* \return
|
| 791 |
+
* - __nv_fp128_fabs(
|
| 792 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 793 |
+
* ) returns
|
| 794 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 795 |
+
* - __nv_fp128_fabs(
|
| 796 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 797 |
+
* ) returns +0.
|
| 798 |
+
* - __nv_fp128_fabs(NaN) returns an unspecified NaN.
|
| 799 |
+
*
|
| 800 |
+
* \note_accuracy_quad
|
| 801 |
+
* \note_fp128_target_arch
|
| 802 |
+
*/
|
| 803 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_fabs(__float128 x) __DEF_IF_HOST
|
| 804 |
+
/**
|
| 805 |
+
* \ingroup CUDA_MATH_QUAD
|
| 806 |
+
* \brief Create value with the magnitude of the first agument \p x, and the sign of the second argument \p y.
|
| 807 |
+
*
|
| 808 |
+
* \return
|
| 809 |
+
* - copysign(\p NaN, \p y) returns a \p NaN with the sign of \p y.
|
| 810 |
+
*
|
| 811 |
+
* \note_accuracy_quad
|
| 812 |
+
* \note_fp128_target_arch
|
| 813 |
+
*/
|
| 814 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_copysign(__float128 x, __float128 y) __DEF_IF_HOST
|
| 815 |
+
/**
|
| 816 |
+
* \ingroup CUDA_MATH_QUAD
|
| 817 |
+
* \brief Determine the maximum numeric value of the arguments.
|
| 818 |
+
*
|
| 819 |
+
* \return
|
| 820 |
+
* The maximum numeric value of the arguments \p x and \p y. Treats NaN
|
| 821 |
+
* arguments as missing data.
|
| 822 |
+
* - If both arguments are NaN, returns NaN.
|
| 823 |
+
* - If one argument is NaN, returns the numeric argument.
|
| 824 |
+
*
|
| 825 |
+
* \note_accuracy_quad
|
| 826 |
+
* \note_fp128_target_arch
|
| 827 |
+
*/
|
| 828 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_fmax(__float128 x, __float128 y) __DEF_IF_HOST
|
| 829 |
+
/**
|
| 830 |
+
* \ingroup CUDA_MATH_QUAD
|
| 831 |
+
* \brief Determine the minimum numeric value of the arguments.
|
| 832 |
+
*
|
| 833 |
+
* \return
|
| 834 |
+
* The minimum numeric value of the arguments \p x and \p y. Treats NaN
|
| 835 |
+
* arguments as missing data.
|
| 836 |
+
* - If both arguments are NaN, returns NaN.
|
| 837 |
+
* - If one argument is NaN, returns the numeric argument.
|
| 838 |
+
*
|
| 839 |
+
* \note_accuracy_quad
|
| 840 |
+
* \note_fp128_target_arch
|
| 841 |
+
*/
|
| 842 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_fmin(__float128 x, __float128 y) __DEF_IF_HOST
|
| 843 |
+
/**
|
| 844 |
+
* \ingroup CUDA_MATH_QUAD
|
| 845 |
+
* \brief Compute the positive difference between \p x and \p y.
|
| 846 |
+
*
|
| 847 |
+
* \return
|
| 848 |
+
* - __nv_fp128_fdim(\p x, \p y) returns \p x - \p y if \cuda_math_formula x > y \end_cuda_math_formula.
|
| 849 |
+
* - __nv_fp128_fdim(\p x, \p y) returns +0 if \cuda_math_formula x \leq y \end_cuda_math_formula.
|
| 850 |
+
* - If either argument is NaN, NaN is returned.
|
| 851 |
+
*
|
| 852 |
+
* \note_accuracy_quad
|
| 853 |
+
* \note_fp128_target_arch
|
| 854 |
+
*/
|
| 855 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_fdim(__float128 x, __float128 y) __DEF_IF_HOST
|
| 856 |
+
/**
|
| 857 |
+
* \ingroup CUDA_MATH_QUAD
|
| 858 |
+
* \brief Calculate the floating-point remainder of \p x / \p y.
|
| 859 |
+
*
|
| 860 |
+
* \return
|
| 861 |
+
* The floating-point remainder of the division operation \p x / \p y calculated
|
| 862 |
+
* by this function is exactly the value <tt>x - n*y</tt>, where \p n is \p x / \p y with its fractional part truncated.
|
| 863 |
+
* - The computed value will have the same sign as \p x, and its magnitude will be less than the magnitude of \p y.
|
| 864 |
+
* - __nv_fp128_fmod(
|
| 865 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 866 |
+
* , \p y) returns
|
| 867 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 868 |
+
* if \p y is not zero.
|
| 869 |
+
* - __nv_fp128_fmod(\p x,
|
| 870 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 871 |
+
* ) returns \p x if \p x is finite.
|
| 872 |
+
* - __nv_fp128_fmod(\p x, \p y) returns NaN if \p x is
|
| 873 |
+
* \cuda_math_formula \pm\infty \end_cuda_math_formula
|
| 874 |
+
* or \p y is zero.
|
| 875 |
+
* - If either argument is NaN, NaN is returned.
|
| 876 |
+
*
|
| 877 |
+
* \note_accuracy_quad
|
| 878 |
+
* \note_fp128_target_arch
|
| 879 |
+
*/
|
| 880 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_fmod(__float128 x, __float128 y) __DEF_IF_HOST
|
| 881 |
+
/**
|
| 882 |
+
* \ingroup CUDA_MATH_QUAD
|
| 883 |
+
* \brief Compute the floating-point remainder function.
|
| 884 |
+
*
|
| 885 |
+
* \return
|
| 886 |
+
* The floating-point remainder \p r of dividing
|
| 887 |
+
* \p x by \p y for nonzero \p y is defined as
|
| 888 |
+
* \cuda_math_formula r = x - n y \end_cuda_math_formula.
|
| 889 |
+
* The value \p n is the integer value nearest
|
| 890 |
+
* \cuda_math_formula \frac{x}{y} \end_cuda_math_formula.
|
| 891 |
+
* In the halfway cases when
|
| 892 |
+
* \cuda_math_formula | n -\frac{x}{y} | = \frac{1}{2} \end_cuda_math_formula
|
| 893 |
+
* , the
|
| 894 |
+
* even \p n value is chosen.
|
| 895 |
+
* - __nv_fp128_remainder(\p x,
|
| 896 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 897 |
+
* ) returns NaN.
|
| 898 |
+
* - __nv_fp128_remainder(
|
| 899 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 900 |
+
* , \p y) returns NaN.
|
| 901 |
+
* - __nv_fp128_remainder(\p x,
|
| 902 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 903 |
+
* ) returns \p x for finite \p x.
|
| 904 |
+
* - If either argument is NaN, NaN is returned.
|
| 905 |
+
*
|
| 906 |
+
* \note_accuracy_quad
|
| 907 |
+
* \note_fp128_target_arch
|
| 908 |
+
*/
|
| 909 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_remainder(__float128 x, __float128 y) __DEF_IF_HOST
|
| 910 |
+
/**
|
| 911 |
+
* \ingroup CUDA_MATH_QUAD
|
| 912 |
+
* \brief Extract mantissa and exponent of the floating-point input argument.
|
| 913 |
+
*
|
| 914 |
+
* Decompose the floating-point value \p x into a component \p m for the
|
| 915 |
+
* normalized fraction element and an integral term \p n for the exponent.
|
| 916 |
+
* The absolute value of \p m will be greater than or equal to 0.5 and
|
| 917 |
+
* less than 1.0 or it will be equal to 0;
|
| 918 |
+
* \cuda_math_formula x = m\cdot 2^n \end_cuda_math_formula.
|
| 919 |
+
* The integer exponent \p n will be stored in the location to which \p nptr points.
|
| 920 |
+
*
|
| 921 |
+
* \return
|
| 922 |
+
* The fractional component \p m.
|
| 923 |
+
* - __nv_fp128_frexp(
|
| 924 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 925 |
+
* , \p nptr) returns
|
| 926 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 927 |
+
* and stores zero in the location pointed to by \p nptr.
|
| 928 |
+
* - __nv_fp128_frexp(
|
| 929 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 930 |
+
* , \p nptr) returns
|
| 931 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 932 |
+
* and stores an unspecified value in the
|
| 933 |
+
* location to which \p nptr points.
|
| 934 |
+
* - __nv_fp128_frexp(NaN, \p y) returns a NaN and stores an unspecified value in the location to which \p nptr points.
|
| 935 |
+
*
|
| 936 |
+
* \note_accuracy_quad
|
| 937 |
+
* \note_fp128_target_arch
|
| 938 |
+
*/
|
| 939 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_frexp(__float128 x, int* nptr) __DEF_IF_HOST
|
| 940 |
+
/**
|
| 941 |
+
* \ingroup CUDA_MATH_QUAD
|
| 942 |
+
* \brief Break down the input argument into fractional and integral parts.
|
| 943 |
+
*
|
| 944 |
+
* Break down the argument \p x into fractional and integral parts. The
|
| 945 |
+
* integral part is stored in floating-point format in the location to which \p iptr points.
|
| 946 |
+
* Fractional and integral parts are given the same sign as the argument \p x.
|
| 947 |
+
*
|
| 948 |
+
* \return
|
| 949 |
+
* - __nv_fp128_modf(
|
| 950 |
+
* \cuda_math_formula \pm x \end_cuda_math_formula
|
| 951 |
+
* , \p iptr) returns a result with the same sign as \p x.
|
| 952 |
+
* - __nv_fp128_modf(
|
| 953 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 954 |
+
* , \p iptr) returns
|
| 955 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 956 |
+
* and stores
|
| 957 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 958 |
+
* in the object pointed to by \p iptr.
|
| 959 |
+
* - __nv_fp128_modf(NaN, \p iptr) stores a NaN in the object pointed to by \p iptr and returns a NaN.
|
| 960 |
+
*
|
| 961 |
+
* \note_accuracy_quad
|
| 962 |
+
* \note_fp128_target_arch
|
| 963 |
+
*/
|
| 964 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_modf(__float128 x, __float128* iptr) __DEF_IF_HOST
|
| 965 |
+
/**
|
| 966 |
+
* \ingroup CUDA_MATH_QUAD
|
| 967 |
+
* \brief Calculate \cuda_math_formula \sqrt{x^2+y^2} \end_cuda_math_formula, the square root of the sum of squares of two arguments.
|
| 968 |
+
*
|
| 969 |
+
* \return
|
| 970 |
+
* The length of the hypotenuse of a right triangle whose two sides have lengths
|
| 971 |
+
* \cuda_math_formula |x| \end_cuda_math_formula and \cuda_math_formula |y| \end_cuda_math_formula without undue overflow or underflow.
|
| 972 |
+
* - __nv_fp128_hypot(\p x,\p y), __nv_fp128_hypot(\p y,\p x), and __nv_fp128_hypot(\p x, \p -y) are equivalent.
|
| 973 |
+
* - __nv_fp128_hypot(\p x,
|
| 974 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 975 |
+
* ) is equivalent to __nv_fp128_fabs(\p x).
|
| 976 |
+
* - __nv_fp128_hypot(
|
| 977 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 978 |
+
* ,\p y) returns
|
| 979 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula,
|
| 980 |
+
* even if \p y is a NaN.
|
| 981 |
+
* - __nv_fp128_hypot(NaN, \p y) returns NaN, when \p y is not \cuda_math_formula \pm\infty \end_cuda_math_formula.
|
| 982 |
+
*
|
| 983 |
+
* \note_accuracy_quad
|
| 984 |
+
* \note_fp128_target_arch
|
| 985 |
+
*/
|
| 986 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_hypot(__float128 x, __float128 y) __DEF_IF_HOST
|
| 987 |
+
/**
|
| 988 |
+
* \ingroup CUDA_MATH_QUAD
|
| 989 |
+
* \brief Compute
|
| 990 |
+
* \cuda_math_formula x \times y + z \end_cuda_math_formula
|
| 991 |
+
* as a single operation using round-to-nearest-even rounding mode.
|
| 992 |
+
*
|
| 993 |
+
* \return
|
| 994 |
+
* The value of
|
| 995 |
+
* \cuda_math_formula x \times y + z \end_cuda_math_formula
|
| 996 |
+
* as a single ternary operation, rounded once using round-to-nearest,
|
| 997 |
+
* ties-to-even rounding mode.
|
| 998 |
+
* - __nv_fp128_fma(
|
| 999 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 1000 |
+
* ,
|
| 1001 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 1002 |
+
* , \p z) returns NaN.
|
| 1003 |
+
* - __nv_fp128_fma(
|
| 1004 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 1005 |
+
* ,
|
| 1006 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 1007 |
+
* , \p z) returns NaN.
|
| 1008 |
+
* - __nv_fp128_fma(\p x, \p y,
|
| 1009 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula
|
| 1010 |
+
* ) returns NaN if
|
| 1011 |
+
* \cuda_math_formula x \times y \end_cuda_math_formula
|
| 1012 |
+
* is an exact
|
| 1013 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula.
|
| 1014 |
+
* - __nv_fp128_fma(\p x, \p y,
|
| 1015 |
+
* \cuda_math_formula +\infty \end_cuda_math_formula
|
| 1016 |
+
* ) returns NaN if
|
| 1017 |
+
* \cuda_math_formula x \times y \end_cuda_math_formula
|
| 1018 |
+
* is an exact
|
| 1019 |
+
* \cuda_math_formula -\infty \end_cuda_math_formula.
|
| 1020 |
+
* - __nv_fp128_fma(\p x, \p y, \cuda_math_formula \pm 0 \end_cuda_math_formula) returns \cuda_math_formula \pm 0 \end_cuda_math_formula if \cuda_math_formula x \times y \end_cuda_math_formula is exact \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1021 |
+
* - __nv_fp128_fma(\p x, \p y, \cuda_math_formula \mp 0 \end_cuda_math_formula) returns \cuda_math_formula +0 \end_cuda_math_formula if \cuda_math_formula x \times y \end_cuda_math_formula is exact \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1022 |
+
* - __nv_fp128_fma(\p x, \p y, \p z) returns \cuda_math_formula +0 \end_cuda_math_formula if \cuda_math_formula x \times y + z \end_cuda_math_formula is exactly zero and \cuda_math_formula z \neq 0 \end_cuda_math_formula.
|
| 1023 |
+
* - If either argument is NaN, NaN is returned.
|
| 1024 |
+
*
|
| 1025 |
+
* \note_accuracy_quad
|
| 1026 |
+
* \note_fp128_target_arch
|
| 1027 |
+
*/
|
| 1028 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_fma(__float128 x, __float128 y, __float128 c) __DEF_IF_HOST
|
| 1029 |
+
/**
|
| 1030 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1031 |
+
* \brief Calculate the value of
|
| 1032 |
+
* \cuda_math_formula x\cdot 2^{exp} \end_cuda_math_formula.
|
| 1033 |
+
*
|
| 1034 |
+
* \return
|
| 1035 |
+
* - __nv_fp128_ldexp(
|
| 1036 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 1037 |
+
* , \p exp) returns
|
| 1038 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1039 |
+
* - __nv_fp128_ldexp(\p x, 0) returns \p x.
|
| 1040 |
+
* - __nv_fp128_ldexp(
|
| 1041 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 1042 |
+
* , \p exp) returns
|
| 1043 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula.
|
| 1044 |
+
* - __nv_fp128_ldexp(NaN, \p exp) returns NaN.
|
| 1045 |
+
*
|
| 1046 |
+
* \note_accuracy_quad
|
| 1047 |
+
* \note_fp128_target_arch
|
| 1048 |
+
*/
|
| 1049 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_ldexp(__float128 x, int exp) __DEF_IF_HOST
|
| 1050 |
+
/**
|
| 1051 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1052 |
+
* \brief Compute the unbiased integer exponent of the input argument.
|
| 1053 |
+
*
|
| 1054 |
+
* \return
|
| 1055 |
+
* - If successful, returns the unbiased exponent of the argument.
|
| 1056 |
+
* - __nv_fp128_ilogb(
|
| 1057 |
+
* \cuda_math_formula \pm 0 \end_cuda_math_formula
|
| 1058 |
+
* ) returns <tt>INT_MIN</tt>.
|
| 1059 |
+
* - __nv_fp128_ilogb(NaN) returns <tt>INT_MIN</tt>.
|
| 1060 |
+
* - __nv_fp128_ilogb(
|
| 1061 |
+
* \cuda_math_formula \pm \infty \end_cuda_math_formula
|
| 1062 |
+
* ) returns <tt>INT_MAX</tt>.
|
| 1063 |
+
* - Note: above behavior does not take into account <tt>FP_ILOGB0</tt> nor <tt>FP_ILOGBNAN</tt>.
|
| 1064 |
+
*
|
| 1065 |
+
* \note_accuracy_quad
|
| 1066 |
+
* \note_fp128_target_arch
|
| 1067 |
+
*/
|
| 1068 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ int __nv_fp128_ilogb(__float128 x) __DEF_IF_HOST
|
| 1069 |
+
/**
|
| 1070 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1071 |
+
* \brief Compute \cuda_math_formula x \cdot y \end_cuda_math_formula, the product of the two floating-point inputs using round-to-nearest-even rounding mode.
|
| 1072 |
+
*
|
| 1073 |
+
* \return Returns \p x * \p y.
|
| 1074 |
+
* - sign of the product \p x * \p y is XOR of the signs of \p x and \p y when neither inputs nor result are NaN.
|
| 1075 |
+
* - __nv_fp128_mul(\p x, \p y) is equivalent to __nv_fp128_mul(\p y, \p x).
|
| 1076 |
+
* - __nv_fp128_mul(\p x, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns \cuda_math_formula \infty \end_cuda_math_formula of appropriate sign for \p x \cuda_math_formula \neq 0 \end_cuda_math_formula.
|
| 1077 |
+
* - __nv_fp128_mul(\cuda_math_formula \pm 0 \end_cuda_math_formula, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns NaN.
|
| 1078 |
+
* - __nv_fp128_mul(\cuda_math_formula \pm 0 \end_cuda_math_formula, \p y) returns \cuda_math_formula 0 \end_cuda_math_formula of appropriate sign for finite \p y.
|
| 1079 |
+
* - If either argument is NaN, NaN is returned.
|
| 1080 |
+
*
|
| 1081 |
+
* \note_accuracy_quad
|
| 1082 |
+
* \note_fp128_target_arch
|
| 1083 |
+
*/
|
| 1084 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_mul(__float128 x, __float128 y) __DEF_IF_HOST
|
| 1085 |
+
/**
|
| 1086 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1087 |
+
* \brief Compute \cuda_math_formula x + y \end_cuda_math_formula, the sum of the two floating-point inputs using round-to-nearest-even rounding mode.
|
| 1088 |
+
*
|
| 1089 |
+
* \return Returns \p x + \p y.
|
| 1090 |
+
* - __nv_fp128_add(\p x, \p y) is equivalent to __nv_fp128_add(\p y, \p x).
|
| 1091 |
+
* - __nv_fp128_add(\p x, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns \cuda_math_formula \pm\infty \end_cuda_math_formula for finite \p x.
|
| 1092 |
+
* - __nv_fp128_add(\cuda_math_formula \pm\infty \end_cuda_math_formula, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns \cuda_math_formula \pm\infty \end_cuda_math_formula.
|
| 1093 |
+
* - __nv_fp128_add(\cuda_math_formula \pm\infty \end_cuda_math_formula, \cuda_math_formula \mp\infty \end_cuda_math_formula) returns NaN.
|
| 1094 |
+
* - __nv_fp128_add(\cuda_math_formula \pm 0 \end_cuda_math_formula, \cuda_math_formula \pm 0 \end_cuda_math_formula) returns \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1095 |
+
* - __nv_fp128_add(\p x, \p -x) returns \cuda_math_formula +0 \end_cuda_math_formula for finite \p x, including \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1096 |
+
* - If either argument is NaN, NaN is returned.
|
| 1097 |
+
*
|
| 1098 |
+
* \note_accuracy_quad
|
| 1099 |
+
* \note_fp128_target_arch
|
| 1100 |
+
*/
|
| 1101 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_add(__float128 x, __float128 y) __DEF_IF_HOST
|
| 1102 |
+
/**
|
| 1103 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1104 |
+
* \brief Compute \cuda_math_formula x - y \end_cuda_math_formula, the difference of the two floating-point inputs using round-to-nearest-even rounding mode.
|
| 1105 |
+
*
|
| 1106 |
+
* \return Returns \p x - \p y.
|
| 1107 |
+
* - __nv_fp128_sub(\cuda_math_formula \pm\infty \end_cuda_math_formula, \p y) returns \cuda_math_formula \pm\infty \end_cuda_math_formula for finite \p y.
|
| 1108 |
+
* - __nv_fp128_sub(\p x, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns \cuda_math_formula \mp\infty \end_cuda_math_formula for finite \p x.
|
| 1109 |
+
* - __nv_fp128_sub(\cuda_math_formula \pm\infty \end_cuda_math_formula, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns NaN.
|
| 1110 |
+
* - __nv_fp128_sub(\cuda_math_formula \pm\infty \end_cuda_math_formula, \cuda_math_formula \mp\infty \end_cuda_math_formula) returns \cuda_math_formula \pm\infty \end_cuda_math_formula.
|
| 1111 |
+
* - __nv_fp128_sub(\cuda_math_formula \pm 0 \end_cuda_math_formula, \cuda_math_formula \mp 0 \end_cuda_math_formula) returns \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1112 |
+
* - __nv_fp128_sub(\p x, \p x) returns \cuda_math_formula +0 \end_cuda_math_formula for finite \p x, including \cuda_math_formula \pm 0 \end_cuda_math_formula.
|
| 1113 |
+
* - If either argument is NaN, NaN is returned.
|
| 1114 |
+
*
|
| 1115 |
+
* \note_accuracy_quad
|
| 1116 |
+
* \note_fp128_target_arch
|
| 1117 |
+
*/
|
| 1118 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_sub(__float128 x, __float128 y) __DEF_IF_HOST
|
| 1119 |
+
/**
|
| 1120 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1121 |
+
* \brief Compute \cuda_math_formula \frac{x}{y} \end_cuda_math_formula, the quotient of the two floating-point inputs using round-to-nearest-even rounding mode.
|
| 1122 |
+
*
|
| 1123 |
+
* \return
|
| 1124 |
+
* - sign of the quotient \p x / \p y is XOR of the signs of \p x and \p y when neither inputs nor result are NaN.
|
| 1125 |
+
* - __nv_fp128_div(\cuda_math_formula \pm 0 \end_cuda_math_formula, \cuda_math_formula \pm 0 \end_cuda_math_formula) returns NaN.
|
| 1126 |
+
* - __nv_fp128_div(\cuda_math_formula \pm\infty \end_cuda_math_formula, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns NaN.
|
| 1127 |
+
* - __nv_fp128_div(\p x, \cuda_math_formula \pm\infty \end_cuda_math_formula) returns \cuda_math_formula 0 \end_cuda_math_formula of appropriate sign for finite \p x.
|
| 1128 |
+
* - __nv_fp128_div(\cuda_math_formula \pm\infty \end_cuda_math_formula, \p y) returns \cuda_math_formula \infty \end_cuda_math_formula of appropriate sign for finite \p y.
|
| 1129 |
+
* - __nv_fp128_div(\p x, \cuda_math_formula \pm 0 \end_cuda_math_formula) returns \cuda_math_formula \infty \end_cuda_math_formula of appropriate sign for \p x \cuda_math_formula \neq 0 \end_cuda_math_formula.
|
| 1130 |
+
* - __nv_fp128_div(\cuda_math_formula \pm 0 \end_cuda_math_formula, \p y) returns \cuda_math_formula 0 \end_cuda_math_formula of appropriate sign for \p y \cuda_math_formula \neq 0 \end_cuda_math_formula.
|
| 1131 |
+
* - If either argument is NaN, NaN is returned.
|
| 1132 |
+
*
|
| 1133 |
+
* \note_accuracy_quad
|
| 1134 |
+
* \note_fp128_target_arch
|
| 1135 |
+
*/
|
| 1136 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ __float128 __nv_fp128_div(__float128 x, __float128 y) __DEF_IF_HOST
|
| 1137 |
+
/**
|
| 1138 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1139 |
+
* \brief Determine whether the input argument is a NaN.
|
| 1140 |
+
*
|
| 1141 |
+
* \return
|
| 1142 |
+
* A nonzero value if and only if \p x is a NaN value.
|
| 1143 |
+
*
|
| 1144 |
+
* \note_fp128_target_arch
|
| 1145 |
+
*/
|
| 1146 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ int __nv_fp128_isnan(__float128 x) __DEF_IF_HOST
|
| 1147 |
+
/**
|
| 1148 |
+
* \ingroup CUDA_MATH_QUAD
|
| 1149 |
+
* \brief Determine whether the pair of inputs is unordered.
|
| 1150 |
+
*
|
| 1151 |
+
* \return
|
| 1152 |
+
* - nonzero value if at least one of input values is a NaN.
|
| 1153 |
+
* - zero otherwise
|
| 1154 |
+
*
|
| 1155 |
+
* \note_fp128_target_arch
|
| 1156 |
+
*/
|
| 1157 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ int __nv_fp128_isunordered(__float128 x, __float128 y) __DEF_IF_HOST
|
| 1158 |
+
#endif /* __FLOAT128_CPP_SPELLING_ENABLED__ */
|
| 1159 |
+
|
| 1160 |
+
|
| 1161 |
+
#ifdef __FLOAT128_C_SPELLING_ENABLED__
|
| 1162 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_sqrt(_Float128 x) __DEF_IF_HOST
|
| 1163 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_sin(_Float128 x) __DEF_IF_HOST
|
| 1164 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_cos(_Float128 x) __DEF_IF_HOST
|
| 1165 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_tan(_Float128 x) __DEF_IF_HOST
|
| 1166 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_asin(_Float128 x) __DEF_IF_HOST
|
| 1167 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_acos(_Float128 x) __DEF_IF_HOST
|
| 1168 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_atan(_Float128 x) __DEF_IF_HOST
|
| 1169 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_exp(_Float128 x) __DEF_IF_HOST
|
| 1170 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_exp2(_Float128 x) __DEF_IF_HOST
|
| 1171 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_exp10(_Float128 x) __DEF_IF_HOST
|
| 1172 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_expm1(_Float128 x) __DEF_IF_HOST
|
| 1173 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_log(_Float128 x) __DEF_IF_HOST
|
| 1174 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_log2(_Float128 x) __DEF_IF_HOST
|
| 1175 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_log10(_Float128 x) __DEF_IF_HOST
|
| 1176 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_log1p(_Float128 x) __DEF_IF_HOST
|
| 1177 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_pow(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1178 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_sinh(_Float128 x) __DEF_IF_HOST
|
| 1179 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_cosh(_Float128 x) __DEF_IF_HOST
|
| 1180 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_tanh(_Float128 x) __DEF_IF_HOST
|
| 1181 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_asinh(_Float128 x) __DEF_IF_HOST
|
| 1182 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_acosh(_Float128 x) __DEF_IF_HOST
|
| 1183 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_atanh(_Float128 x) __DEF_IF_HOST
|
| 1184 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_trunc(_Float128 x) __DEF_IF_HOST
|
| 1185 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_floor(_Float128 x) __DEF_IF_HOST
|
| 1186 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_ceil(_Float128 x) __DEF_IF_HOST
|
| 1187 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_round(_Float128 x) __DEF_IF_HOST
|
| 1188 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_rint(_Float128 x) __DEF_IF_HOST
|
| 1189 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_fabs(_Float128 x) __DEF_IF_HOST
|
| 1190 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_copysign(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1191 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_fmax(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1192 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_fmin(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1193 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_fdim(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1194 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_fmod(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1195 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_remainder(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1196 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_frexp(_Float128 x, int* nptr) __DEF_IF_HOST
|
| 1197 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_modf(_Float128 x, _Float128* iptr) __DEF_IF_HOST
|
| 1198 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_hypot(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1199 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_fma(_Float128 x, _Float128 y, _Float128 c) __DEF_IF_HOST
|
| 1200 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_ldexp(_Float128 x, int exp) __DEF_IF_HOST
|
| 1201 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ int __nv_fp128_ilogb(_Float128 x) __DEF_IF_HOST
|
| 1202 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_mul(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1203 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_add(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1204 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_sub(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1205 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ _Float128 __nv_fp128_div(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1206 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ int __nv_fp128_isnan(_Float128 x) __DEF_IF_HOST
|
| 1207 |
+
__DEVICE_FP128_FUNCTIONS_DECL__ int __nv_fp128_isunordered(_Float128 x, _Float128 y) __DEF_IF_HOST
|
| 1208 |
+
#endif /* __FLOAT_C_SPELLING_ENABLED */
|
| 1209 |
+
|
| 1210 |
+
|
| 1211 |
+
#undef __DEVICE_FP128_FUNCTIONS_DECL__
|
| 1212 |
+
|
| 1213 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 1214 |
+
|
| 1215 |
+
#endif /* !__DEVICE_FP128_FUNCTIONS_H__ */
|
| 1216 |
+
|
| 1217 |
+
#endif /* !__NV_DISABLE_DEVICE_FP128_FUNCTIONS__ */
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_functions.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/device_functions.hpp
ADDED
|
@@ -0,0 +1,1163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2024 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/device_functions.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/device_functions.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_FUNCTIONS_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__DEVICE_FUNCTIONS_HPP__)
|
| 61 |
+
#define __DEVICE_FUNCTIONS_HPP__
|
| 62 |
+
|
| 63 |
+
/*******************************************************************************
|
| 64 |
+
* *
|
| 65 |
+
* *
|
| 66 |
+
* *
|
| 67 |
+
*******************************************************************************/
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if defined(__CUDACC_RTC__)
|
| 72 |
+
#define __DEVICE_FUNCTIONS_DECL__ __device__
|
| 73 |
+
#define __DEVICE_FUNCTIONS_STATIC_DECL__ __device__
|
| 74 |
+
#define __DEVICE_HOST_FUNCTIONS_STATIC_DECL__ __device__ __host__ __cudart_builtin__
|
| 75 |
+
#else
|
| 76 |
+
#define __DEVICE_FUNCTIONS_DECL__ __device__
|
| 77 |
+
#define __DEVICE_FUNCTIONS_STATIC_DECL__ static __inline__ __device__
|
| 78 |
+
#define __DEVICE_HOST_FUNCTIONS_STATIC_DECL__ static __inline__ __device__ __host__ __cudart_builtin__
|
| 79 |
+
#endif /* __CUDACC_RTC__ */
|
| 80 |
+
|
| 81 |
+
#include "builtin_types.h"
|
| 82 |
+
#include "device_types.h"
|
| 83 |
+
#include "host_defines.h"
|
| 84 |
+
|
| 85 |
+
#undef __DEVICE_FUNCTIONS_DECL__
|
| 86 |
+
#undef __DEVICE_FUNCTIONS_STATIC_DECL__
|
| 87 |
+
|
| 88 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 89 |
+
|
| 90 |
+
/*******************************************************************************
|
| 91 |
+
* *
|
| 92 |
+
* *
|
| 93 |
+
* *
|
| 94 |
+
*******************************************************************************/
|
| 95 |
+
|
| 96 |
+
#ifdef __CUDACC__
|
| 97 |
+
# if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 900)
|
| 98 |
+
#define __CUDA_AND_AT_LEAST_SM_90__
|
| 99 |
+
#endif /* defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 900) */
|
| 100 |
+
# if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700)
|
| 101 |
+
#define __CUDA_AND_AT_LEAST_SM_70__
|
| 102 |
+
#endif /* defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 700) */
|
| 103 |
+
# if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 750)
|
| 104 |
+
#define __CUDA_AND_AT_LEAST_SM_75__
|
| 105 |
+
#endif /* defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 750) */
|
| 106 |
+
#endif /* __CUDACC__ */
|
| 107 |
+
|
| 108 |
+
/* C++ header for std::memcpy (used for type punning in host-side implementations).
|
| 109 |
+
* When compiling as a CUDA source file memcpy is provided implicitly.
|
| 110 |
+
* !defined(__CUDACC__) implies !defined(__CUDACC_RTC__).
|
| 111 |
+
*/
|
| 112 |
+
#if defined(__cplusplus) && !defined(__CUDACC__)
|
| 113 |
+
#include <cstring>
|
| 114 |
+
#endif /* defined(__cplusplus) && !defined(__CUDACC__) */
|
| 115 |
+
|
| 116 |
+
static __host__ __device__ short __internal_cast_u2s(unsigned short x)
|
| 117 |
+
{
|
| 118 |
+
short res;
|
| 119 |
+
#if defined(__CUDACC__)
|
| 120 |
+
(void)memcpy(&res, &x, sizeof(x));
|
| 121 |
+
#else
|
| 122 |
+
(void)std::memcpy(&res, &x, sizeof(x));
|
| 123 |
+
#endif
|
| 124 |
+
return res;
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vimax_s32_relu(const int a, const int b){
|
| 128 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 129 |
+
int res;
|
| 130 |
+
asm("{max.s32.relu %0, %1, %2;}" : "=r"(res) : "r"(a), "r"(b));
|
| 131 |
+
return res;
|
| 132 |
+
#else
|
| 133 |
+
// Host and older architecture code
|
| 134 |
+
int ans = max(a, b);
|
| 135 |
+
|
| 136 |
+
return (ans > 0) ? ans : 0;
|
| 137 |
+
#endif
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimax_s16x2_relu(const unsigned int a, const unsigned int b){
|
| 141 |
+
unsigned int res;
|
| 142 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 143 |
+
asm("{max.s16x2.relu %0, %1, %2;}" : "=r"(res) : "r"(a), "r"(b));
|
| 144 |
+
#elif defined(__CUDA_ARCH__)
|
| 145 |
+
res = __vmaxs2(__vmaxs2(a, b), 0U);
|
| 146 |
+
#else
|
| 147 |
+
// Host and older architecture code
|
| 148 |
+
// Separate our high and low bit:
|
| 149 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 150 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 151 |
+
|
| 152 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 153 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 154 |
+
|
| 155 |
+
//cast to signed:
|
| 156 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 157 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 158 |
+
|
| 159 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 160 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 161 |
+
|
| 162 |
+
// Get answer
|
| 163 |
+
int ansI_lo = max(aS_lo, bS_lo);
|
| 164 |
+
int ansI_hi = max(aS_hi, bS_hi);
|
| 165 |
+
|
| 166 |
+
// relu
|
| 167 |
+
if(ansI_lo < 0){ ansI_lo = 0; }
|
| 168 |
+
if(ansI_hi < 0){ ansI_hi = 0; }
|
| 169 |
+
|
| 170 |
+
// Cast back to unsigned:
|
| 171 |
+
unsigned ansU_lo = (unsigned)ansI_lo;
|
| 172 |
+
unsigned ansU_hi = (unsigned)ansI_hi;
|
| 173 |
+
|
| 174 |
+
// Put answer back together:
|
| 175 |
+
res = ansU_lo | (ansU_hi << 16);
|
| 176 |
+
#endif
|
| 177 |
+
|
| 178 |
+
return res;
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vimin_s32_relu(const int a, const int b){
|
| 182 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 183 |
+
int res;
|
| 184 |
+
asm("{min.s32.relu %0, %1, %2;}" : "=r"(res) : "r"(a), "r"(b));
|
| 185 |
+
return res;
|
| 186 |
+
#else
|
| 187 |
+
// Host and older architecture code
|
| 188 |
+
int ans = min(a, b);
|
| 189 |
+
|
| 190 |
+
return (ans > 0) ? ans : 0;
|
| 191 |
+
#endif
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimin_s16x2_relu(const unsigned int a, const unsigned int b){
|
| 195 |
+
unsigned int res;
|
| 196 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 197 |
+
asm("{min.s16x2.relu %0, %1, %2;}" : "=r"(res) : "r"(a), "r"(b));
|
| 198 |
+
#elif defined(__CUDA_ARCH__)
|
| 199 |
+
res = __vmaxs2(__vmins2(a, b), 0U);
|
| 200 |
+
#else
|
| 201 |
+
// Host and older architecture code
|
| 202 |
+
// Separate our high and low bit:
|
| 203 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 204 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 205 |
+
|
| 206 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 207 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 208 |
+
|
| 209 |
+
//cast to signed:
|
| 210 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 211 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 212 |
+
|
| 213 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 214 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 215 |
+
|
| 216 |
+
// Get answer
|
| 217 |
+
int ansI_lo = min(aS_lo, bS_lo);
|
| 218 |
+
int ansI_hi = min(aS_hi, bS_hi);
|
| 219 |
+
|
| 220 |
+
// relu
|
| 221 |
+
if(ansI_lo < 0){ ansI_lo = 0; }
|
| 222 |
+
if(ansI_hi < 0){ ansI_hi = 0; }
|
| 223 |
+
|
| 224 |
+
// Cast back to unsigned:
|
| 225 |
+
unsigned ansU_lo = (unsigned)ansI_lo;
|
| 226 |
+
unsigned ansU_hi = (unsigned)ansI_hi;
|
| 227 |
+
|
| 228 |
+
// Put answer back together:
|
| 229 |
+
res = ansU_lo | (ansU_hi << 16);
|
| 230 |
+
#endif
|
| 231 |
+
|
| 232 |
+
return res;
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vimax3_s32(const int a, const int b, const int c){
|
| 236 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 237 |
+
int res;
|
| 238 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 239 |
+
"max.s32 t1, %1, %2; \n\t"
|
| 240 |
+
"max.s32 %0, t1, %3;}\n\t"
|
| 241 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 242 |
+
return res;
|
| 243 |
+
#else
|
| 244 |
+
// Host and older architecture code
|
| 245 |
+
return max(max(a, b), c);
|
| 246 |
+
#endif
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimax3_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 250 |
+
unsigned int res;
|
| 251 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 252 |
+
// Future asm code (naming/syntax may change):
|
| 253 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 254 |
+
"max.s16x2 t1, %1, %2; \n\t"
|
| 255 |
+
"max.s16x2 %0, t1, %3;}\n\t"
|
| 256 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 257 |
+
#elif defined(__CUDA_AND_AT_LEAST_SM_70__)
|
| 258 |
+
res = __vmaxs2(__vmaxs2(a, b), c);
|
| 259 |
+
#else
|
| 260 |
+
// Host and older architecture code
|
| 261 |
+
// Separate our high and low bit:
|
| 262 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 263 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 264 |
+
|
| 265 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 266 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 267 |
+
|
| 268 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 269 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 270 |
+
|
| 271 |
+
//cast to signed:
|
| 272 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 273 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 274 |
+
|
| 275 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 276 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 277 |
+
|
| 278 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 279 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 280 |
+
|
| 281 |
+
// Get answer
|
| 282 |
+
unsigned int ansU_lo = (unsigned int)max(max(aS_lo, bS_lo), cS_lo);
|
| 283 |
+
unsigned int ansU_hi = (unsigned int)max(max(aS_hi, bS_hi), cS_hi);
|
| 284 |
+
|
| 285 |
+
// Put answer back together:
|
| 286 |
+
res = (ansU_lo & 0x0000FFFFU) | (ansU_hi << 16);
|
| 287 |
+
#endif
|
| 288 |
+
return res;
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimax3_u32(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 292 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 293 |
+
int res;
|
| 294 |
+
asm ("{.reg .u32 t1; \n\t"
|
| 295 |
+
"max.u32 t1, %1, %2; \n\t"
|
| 296 |
+
"max.u32 %0, t1, %3;}\n\t"
|
| 297 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 298 |
+
return res;
|
| 299 |
+
#else
|
| 300 |
+
// Host and older architecture code
|
| 301 |
+
return max(max(a, b), c);
|
| 302 |
+
#endif
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimax3_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 306 |
+
unsigned int res;
|
| 307 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 308 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 309 |
+
"max.u16x2 t1, %1, %2; \n\t"
|
| 310 |
+
"max.u16x2 %0, t1, %3;}\n\t"
|
| 311 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 312 |
+
#elif defined(__CUDA_ARCH__)
|
| 313 |
+
res = __vmaxu2(__vmaxu2(a, b), c);
|
| 314 |
+
#else
|
| 315 |
+
// Host and older architecture code
|
| 316 |
+
// Separate our high and low bit:
|
| 317 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 318 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 319 |
+
|
| 320 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 321 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 322 |
+
|
| 323 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 324 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 325 |
+
|
| 326 |
+
// Get answer
|
| 327 |
+
unsigned short ansU_lo = (unsigned short)max(max(aU_lo, bU_lo), cU_lo);
|
| 328 |
+
unsigned short ansU_hi = (unsigned short)max(max(aU_hi, bU_hi), cU_hi);
|
| 329 |
+
|
| 330 |
+
// Put answer back together:
|
| 331 |
+
res = ((unsigned int) ansU_lo) | (((unsigned int) ansU_hi) << 16);
|
| 332 |
+
#endif
|
| 333 |
+
|
| 334 |
+
return res;
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vimin3_s32(const int a, const int b, const int c){
|
| 338 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 339 |
+
int res;
|
| 340 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 341 |
+
"min.s32 t1, %1, %2; \n\t"
|
| 342 |
+
"min.s32 %0, t1, %3;}\n\t"
|
| 343 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 344 |
+
return res;
|
| 345 |
+
#else
|
| 346 |
+
// Host and older architecture code
|
| 347 |
+
return min(min(a, b), c);
|
| 348 |
+
#endif
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimin3_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 352 |
+
unsigned int res;
|
| 353 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 354 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 355 |
+
"min.s16x2 t1, %1, %2; \n\t"
|
| 356 |
+
"min.s16x2 %0, t1, %3;}\n\t"
|
| 357 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 358 |
+
#elif defined(__CUDA_AND_AT_LEAST_SM_70__)
|
| 359 |
+
res = __vmins2(__vmins2(a, b), c);
|
| 360 |
+
#else
|
| 361 |
+
// Host and older architecture code
|
| 362 |
+
// Separate our high and low bit:
|
| 363 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 364 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 365 |
+
|
| 366 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 367 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 368 |
+
|
| 369 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 370 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 371 |
+
|
| 372 |
+
//cast to signed:
|
| 373 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 374 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 375 |
+
|
| 376 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 377 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 378 |
+
|
| 379 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 380 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 381 |
+
|
| 382 |
+
// Get answer
|
| 383 |
+
unsigned int ansU_lo = (unsigned int)min(min(aS_lo, bS_lo), cS_lo);
|
| 384 |
+
unsigned int ansU_hi = (unsigned int)min(min(aS_hi, bS_hi), cS_hi);
|
| 385 |
+
|
| 386 |
+
// Put answer back together:
|
| 387 |
+
res = (ansU_lo & 0x0000FFFFU) | (ansU_hi << 16);
|
| 388 |
+
#endif
|
| 389 |
+
|
| 390 |
+
return res;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimin3_u32(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 394 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 395 |
+
int res;
|
| 396 |
+
asm ("{.reg .u32 t1; \n\t"
|
| 397 |
+
"min.u32 t1, %1, %2; \n\t"
|
| 398 |
+
"min.u32 %0, t1, %3;}\n\t"
|
| 399 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 400 |
+
return res;
|
| 401 |
+
#else
|
| 402 |
+
// Host and older architecture code
|
| 403 |
+
return min(min(a, b), c);
|
| 404 |
+
#endif
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimin3_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 408 |
+
unsigned int res;
|
| 409 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 410 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 411 |
+
"min.u16x2 t1, %1, %2; \n\t"
|
| 412 |
+
"min.u16x2 %0, t1, %3;}\n\t"
|
| 413 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 414 |
+
#elif defined(__CUDA_ARCH__)
|
| 415 |
+
res = __vminu2(__vminu2(a, b), c);
|
| 416 |
+
#else
|
| 417 |
+
// Host and older architecture code
|
| 418 |
+
// Separate our high and low bit:
|
| 419 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 420 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 421 |
+
|
| 422 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 423 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 424 |
+
|
| 425 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 426 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 427 |
+
|
| 428 |
+
// Get answer
|
| 429 |
+
unsigned short ansU_lo = (unsigned short)min(min(aU_lo, bU_lo), cU_lo);
|
| 430 |
+
unsigned short ansU_hi = (unsigned short)min(min(aU_hi, bU_hi), cU_hi);
|
| 431 |
+
|
| 432 |
+
// Put answer back together:
|
| 433 |
+
res = ((unsigned int) ansU_lo) | (((unsigned int) ansU_hi) << 16);
|
| 434 |
+
#endif
|
| 435 |
+
|
| 436 |
+
return res;
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vimax3_s32_relu(const int a, const int b, const int c){
|
| 440 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 441 |
+
int res;
|
| 442 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 443 |
+
"max.s32.relu t1, %1, %2; \n\t"
|
| 444 |
+
"max.s32.relu %0, t1, %3;}\n\t"
|
| 445 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 446 |
+
return res;
|
| 447 |
+
#else
|
| 448 |
+
// Host and older architecture code
|
| 449 |
+
int ans = max(max(a, b), c);
|
| 450 |
+
|
| 451 |
+
return (ans > 0) ? ans : 0;
|
| 452 |
+
#endif
|
| 453 |
+
}
|
| 454 |
+
|
| 455 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimax3_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 456 |
+
unsigned int res;
|
| 457 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 458 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 459 |
+
"max.s16x2.relu t1, %1, %2; \n\t"
|
| 460 |
+
"max.s16x2.relu %0, t1, %3;}\n\t"
|
| 461 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 462 |
+
#elif defined(__CUDA_AND_AT_LEAST_SM_75__)
|
| 463 |
+
res = __vimax_s16x2_relu(__vmaxs2(a, b), c);
|
| 464 |
+
#else
|
| 465 |
+
// Host and older architecture code
|
| 466 |
+
// Separate our high and low bit:
|
| 467 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 468 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 469 |
+
|
| 470 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 471 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 472 |
+
|
| 473 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 474 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 475 |
+
|
| 476 |
+
//cast to signed:
|
| 477 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 478 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 479 |
+
|
| 480 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 481 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 482 |
+
|
| 483 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 484 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 485 |
+
|
| 486 |
+
// Get answer
|
| 487 |
+
unsigned ansU_lo = (unsigned)max(0, max(max(aS_lo, bS_lo), cS_lo));
|
| 488 |
+
unsigned ansU_hi = (unsigned)max(0, max(max(aS_hi, bS_hi), cS_hi));
|
| 489 |
+
|
| 490 |
+
// Put answer back together:
|
| 491 |
+
res = ansU_lo | (ansU_hi << 16);
|
| 492 |
+
#endif
|
| 493 |
+
|
| 494 |
+
return res;
|
| 495 |
+
}
|
| 496 |
+
|
| 497 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vimin3_s32_relu(const int a, const int b, const int c){
|
| 498 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 499 |
+
int res;
|
| 500 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 501 |
+
"min.s32.relu t1, %1, %2; \n\t"
|
| 502 |
+
"min.s32.relu %0, t1, %3;}\n\t"
|
| 503 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 504 |
+
return res;
|
| 505 |
+
#else
|
| 506 |
+
// Host and older architecture code
|
| 507 |
+
int ans = min(min(a, b), c);
|
| 508 |
+
|
| 509 |
+
return (ans > 0) ? ans : 0;
|
| 510 |
+
#endif
|
| 511 |
+
}
|
| 512 |
+
|
| 513 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vimin3_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 514 |
+
unsigned res;
|
| 515 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 516 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 517 |
+
"min.s16x2.relu t1, %1, %2; \n\t"
|
| 518 |
+
"min.s16x2.relu %0, t1, %3;}\n\t"
|
| 519 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 520 |
+
#elif defined(__CUDA_AND_AT_LEAST_SM_75__)
|
| 521 |
+
res = __vimin_s16x2_relu(__vmins2(a, b), c);
|
| 522 |
+
#else
|
| 523 |
+
// Host and older architecture code
|
| 524 |
+
// Separate our high and low bit:
|
| 525 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 526 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 527 |
+
|
| 528 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 529 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 530 |
+
|
| 531 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 532 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 533 |
+
|
| 534 |
+
//cast to signed:
|
| 535 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 536 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 537 |
+
|
| 538 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 539 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 540 |
+
|
| 541 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 542 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 543 |
+
|
| 544 |
+
// Get answer
|
| 545 |
+
unsigned ansU_lo = (unsigned)max(0, min(min(aS_lo, bS_lo), cS_lo));
|
| 546 |
+
unsigned ansU_hi = (unsigned)max(0, min(min(aS_hi, bS_hi), cS_hi));
|
| 547 |
+
|
| 548 |
+
// Put answer back together:
|
| 549 |
+
res = ansU_lo | (ansU_hi << 16);
|
| 550 |
+
|
| 551 |
+
#endif
|
| 552 |
+
|
| 553 |
+
return res;
|
| 554 |
+
}
|
| 555 |
+
|
| 556 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __viaddmax_s32(const int a, const int b, const int c){
|
| 557 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 558 |
+
int res;
|
| 559 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 560 |
+
"add.s32 t1, %1, %2; \n\t"
|
| 561 |
+
"max.s32 %0, t1, %3;}\n\t"
|
| 562 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 563 |
+
return res;
|
| 564 |
+
#else
|
| 565 |
+
// Host and older architecture code
|
| 566 |
+
return max(a + b, c);
|
| 567 |
+
#endif
|
| 568 |
+
}
|
| 569 |
+
|
| 570 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmax_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 571 |
+
unsigned int res;
|
| 572 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 573 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 574 |
+
"add.s16x2 t1, %1, %2; \n\t"
|
| 575 |
+
"max.s16x2 %0, t1, %3;}\n\t"
|
| 576 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 577 |
+
#elif defined(__CUDA_ARCH__)
|
| 578 |
+
res = __vmaxs2(__vadd2(a, b), c);
|
| 579 |
+
#else
|
| 580 |
+
// Host and older architecture code
|
| 581 |
+
// Separate our high and low bit:
|
| 582 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 583 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 584 |
+
|
| 585 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 586 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 587 |
+
|
| 588 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 589 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 590 |
+
|
| 591 |
+
aU_lo += bU_lo;
|
| 592 |
+
aU_hi += bU_hi;
|
| 593 |
+
|
| 594 |
+
//cast to signed:
|
| 595 |
+
short sS_lo = __internal_cast_u2s(aU_lo);
|
| 596 |
+
short sS_hi = __internal_cast_u2s(aU_hi);
|
| 597 |
+
|
| 598 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 599 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 600 |
+
|
| 601 |
+
// Get answer
|
| 602 |
+
unsigned ansU_lo = (unsigned)max(sS_lo, cS_lo);
|
| 603 |
+
unsigned ansU_hi = (unsigned)max(sS_hi, cS_hi);
|
| 604 |
+
|
| 605 |
+
// Put answer back together:
|
| 606 |
+
res = (ansU_lo & 0x0000FFFFU) | (ansU_hi << 16);
|
| 607 |
+
#endif
|
| 608 |
+
|
| 609 |
+
return res;
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmax_u32(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 613 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 614 |
+
unsigned int res;
|
| 615 |
+
asm ("{.reg .u32 t1; \n\t"
|
| 616 |
+
"add.u32 t1, %1, %2; \n\t"
|
| 617 |
+
"max.u32 %0, t1, %3;}\n\t"
|
| 618 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 619 |
+
return res;
|
| 620 |
+
#else
|
| 621 |
+
// Host and older architecture code
|
| 622 |
+
return max(a + b, c);
|
| 623 |
+
#endif
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmax_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 627 |
+
unsigned int res;
|
| 628 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 629 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 630 |
+
"add.u16x2 t1, %1, %2; \n\t"
|
| 631 |
+
"max.u16x2 %0, t1, %3;}\n\t"
|
| 632 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 633 |
+
#elif defined(__CUDA_ARCH__)
|
| 634 |
+
res = __vmaxu2(__vadd2(a, b), c);
|
| 635 |
+
#else
|
| 636 |
+
// Host and older architecture code
|
| 637 |
+
// Separate our high and low bit:
|
| 638 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 639 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 640 |
+
|
| 641 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 642 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 643 |
+
|
| 644 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 645 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 646 |
+
|
| 647 |
+
// Get answer
|
| 648 |
+
unsigned short ansU_lo = (unsigned short)max((unsigned short)(aU_lo + bU_lo), cU_lo);
|
| 649 |
+
unsigned short ansU_hi = (unsigned short)max((unsigned short)(aU_hi + bU_hi), cU_hi);
|
| 650 |
+
|
| 651 |
+
// Put answer back together:
|
| 652 |
+
res = ((unsigned int) ansU_lo) | (((unsigned int) ansU_hi) << 16);
|
| 653 |
+
#endif
|
| 654 |
+
|
| 655 |
+
return res;
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __viaddmin_s32(const int a, const int b, const int c){
|
| 659 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 660 |
+
int res;
|
| 661 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 662 |
+
"add.s32 t1, %1, %2; \n\t"
|
| 663 |
+
"min.s32 %0, t1, %3;}\n\t"
|
| 664 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 665 |
+
return res;
|
| 666 |
+
#else
|
| 667 |
+
// Host and older architecture code
|
| 668 |
+
return min(a + b, c);
|
| 669 |
+
#endif
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmin_s16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 673 |
+
unsigned int res;
|
| 674 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 675 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 676 |
+
"add.s16x2 t1, %1, %2; \n\t"
|
| 677 |
+
"min.s16x2 %0, t1, %3;}\n\t"
|
| 678 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 679 |
+
#elif defined(__CUDA_ARCH__)
|
| 680 |
+
res = __vmins2(__vadd2(a, b), c);
|
| 681 |
+
#else
|
| 682 |
+
// Host and older architecture code
|
| 683 |
+
// Separate our high and low bit:
|
| 684 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 685 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 686 |
+
|
| 687 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 688 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 689 |
+
|
| 690 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 691 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 692 |
+
|
| 693 |
+
aU_lo += bU_lo;
|
| 694 |
+
aU_hi += bU_hi;
|
| 695 |
+
|
| 696 |
+
//cast to signed:
|
| 697 |
+
short sS_lo = __internal_cast_u2s(aU_lo);
|
| 698 |
+
short sS_hi = __internal_cast_u2s(aU_hi);
|
| 699 |
+
|
| 700 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 701 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 702 |
+
|
| 703 |
+
// Get answer
|
| 704 |
+
unsigned ansU_lo = (unsigned)min(sS_lo, cS_lo);
|
| 705 |
+
unsigned ansU_hi = (unsigned)min(sS_hi, cS_hi);
|
| 706 |
+
|
| 707 |
+
// Put answer back together:
|
| 708 |
+
res = (ansU_lo & 0x0000FFFFU) | (ansU_hi << 16);
|
| 709 |
+
#endif
|
| 710 |
+
|
| 711 |
+
return res;
|
| 712 |
+
}
|
| 713 |
+
|
| 714 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmin_u32(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 715 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 716 |
+
unsigned int res;
|
| 717 |
+
asm ("{.reg .u32 t1; \n\t"
|
| 718 |
+
"add.u32 t1, %1, %2; \n\t"
|
| 719 |
+
"min.u32 %0, t1, %3;}\n\t"
|
| 720 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 721 |
+
return res;
|
| 722 |
+
#else
|
| 723 |
+
// Host and older architecture code
|
| 724 |
+
return min(a + b, c);
|
| 725 |
+
#endif
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmin_u16x2(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 729 |
+
unsigned int res;
|
| 730 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 731 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 732 |
+
"add.u16x2 t1, %1, %2; \n\t"
|
| 733 |
+
"min.u16x2 %0, t1, %3;}\n\t"
|
| 734 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 735 |
+
#elif defined(__CUDA_ARCH__)
|
| 736 |
+
res = __vminu2(__vadd2(a, b), c);
|
| 737 |
+
#else
|
| 738 |
+
// Host and older architecture code
|
| 739 |
+
// Separate our high and low bit:
|
| 740 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 741 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 742 |
+
|
| 743 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 744 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 745 |
+
|
| 746 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 747 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 748 |
+
|
| 749 |
+
// Get answer
|
| 750 |
+
unsigned short ansU_lo = (unsigned short)min((unsigned short)(aU_lo + bU_lo), cU_lo);
|
| 751 |
+
unsigned short ansU_hi = (unsigned short)min((unsigned short)(aU_hi + bU_hi), cU_hi);
|
| 752 |
+
|
| 753 |
+
// Put answer back together:
|
| 754 |
+
res = ((unsigned int) ansU_lo) | (((unsigned int) ansU_hi) << 16);
|
| 755 |
+
#endif
|
| 756 |
+
|
| 757 |
+
return res;
|
| 758 |
+
}
|
| 759 |
+
|
| 760 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __viaddmax_s32_relu(const int a, const int b, const int c){
|
| 761 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 762 |
+
int res;
|
| 763 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 764 |
+
"add.s32 t1, %1, %2; \n\t"
|
| 765 |
+
"max.s32.relu %0, t1, %3;}\n\t"
|
| 766 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 767 |
+
return res;
|
| 768 |
+
#else
|
| 769 |
+
// Host and older architecture code
|
| 770 |
+
int ans = max(a + b, c);
|
| 771 |
+
|
| 772 |
+
return (ans > 0) ? ans : 0;
|
| 773 |
+
#endif
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmax_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 777 |
+
unsigned int res;
|
| 778 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 779 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 780 |
+
"add.s16x2 t1, %1, %2; \n\t"
|
| 781 |
+
"max.s16x2.relu %0, t1, %3;}\n\t"
|
| 782 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 783 |
+
#elif defined(__CUDA_ARCH__)
|
| 784 |
+
res = __vimax_s16x2_relu(__vadd2(a, b), c);
|
| 785 |
+
#else
|
| 786 |
+
// Host and older architecture code
|
| 787 |
+
// Separate our high and low bit:
|
| 788 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 789 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 790 |
+
|
| 791 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 792 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 793 |
+
|
| 794 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 795 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 796 |
+
|
| 797 |
+
aU_lo += bU_lo;
|
| 798 |
+
aU_hi += bU_hi;
|
| 799 |
+
|
| 800 |
+
//cast to signed:
|
| 801 |
+
short sS_lo = __internal_cast_u2s(aU_lo);
|
| 802 |
+
short sS_hi = __internal_cast_u2s(aU_hi);
|
| 803 |
+
|
| 804 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 805 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 806 |
+
|
| 807 |
+
// Get answer
|
| 808 |
+
unsigned ansU_lo = (unsigned)max(0, max(sS_lo, cS_lo));
|
| 809 |
+
unsigned ansU_hi = (unsigned)max(0, max(sS_hi, cS_hi));
|
| 810 |
+
|
| 811 |
+
// Put answer back together:
|
| 812 |
+
res = ansU_lo | (ansU_hi << 16);
|
| 813 |
+
#endif
|
| 814 |
+
|
| 815 |
+
return res;
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __viaddmin_s32_relu(const int a, const int b, const int c){
|
| 819 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 820 |
+
int res;
|
| 821 |
+
asm ("{.reg .s32 t1; \n\t"
|
| 822 |
+
"add.s32 t1, %1, %2; \n\t"
|
| 823 |
+
"min.s32.relu %0, t1, %3;}\n\t"
|
| 824 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 825 |
+
return res;
|
| 826 |
+
#else
|
| 827 |
+
// Host and older architecture code
|
| 828 |
+
int ans = min(a + b, c);
|
| 829 |
+
|
| 830 |
+
return (ans > 0) ? ans : 0;
|
| 831 |
+
#endif
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __viaddmin_s16x2_relu(const unsigned int a, const unsigned int b, const unsigned int c){
|
| 835 |
+
unsigned int res;
|
| 836 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 837 |
+
asm ("{.reg .b32 t1; \n\t"
|
| 838 |
+
"add.s16x2 t1, %1, %2; \n\t"
|
| 839 |
+
"min.s16x2.relu %0, t1, %3;}\n\t"
|
| 840 |
+
: "=r"(res) : "r"(a), "r"(b), "r"(c));
|
| 841 |
+
#elif defined(__CUDA_ARCH__)
|
| 842 |
+
res = __vimin_s16x2_relu(__vadd2(a, b), c);
|
| 843 |
+
#else
|
| 844 |
+
// Host and older architecture code
|
| 845 |
+
// Separate our high and low bit:
|
| 846 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 847 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 848 |
+
|
| 849 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 850 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 851 |
+
|
| 852 |
+
unsigned short cU_lo = (unsigned short)(c & 0xFFFFU);
|
| 853 |
+
unsigned short cU_hi = (unsigned short)(c >> 16);
|
| 854 |
+
|
| 855 |
+
aU_lo += bU_lo;
|
| 856 |
+
aU_hi += bU_hi;
|
| 857 |
+
|
| 858 |
+
//cast to signed:
|
| 859 |
+
short sS_lo = __internal_cast_u2s(aU_lo);
|
| 860 |
+
short sS_hi = __internal_cast_u2s(aU_hi);
|
| 861 |
+
|
| 862 |
+
short cS_lo = __internal_cast_u2s(cU_lo);
|
| 863 |
+
short cS_hi = __internal_cast_u2s(cU_hi);
|
| 864 |
+
|
| 865 |
+
// Get answer
|
| 866 |
+
unsigned ansU_lo = (unsigned)max(0, min(sS_lo, cS_lo));
|
| 867 |
+
unsigned ansU_hi = (unsigned)max(0, min(sS_hi, cS_hi));
|
| 868 |
+
|
| 869 |
+
// Put answer back together:
|
| 870 |
+
res = ansU_lo | (ansU_hi << 16);
|
| 871 |
+
#endif
|
| 872 |
+
|
| 873 |
+
return res;
|
| 874 |
+
}
|
| 875 |
+
|
| 876 |
+
// vimax vimin with predicate
|
| 877 |
+
// *pred gets set to '(a >= b)'
|
| 878 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vibmax_s32(const int a, const int b, bool* const pred){
|
| 879 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 880 |
+
int val;
|
| 881 |
+
unsigned int predicate_local;
|
| 882 |
+
asm ("{ .reg .pred __$temp1;\n\t"
|
| 883 |
+
" setp.ge.s32 __$temp1, %2, %3;\n\t"
|
| 884 |
+
" selp.s32 %0, %2, %3, __$temp1;\n\t"
|
| 885 |
+
" selp.s32 %1, 1, 0, __$temp1;}\n\t"
|
| 886 |
+
: "=r"(val), "=r"(predicate_local) : "r"(a), "r"(b));
|
| 887 |
+
|
| 888 |
+
*pred = (bool)predicate_local;
|
| 889 |
+
return val;
|
| 890 |
+
#else
|
| 891 |
+
// Host and older architecture code
|
| 892 |
+
int ans = max(a, b);
|
| 893 |
+
|
| 894 |
+
*pred = (a >= b);
|
| 895 |
+
return ans;
|
| 896 |
+
#endif
|
| 897 |
+
}
|
| 898 |
+
|
| 899 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vibmax_u32(const unsigned int a, const unsigned int b, bool* const pred){
|
| 900 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 901 |
+
unsigned int val;
|
| 902 |
+
unsigned int predicate_local;
|
| 903 |
+
asm ("{ .reg .pred __$temp1;\n\t"
|
| 904 |
+
" setp.ge.u32 __$temp1, %2, %3;\n\t"
|
| 905 |
+
" selp.u32 %0, %2, %3, __$temp1;\n\t"
|
| 906 |
+
" selp.u32 %1, 1, 0, __$temp1;}\n\t"
|
| 907 |
+
: "=r"(val), "=r"(predicate_local) : "r"(a), "r"(b));
|
| 908 |
+
|
| 909 |
+
*pred = (bool)predicate_local;
|
| 910 |
+
return val;
|
| 911 |
+
#else
|
| 912 |
+
// Host and older architecture code
|
| 913 |
+
unsigned int ans = max(a, b);
|
| 914 |
+
|
| 915 |
+
*pred = (a >= b);
|
| 916 |
+
return ans;
|
| 917 |
+
#endif
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
// *pred gets set to '(a <= b)'
|
| 921 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ int __vibmin_s32(const int a, const int b, bool* const pred){
|
| 922 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 923 |
+
int val;
|
| 924 |
+
unsigned int predicate_local;
|
| 925 |
+
asm ("{ .reg .pred __$temp1;\n\t"
|
| 926 |
+
" setp.le.s32 __$temp1, %2, %3;\n\t"
|
| 927 |
+
" selp.s32 %0, %2, %3, __$temp1;\n\t"
|
| 928 |
+
" selp.s32 %1, 1, 0, __$temp1;}\n\t"
|
| 929 |
+
: "=r"(val), "=r"(predicate_local) : "r"(a), "r"(b));
|
| 930 |
+
|
| 931 |
+
*pred = (bool)predicate_local;
|
| 932 |
+
return val;
|
| 933 |
+
#else
|
| 934 |
+
// Host and older architecture code
|
| 935 |
+
int ans = min(a, b);
|
| 936 |
+
|
| 937 |
+
*pred = (a <= b);
|
| 938 |
+
return ans;
|
| 939 |
+
#endif
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
// *pred gets set to '(a <= b)'
|
| 943 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vibmin_u32(const unsigned int a, const unsigned int b, bool* const pred){
|
| 944 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 945 |
+
unsigned int val;
|
| 946 |
+
unsigned int predicate_local;
|
| 947 |
+
asm ("{ .reg .pred __$temp1;\n\t"
|
| 948 |
+
" setp.le.u32 __$temp1, %2, %3;\n\t"
|
| 949 |
+
" selp.u32 %0, %2, %3, __$temp1;\n\t"
|
| 950 |
+
" selp.u32 %1, 1, 0, __$temp1;}\n\t"
|
| 951 |
+
: "=r"(val), "=r"(predicate_local) : "r"(a), "r"(b));
|
| 952 |
+
|
| 953 |
+
*pred = (bool)predicate_local;
|
| 954 |
+
return val;
|
| 955 |
+
#else
|
| 956 |
+
// Host and older architecture code
|
| 957 |
+
unsigned int ans = min(a, b);
|
| 958 |
+
|
| 959 |
+
*pred = (a <= b);
|
| 960 |
+
return ans;
|
| 961 |
+
#endif
|
| 962 |
+
}
|
| 963 |
+
|
| 964 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vibmax_s16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){
|
| 965 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 966 |
+
unsigned int val;
|
| 967 |
+
unsigned int predicate_local_hi;
|
| 968 |
+
unsigned int predicate_local_lo;
|
| 969 |
+
asm ("{.reg .pred pu, pv; \n\t"
|
| 970 |
+
".reg .s16 rs0, rs1, rs2, rs3; \n\t"
|
| 971 |
+
"max.s16x2 %0, %3, %4; \n\t"
|
| 972 |
+
"mov.b32 {rs0, rs1}, %0; \n\t"
|
| 973 |
+
"mov.b32 {rs2, rs3}, %3; \n\t"
|
| 974 |
+
"setp.eq.s16 pv, rs0, rs2; \n\t"
|
| 975 |
+
"setp.eq.s16 pu, rs1, rs3; \n\t"
|
| 976 |
+
"selp.b32 %1, 1, 0, pu; \n\t"
|
| 977 |
+
"selp.b32 %2, 1, 0, pv;} \n\t"
|
| 978 |
+
: "=r"(val), "=r"(predicate_local_hi),"=r"(predicate_local_lo) : "r"(a), "r"(b));
|
| 979 |
+
|
| 980 |
+
*pred_hi = (bool)predicate_local_hi;
|
| 981 |
+
*pred_lo = (bool)predicate_local_lo;
|
| 982 |
+
return val;
|
| 983 |
+
#else
|
| 984 |
+
// Host and older architecture code
|
| 985 |
+
// Separate our high and low bit:
|
| 986 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 987 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 988 |
+
|
| 989 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 990 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 991 |
+
|
| 992 |
+
//cast to signed:
|
| 993 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 994 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 995 |
+
|
| 996 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 997 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 998 |
+
|
| 999 |
+
// Get answer
|
| 1000 |
+
unsigned int ansU_lo = (unsigned int)max(aS_lo, bS_lo);
|
| 1001 |
+
unsigned int ansU_hi = (unsigned int)max(aS_hi, bS_hi);
|
| 1002 |
+
|
| 1003 |
+
*pred_hi = (aS_hi >= bS_hi);
|
| 1004 |
+
*pred_lo = (aS_lo >= bS_lo);
|
| 1005 |
+
|
| 1006 |
+
// Put answer back together:
|
| 1007 |
+
unsigned int ans = (ansU_lo & 0x0000FFFFU) | (ansU_hi << 16);
|
| 1008 |
+
|
| 1009 |
+
return ans;
|
| 1010 |
+
#endif
|
| 1011 |
+
}
|
| 1012 |
+
|
| 1013 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vibmax_u16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){
|
| 1014 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 1015 |
+
unsigned int val;
|
| 1016 |
+
unsigned int predicate_local_hi;
|
| 1017 |
+
unsigned int predicate_local_lo;
|
| 1018 |
+
asm ("{.reg .pred pu, pv; \n\t"
|
| 1019 |
+
".reg .u16 rs0, rs1, rs2, rs3; \n\t"
|
| 1020 |
+
"max.u16x2 %0, %3, %4; \n\t"
|
| 1021 |
+
"mov.b32 {rs0, rs1}, %0; \n\t"
|
| 1022 |
+
"mov.b32 {rs2, rs3}, %3; \n\t"
|
| 1023 |
+
"setp.eq.u16 pv, rs0, rs2; \n\t"
|
| 1024 |
+
"setp.eq.u16 pu, rs1, rs3; \n\t"
|
| 1025 |
+
"selp.b32 %1, 1, 0, pu; \n\t"
|
| 1026 |
+
"selp.b32 %2, 1, 0, pv;} \n\t"
|
| 1027 |
+
: "=r"(val), "=r"(predicate_local_hi),"=r"(predicate_local_lo) : "r"(a), "r"(b));
|
| 1028 |
+
|
| 1029 |
+
*pred_hi = (bool)predicate_local_hi;
|
| 1030 |
+
*pred_lo = (bool)predicate_local_lo;
|
| 1031 |
+
return val;
|
| 1032 |
+
#else
|
| 1033 |
+
// Host and older architecture code
|
| 1034 |
+
// Separate our high and low bit:
|
| 1035 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 1036 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 1037 |
+
|
| 1038 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 1039 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 1040 |
+
|
| 1041 |
+
// Get answer
|
| 1042 |
+
unsigned short ansU_lo = (unsigned short)max(aU_lo, bU_lo);
|
| 1043 |
+
unsigned short ansU_hi = (unsigned short)max(aU_hi, bU_hi);
|
| 1044 |
+
|
| 1045 |
+
*pred_hi = (aU_hi >= bU_hi);
|
| 1046 |
+
*pred_lo = (aU_lo >= bU_lo);
|
| 1047 |
+
|
| 1048 |
+
// Put answer back together:
|
| 1049 |
+
unsigned int ans = ((unsigned int) ansU_lo) | (((unsigned int) ansU_hi) << 16);
|
| 1050 |
+
|
| 1051 |
+
return ans;
|
| 1052 |
+
#endif
|
| 1053 |
+
}
|
| 1054 |
+
|
| 1055 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vibmin_s16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){
|
| 1056 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 1057 |
+
unsigned int val;
|
| 1058 |
+
unsigned int predicate_local_hi;
|
| 1059 |
+
unsigned int predicate_local_lo;
|
| 1060 |
+
asm ("{.reg .pred pu, pv; \n\t"
|
| 1061 |
+
".reg .u16 rs0, rs1, rs2, rs3; \n\t"
|
| 1062 |
+
"min.s16x2 %0, %3, %4; \n\t"
|
| 1063 |
+
"mov.b32 {rs0, rs1}, %0; \n\t"
|
| 1064 |
+
"mov.b32 {rs2, rs3}, %3; \n\t"
|
| 1065 |
+
"setp.eq.s16 pv, rs0, rs2; \n\t"
|
| 1066 |
+
"setp.eq.s16 pu, rs1, rs3; \n\t"
|
| 1067 |
+
"selp.b32 %1, 1, 0, pu; \n\t"
|
| 1068 |
+
"selp.b32 %2, 1, 0, pv;} \n\t"
|
| 1069 |
+
: "=r"(val), "=r"(predicate_local_hi),"=r"(predicate_local_lo) : "r"(a), "r"(b));
|
| 1070 |
+
|
| 1071 |
+
*pred_hi = (bool)predicate_local_hi;
|
| 1072 |
+
*pred_lo = (bool)predicate_local_lo;
|
| 1073 |
+
return val;
|
| 1074 |
+
#else
|
| 1075 |
+
// Host and older architecture code
|
| 1076 |
+
// Separate our high and low bit:
|
| 1077 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 1078 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 1079 |
+
|
| 1080 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 1081 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 1082 |
+
|
| 1083 |
+
//cast to signed:
|
| 1084 |
+
short aS_lo = __internal_cast_u2s(aU_lo);
|
| 1085 |
+
short aS_hi = __internal_cast_u2s(aU_hi);
|
| 1086 |
+
|
| 1087 |
+
short bS_lo = __internal_cast_u2s(bU_lo);
|
| 1088 |
+
short bS_hi = __internal_cast_u2s(bU_hi);
|
| 1089 |
+
|
| 1090 |
+
// Get answer
|
| 1091 |
+
unsigned int ansU_lo = (unsigned int)min(aS_lo, bS_lo);
|
| 1092 |
+
unsigned int ansU_hi = (unsigned int)min(aS_hi, bS_hi);
|
| 1093 |
+
|
| 1094 |
+
*pred_hi = (aS_hi <= bS_hi);
|
| 1095 |
+
*pred_lo = (aS_lo <= bS_lo);
|
| 1096 |
+
|
| 1097 |
+
// Put answer back together:
|
| 1098 |
+
unsigned int ans = (ansU_lo & 0x0000FFFFU) | (ansU_hi << 16);
|
| 1099 |
+
|
| 1100 |
+
return ans;
|
| 1101 |
+
#endif
|
| 1102 |
+
}
|
| 1103 |
+
|
| 1104 |
+
__DEVICE_HOST_FUNCTIONS_STATIC_DECL__ unsigned int __vibmin_u16x2(const unsigned int a, const unsigned int b, bool* const pred_hi, bool* const pred_lo){
|
| 1105 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 1106 |
+
unsigned int val;
|
| 1107 |
+
unsigned int predicate_local_hi;
|
| 1108 |
+
unsigned int predicate_local_lo;
|
| 1109 |
+
asm ("{.reg .pred pu, pv; \n\t"
|
| 1110 |
+
".reg .u16 rs0, rs1, rs2, rs3; \n\t"
|
| 1111 |
+
"min.u16x2 %0, %3, %4; \n\t"
|
| 1112 |
+
"mov.b32 {rs0, rs1}, %0; \n\t"
|
| 1113 |
+
"mov.b32 {rs2, rs3}, %3; \n\t"
|
| 1114 |
+
"setp.eq.u16 pv, rs0, rs2; \n\t"
|
| 1115 |
+
"setp.eq.u16 pu, rs1, rs3; \n\t"
|
| 1116 |
+
"selp.b32 %1, 1, 0, pu; \n\t"
|
| 1117 |
+
"selp.b32 %2, 1, 0, pv;} \n\t"
|
| 1118 |
+
: "=r"(val), "=r"(predicate_local_hi),"=r"(predicate_local_lo) : "r"(a), "r"(b));
|
| 1119 |
+
|
| 1120 |
+
*pred_hi = (bool)predicate_local_hi;
|
| 1121 |
+
*pred_lo = (bool)predicate_local_lo;
|
| 1122 |
+
return val;
|
| 1123 |
+
#else
|
| 1124 |
+
// Host and older architecture code
|
| 1125 |
+
// Separate our high and low bit:
|
| 1126 |
+
unsigned short aU_lo = (unsigned short)(a & 0xFFFFU);
|
| 1127 |
+
unsigned short aU_hi = (unsigned short)(a >> 16);
|
| 1128 |
+
|
| 1129 |
+
unsigned short bU_lo = (unsigned short)(b & 0xFFFFU);
|
| 1130 |
+
unsigned short bU_hi = (unsigned short)(b >> 16);
|
| 1131 |
+
|
| 1132 |
+
// Get answer
|
| 1133 |
+
unsigned short ansU_lo = (unsigned short)min(aU_lo, bU_lo);
|
| 1134 |
+
unsigned short ansU_hi = (unsigned short)min(aU_hi, bU_hi);
|
| 1135 |
+
|
| 1136 |
+
*pred_hi = (aU_hi <= bU_hi);
|
| 1137 |
+
*pred_lo = (aU_lo <= bU_lo);
|
| 1138 |
+
|
| 1139 |
+
// Put answer back together:
|
| 1140 |
+
unsigned int ans = ((unsigned int) ansU_lo) | (((unsigned int) ansU_hi) << 16);
|
| 1141 |
+
|
| 1142 |
+
return ans;
|
| 1143 |
+
#endif
|
| 1144 |
+
}
|
| 1145 |
+
|
| 1146 |
+
#ifdef __CUDA_AND_AT_LEAST_SM_90__
|
| 1147 |
+
#undef __CUDA_AND_AT_LEAST_SM_90__
|
| 1148 |
+
#endif
|
| 1149 |
+
|
| 1150 |
+
#undef __DEVICE_HOST_FUNCTIONS_STATIC_DECL__
|
| 1151 |
+
|
| 1152 |
+
/*******************************************************************************
|
| 1153 |
+
* *
|
| 1154 |
+
* *
|
| 1155 |
+
* *
|
| 1156 |
+
*******************************************************************************/
|
| 1157 |
+
|
| 1158 |
+
#endif /* !__DEVICE_FUNCTIONS_HPP__ */
|
| 1159 |
+
|
| 1160 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_FUNCTIONS_HPP__)
|
| 1161 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 1162 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_DEVICE_FUNCTIONS_HPP__
|
| 1163 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/func_macro.h
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* NVIDIA_COPYRIGHT_BEGIN
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
* NVIDIA CORPORATION and its licensors retain all intellectual property
|
| 7 |
+
* and proprietary rights in and to this software, related documentation
|
| 8 |
+
* and any modifications thereto. Any use, reproduction, disclosure or
|
| 9 |
+
* distribution of this software and related documentation without an express
|
| 10 |
+
* license agreement from NVIDIA CORPORATION is strictly prohibited.
|
| 11 |
+
*
|
| 12 |
+
* NVIDIA_COPYRIGHT_END
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 16 |
+
#if defined(_MSC_VER)
|
| 17 |
+
#pragma message("crt/func_macro.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 18 |
+
#else
|
| 19 |
+
#warning "crt/func_macro.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 20 |
+
#endif
|
| 21 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 22 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_FUNC_MACRO_H__
|
| 23 |
+
#endif
|
| 24 |
+
|
| 25 |
+
#if !defined(__FUNC_MACRO_H__)
|
| 26 |
+
#define __FUNC_MACRO_H__
|
| 27 |
+
|
| 28 |
+
#if !defined(__CUDA_INTERNAL_COMPILATION__)
|
| 29 |
+
|
| 30 |
+
#error -- incorrect inclusion of a cudart header file
|
| 31 |
+
|
| 32 |
+
#endif /* !__CUDA_INTERNAL_COMPILATION__ */
|
| 33 |
+
|
| 34 |
+
#if defined(__GNUC__)
|
| 35 |
+
|
| 36 |
+
#define __func__(decl) \
|
| 37 |
+
inline decl
|
| 38 |
+
|
| 39 |
+
#define __device_func__(decl) \
|
| 40 |
+
static __attribute__((__unused__)) decl
|
| 41 |
+
|
| 42 |
+
#elif defined(_WIN32)
|
| 43 |
+
|
| 44 |
+
#define __func__(decl) \
|
| 45 |
+
static inline decl
|
| 46 |
+
|
| 47 |
+
#define __device_func__(decl) \
|
| 48 |
+
static decl
|
| 49 |
+
|
| 50 |
+
#endif /* __GNUC__ */
|
| 51 |
+
|
| 52 |
+
#endif /* __FUNC_MACRO_H__ */
|
| 53 |
+
|
| 54 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_FUNC_MACRO_H__)
|
| 55 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 56 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_FUNC_MACRO_H__
|
| 57 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/host_config.h
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2024 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/host_config.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/host_config.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_CONFIG_H__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__HOST_CONFIG_H__)
|
| 61 |
+
#define __HOST_CONFIG_H__
|
| 62 |
+
|
| 63 |
+
/*******************************************************************************
|
| 64 |
+
* *
|
| 65 |
+
* *
|
| 66 |
+
* *
|
| 67 |
+
*******************************************************************************/
|
| 68 |
+
|
| 69 |
+
#if defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if defined(__CUDACC_RTC__)
|
| 72 |
+
|
| 73 |
+
#define _CRTIMP
|
| 74 |
+
#define __THROW
|
| 75 |
+
|
| 76 |
+
#else /* __CUDACC_RTC__ */
|
| 77 |
+
|
| 78 |
+
/* check for host compilers that are compatible with nvcc */
|
| 79 |
+
#if !defined(__GNUC__) && !defined(_WIN32)
|
| 80 |
+
|
| 81 |
+
#error --- !!! UNSUPPORTED COMPILER !!! ---
|
| 82 |
+
|
| 83 |
+
#endif /* !__GNUC__ && !_WIN32 */
|
| 84 |
+
|
| 85 |
+
/* check invalid configurations */
|
| 86 |
+
#if defined(__PGIC__)
|
| 87 |
+
#if !defined(__GNUC__) || !defined(__LP64__) || !defined(__linux__)
|
| 88 |
+
#error -- unsupported pgc++ configuration! pgc++ is supported only on Linux x86_64!
|
| 89 |
+
#endif /* !defined(__GNUC__) || !defined(__LP64__) || !defined(__linux__) */
|
| 90 |
+
#endif /* defined(__PGIC__) */
|
| 91 |
+
|
| 92 |
+
#if defined(__powerpc__)
|
| 93 |
+
#if !defined(__powerpc64__) || !defined(__LITTLE_ENDIAN__)
|
| 94 |
+
#error -- unsupported PPC platform! Only 64-bit little endian PPC is supported!
|
| 95 |
+
#endif /* !__powerpc64__ || !__LITTLE_ENDIAN__ */
|
| 96 |
+
#endif /* __powerpc__ */
|
| 97 |
+
|
| 98 |
+
#if defined(__APPLE__) && defined(__MACH__) && !defined(__clang__)
|
| 99 |
+
#error -- clang and clang++ are the only supported host compilers on Mac OS X!
|
| 100 |
+
#endif /* __APPLE__ && __MACH__ && !__clang__ */
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
/* check host compiler version */
|
| 104 |
+
#if !__NV_NO_HOST_COMPILER_CHECK
|
| 105 |
+
|
| 106 |
+
#if defined(__ICC)
|
| 107 |
+
|
| 108 |
+
#if (__ICC != 1500 && __ICC != 1600 && __ICC != 1700 && __ICC != 1800 && !(__ICC >= 1900 && __ICC <= 2021)) || !defined(__GNUC__) || !defined(__LP64__)
|
| 109 |
+
|
| 110 |
+
#error -- unsupported ICC configuration! Only ICC 15.0, ICC 16.0, ICC 17.0, ICC 18.0, ICC 19.x and 20.x on Linux x86_64 are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 111 |
+
|
| 112 |
+
#endif /* (__ICC != 1500 && __ICC != 1600 && __ICC != 1700 && __ICC != 1800 && __ICC != 1900) || !__GNUC__ || !__LP64__ */
|
| 113 |
+
|
| 114 |
+
#endif /* __ICC */
|
| 115 |
+
|
| 116 |
+
#if defined(__GRCO_CLANG_COMPILER__)
|
| 117 |
+
#if (__GRCO_CLANG_COMPILER__ == 1) && ((__clang_major__ < 16) || (__clang_major__ > 19))
|
| 118 |
+
#error -- unsupported Grace clang version! The version must be 16.x to 19.x. The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 119 |
+
#endif /* (__GRCO_CLANG_COMPILER__ == 1) && ((__clang_major__ < 16) || (__clang_major__ > 19)) */
|
| 120 |
+
|
| 121 |
+
#endif /* __GRCO_CLANG_COMPILER__ */
|
| 122 |
+
|
| 123 |
+
#if defined(__INTEL_CLANG_COMPILER)
|
| 124 |
+
#error -- unsupported Intel ICX compiler! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 125 |
+
#endif /* __INTEL_CLANG_COMPILER */
|
| 126 |
+
|
| 127 |
+
#if defined(__powerpc__)
|
| 128 |
+
|
| 129 |
+
#if defined(__ibmxl_vrm__) && !(__ibmxl_vrm__ >= 0x0d010000 && __ibmxl_vrm__ < 0x0d020000) && \
|
| 130 |
+
!(__ibmxl_vrm__ >= 0x10010000 && __ibmxl_vrm__ < 0x10020000)
|
| 131 |
+
|
| 132 |
+
#error -- unsupported xlC version! only xlC 13.1 and 16.1 are supported. The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 133 |
+
|
| 134 |
+
#endif /* __ibmxl_vrm__ && !(__ibmxl_vrm__ >= 0x0d010000 && __ibmxl_vrm__ < 0x0d020000) &&
|
| 135 |
+
!(__ibmxl_vrm__ >= 0x10010000 && __ibmxl_vrm__ < 0x10020000) */
|
| 136 |
+
|
| 137 |
+
#endif /* __powerpc__ */
|
| 138 |
+
|
| 139 |
+
#if defined(__GNUC__)
|
| 140 |
+
|
| 141 |
+
#if __GNUC__ > 14
|
| 142 |
+
|
| 143 |
+
#error -- unsupported GNU version! gcc versions later than 14 are not supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 144 |
+
|
| 145 |
+
#endif /* __GNUC__ > 14 */
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
#if defined(__HORIZON__)
|
| 149 |
+
#if (__clang_major__ >= 20) || (__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3))
|
| 150 |
+
#error -- unsupported HOS clang version! The version must be must be less than 20 and greater than 3.2 . The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 151 |
+
#endif /* (__clang_major__ >= 20) || (__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3)) */
|
| 152 |
+
#endif /* __HORIZON__ */
|
| 153 |
+
|
| 154 |
+
#if defined(__clang__) && !defined(__ibmxl_vrm__) && !defined(__ICC) && !defined(__HORIZON__) && !defined(__APPLE__) && !defined(__GRCO_CLANG_COMPILER__)
|
| 155 |
+
|
| 156 |
+
#if (__clang_major__ >= 20) || (__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3))
|
| 157 |
+
#error -- unsupported clang version! clang version must be less than 20 and greater than 3.2 . The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 158 |
+
|
| 159 |
+
#endif /* (__clang_major__ >= 20) || (__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3)) */
|
| 160 |
+
|
| 161 |
+
#endif /* defined(__clang__) && !defined(__ibmxl_vrm__) && !defined(__ICC) && !defined(__HORIZON__) && !defined(__APPLE__) && !defined(__GRCO_CLANG_COMPILER__) */
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
#endif /* __GNUC__ */
|
| 165 |
+
|
| 166 |
+
#if defined(_WIN32)
|
| 167 |
+
|
| 168 |
+
#if _MSC_VER < 1910 || _MSC_VER >= 1950
|
| 169 |
+
|
| 170 |
+
#error -- unsupported Microsoft Visual Studio version! Only the versions between 2017 and 2022 (inclusive) are supported! The nvcc flag '-allow-unsupported-compiler' can be used to override this version check; however, using an unsupported host compiler may cause compilation failure or incorrect run time execution. Use at your own risk.
|
| 171 |
+
|
| 172 |
+
#elif _MSC_VER >= 1910 && _MSC_VER < 1910
|
| 173 |
+
|
| 174 |
+
#pragma message("support for this version of Microsoft Visual Studio has been deprecated! Only the versions between 2017 and 2022 (inclusive) are supported!")
|
| 175 |
+
|
| 176 |
+
#endif /* (_MSC_VER < 1910 || _MSC_VER >= 1950) || (_MSC_VER >= 1910 && _MSC_VER < 1910) */
|
| 177 |
+
|
| 178 |
+
#endif /* _WIN32 */
|
| 179 |
+
#endif /* !__NV_NO_HOST_COMPILER_CHECK */
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
/* configure host compiler */
|
| 183 |
+
#if defined(__APPLE__)
|
| 184 |
+
|
| 185 |
+
#define _CRTIMP
|
| 186 |
+
#define _ACRTIMP
|
| 187 |
+
#define __THROW
|
| 188 |
+
|
| 189 |
+
#if defined(__BLOCKS__) /* nvcc does not support closures */
|
| 190 |
+
|
| 191 |
+
#undef __BLOCKS__
|
| 192 |
+
|
| 193 |
+
#endif /* __BLOCKS__ */
|
| 194 |
+
|
| 195 |
+
#elif defined(__ANDROID__)
|
| 196 |
+
|
| 197 |
+
#define _CRTIMP
|
| 198 |
+
#define _ACRTIMP
|
| 199 |
+
#define __THROW
|
| 200 |
+
|
| 201 |
+
#elif defined(__QNX__)
|
| 202 |
+
|
| 203 |
+
#define _CRTIMP
|
| 204 |
+
#define _ACRTIMP
|
| 205 |
+
#define __THROW
|
| 206 |
+
|
| 207 |
+
#elif defined(__HORIZON__)
|
| 208 |
+
|
| 209 |
+
#define _CRTIMP
|
| 210 |
+
#define _ACRTIMP
|
| 211 |
+
#define __THROW
|
| 212 |
+
|
| 213 |
+
#elif defined(__GNUC__)
|
| 214 |
+
|
| 215 |
+
#define _CRTIMP
|
| 216 |
+
#define _ACRTIMP
|
| 217 |
+
|
| 218 |
+
#include <features.h> /* for __THROW */
|
| 219 |
+
|
| 220 |
+
#elif defined(_WIN32)
|
| 221 |
+
|
| 222 |
+
#if _MSC_VER >= 1500
|
| 223 |
+
|
| 224 |
+
#undef _USE_DECLSPECS_FOR_SAL
|
| 225 |
+
#define _USE_DECLSPECS_FOR_SAL \
|
| 226 |
+
1
|
| 227 |
+
|
| 228 |
+
#endif /* _MSC_VER >= 1500 */
|
| 229 |
+
|
| 230 |
+
#if !defined(_CRT_NONSTDC_NO_WARNINGS)
|
| 231 |
+
|
| 232 |
+
#define _CRT_NONSTDC_NO_WARNINGS /* to suppress warnings */
|
| 233 |
+
|
| 234 |
+
#endif /* !_CRT_NONSTDC_NO_WARNINGS */
|
| 235 |
+
|
| 236 |
+
#if !defined(_CRT_SECURE_NO_WARNINGS)
|
| 237 |
+
|
| 238 |
+
#define _CRT_SECURE_NO_WARNINGS /* to suppress warnings */
|
| 239 |
+
|
| 240 |
+
#endif /* !_CRT_SECURE_NO_WARNINGS */
|
| 241 |
+
|
| 242 |
+
#if !defined(NOMINMAX)
|
| 243 |
+
|
| 244 |
+
#define NOMINMAX /* min and max are part of cuda runtime */
|
| 245 |
+
|
| 246 |
+
#endif /* !NOMINMAX */
|
| 247 |
+
|
| 248 |
+
#include <crtdefs.h> /* for _CRTIMP */
|
| 249 |
+
#if _MSC_VER >= 1900
|
| 250 |
+
#include <corecrt.h> /* for _ACRTIMP */
|
| 251 |
+
#endif /* _MSC_VER >= 1900 */
|
| 252 |
+
|
| 253 |
+
#define __THROW
|
| 254 |
+
|
| 255 |
+
#endif /* __APPLE__ */
|
| 256 |
+
|
| 257 |
+
#endif /* __CUDACC_RTC__ */
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
#if defined(__cplusplus) && defined(__CUDA_ARCH__) && (defined(__PGIC__) || defined(__CUDACC_RTC__) || (defined(_WIN32) && defined(_MSC_VER)))
|
| 261 |
+
|
| 262 |
+
#if __CUDACC_RTC__
|
| 263 |
+
typedef char *va_list;
|
| 264 |
+
#else /* !__CUDACC_RTC__ */
|
| 265 |
+
#include <cstdarg>
|
| 266 |
+
#endif /* __CUDACC_RTC__ */
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
#undef va_start
|
| 270 |
+
#undef va_end
|
| 271 |
+
#undef va_arg
|
| 272 |
+
|
| 273 |
+
#ifdef __PGIC__
|
| 274 |
+
|
| 275 |
+
#undef __builtin_va_end
|
| 276 |
+
|
| 277 |
+
#define va_start(v,l) __builtin_alt_va_start(v,l)
|
| 278 |
+
#define va_end(v) __builtin_va_end(v)
|
| 279 |
+
#define va_arg(v,l) __builtin_alt_va_arg(v,l)
|
| 280 |
+
|
| 281 |
+
#if (__cplusplus >= 201103L)
|
| 282 |
+
#undef va_copy
|
| 283 |
+
#define va_copy(d,s) __builtin_va_copy(d,s)
|
| 284 |
+
#endif
|
| 285 |
+
|
| 286 |
+
#else /* !__PGIC__ */
|
| 287 |
+
|
| 288 |
+
|
| 289 |
+
#define va_start(ap, x) (__cu_va_start(&ap, x))
|
| 290 |
+
#define va_end(ap) (__cu_va_end(&ap))
|
| 291 |
+
#define va_arg(ap, t) (*((t *)__cu_va_arg(&ap, (t *)0)))
|
| 292 |
+
|
| 293 |
+
#if (_MSC_VER >= 1800) || (defined(__CUDACC_RTC__) && (__cplusplus >= 201103L))
|
| 294 |
+
#undef va_copy
|
| 295 |
+
#define va_copy(apd, aps) (__cu_va_copy(&(apd), &(aps)))
|
| 296 |
+
#endif /* (_MSC_VER >= 1800) || (defined(__CUDACC_RTC__) && (__cplusplus >= 201103L)) */
|
| 297 |
+
#endif /* __PGIC__ */
|
| 298 |
+
|
| 299 |
+
#endif /* defined(__cplusplus) && (defined(__CUDACC_RTC__) || (defined(_WIN32) && defined(_MSC_VER))) */
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
#endif /* __CUDACC__ */
|
| 304 |
+
|
| 305 |
+
#endif /* !__HOST_CONFIG_H__ */
|
| 306 |
+
|
| 307 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_CONFIG_H__)
|
| 308 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 309 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_CONFIG_H__
|
| 310 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/host_defines.h
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 1993-2023 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/host_defines.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/host_defines.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__HOST_DEFINES_H__)
|
| 61 |
+
#define __HOST_DEFINES_H__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC__) && !defined(__CUDACC_RTC__) && !defined(__CUDADEVRT_INTERNAL__) && !defined(_ALLOW_UNSUPPORTED_LIBCPP)
|
| 64 |
+
#include <ctype.h>
|
| 65 |
+
#if ((defined(_MSC_VER ) && (defined(_M_X64) || defined(_M_AMD64))) ||\
|
| 66 |
+
(defined(__x86_64__) || defined(__amd64__))) && defined(_LIBCPP_VERSION) && !(defined(__HORIZON__) || defined(__ANDROID__) || defined(__QNX__))
|
| 67 |
+
#error "libc++ is not supported on x86 system"
|
| 68 |
+
#endif
|
| 69 |
+
#endif
|
| 70 |
+
|
| 71 |
+
/* CUDA JIT mode (__CUDACC_RTC__) also uses GNU style attributes */
|
| 72 |
+
#if defined(__GNUC__) || (defined(__PGIC__) && defined(__linux__)) || defined(__CUDA_LIBDEVICE__) || defined(__CUDACC_RTC__)
|
| 73 |
+
|
| 74 |
+
#if defined(__CUDACC_RTC__)
|
| 75 |
+
#define __volatile__ volatile
|
| 76 |
+
#endif /* __CUDACC_RTC__ */
|
| 77 |
+
|
| 78 |
+
#define __no_return__ \
|
| 79 |
+
__attribute__((noreturn))
|
| 80 |
+
|
| 81 |
+
#if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
|
| 82 |
+
/* gcc allows users to define attributes with underscores,
|
| 83 |
+
e.g., __attribute__((__noinline__)).
|
| 84 |
+
Consider a non-CUDA source file (e.g. .cpp) that has the
|
| 85 |
+
above attribute specification, and includes this header file. In that case,
|
| 86 |
+
defining __noinline__ as below would cause a gcc compilation error.
|
| 87 |
+
Hence, only define __noinline__ when the code is being processed
|
| 88 |
+
by a CUDA compiler component.
|
| 89 |
+
*/
|
| 90 |
+
#define __noinline__ \
|
| 91 |
+
__attribute__((noinline))
|
| 92 |
+
#endif /* __CUDACC__ || __CUDA_ARCH__ || __CUDA_LIBDEVICE__ */
|
| 93 |
+
|
| 94 |
+
#undef __forceinline__
|
| 95 |
+
#define __forceinline__ \
|
| 96 |
+
__inline__ __attribute__((always_inline))
|
| 97 |
+
#define __inline_hint__ \
|
| 98 |
+
__attribute__((nv_inline_hint))
|
| 99 |
+
#define __align__(n) \
|
| 100 |
+
__attribute__((aligned(n)))
|
| 101 |
+
#define __maxnreg__(a) \
|
| 102 |
+
__attribute__((maxnreg(a)))
|
| 103 |
+
#define __thread__ \
|
| 104 |
+
__thread
|
| 105 |
+
#define __import__
|
| 106 |
+
#define __export__
|
| 107 |
+
#define __cdecl
|
| 108 |
+
#define __annotate__(a) \
|
| 109 |
+
__attribute__((a))
|
| 110 |
+
#define __location__(a) \
|
| 111 |
+
__annotate__(a)
|
| 112 |
+
#define CUDARTAPI
|
| 113 |
+
#define CUDARTAPI_CDECL
|
| 114 |
+
|
| 115 |
+
#elif defined(_MSC_VER)
|
| 116 |
+
|
| 117 |
+
#if _MSC_VER >= 1400
|
| 118 |
+
|
| 119 |
+
#define __restrict__ \
|
| 120 |
+
__restrict
|
| 121 |
+
|
| 122 |
+
#else /* _MSC_VER >= 1400 */
|
| 123 |
+
|
| 124 |
+
#define __restrict__
|
| 125 |
+
|
| 126 |
+
#endif /* _MSC_VER >= 1400 */
|
| 127 |
+
|
| 128 |
+
#define __inline__ \
|
| 129 |
+
__inline
|
| 130 |
+
#define __no_return__ \
|
| 131 |
+
__declspec(noreturn)
|
| 132 |
+
#define __noinline__ \
|
| 133 |
+
__declspec(noinline)
|
| 134 |
+
#define __forceinline__ \
|
| 135 |
+
__forceinline
|
| 136 |
+
#define __inline_hint__ \
|
| 137 |
+
__declspec(nv_inline_hint)
|
| 138 |
+
#define __align__(n) \
|
| 139 |
+
__declspec(align(n))
|
| 140 |
+
#define __maxnreg__(n) \
|
| 141 |
+
__declspec(maxnreg(n))
|
| 142 |
+
#define __thread__ \
|
| 143 |
+
__declspec(thread)
|
| 144 |
+
#define __import__ \
|
| 145 |
+
__declspec(dllimport)
|
| 146 |
+
#define __export__ \
|
| 147 |
+
__declspec(dllexport)
|
| 148 |
+
#define __annotate__(a) \
|
| 149 |
+
__declspec(a)
|
| 150 |
+
#define __location__(a) \
|
| 151 |
+
__annotate__(__##a##__)
|
| 152 |
+
#define CUDARTAPI \
|
| 153 |
+
__stdcall
|
| 154 |
+
#define CUDARTAPI_CDECL \
|
| 155 |
+
__cdecl
|
| 156 |
+
|
| 157 |
+
#else /* __GNUC__ || __CUDA_LIBDEVICE__ || __CUDACC_RTC__ */
|
| 158 |
+
|
| 159 |
+
#define __inline__
|
| 160 |
+
|
| 161 |
+
#if !defined(__align__)
|
| 162 |
+
|
| 163 |
+
#error --- !!! UNKNOWN COMPILER: please provide a CUDA compatible definition for '__align__' !!! ---
|
| 164 |
+
|
| 165 |
+
#endif /* !__align__ */
|
| 166 |
+
|
| 167 |
+
#if !defined(CUDARTAPI)
|
| 168 |
+
|
| 169 |
+
#error --- !!! UNKNOWN COMPILER: please provide a CUDA compatible definition for 'CUDARTAPI' !!! ---
|
| 170 |
+
|
| 171 |
+
#endif /* !CUDARTAPI */
|
| 172 |
+
|
| 173 |
+
#endif /* __GNUC__ || __CUDA_LIBDEVICE__ || __CUDACC_RTC__ */
|
| 174 |
+
|
| 175 |
+
#if (defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3 && !defined(__clang__)))) || \
|
| 176 |
+
(defined(_MSC_VER) && _MSC_VER < 1900) || \
|
| 177 |
+
(!defined(__GNUC__) && !defined(_MSC_VER))
|
| 178 |
+
|
| 179 |
+
#define __specialization_static \
|
| 180 |
+
static
|
| 181 |
+
|
| 182 |
+
#else /* (__GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3 && !__clang__))) ||
|
| 183 |
+
(_MSC_VER && _MSC_VER < 1900) ||
|
| 184 |
+
(!__GNUC__ && !_MSC_VER) */
|
| 185 |
+
|
| 186 |
+
#define __specialization_static
|
| 187 |
+
|
| 188 |
+
#endif /* (__GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3 && !__clang__))) ||
|
| 189 |
+
(_MSC_VER && _MSC_VER < 1900) ||
|
| 190 |
+
(!__GNUC__ && !_MSC_VER) */
|
| 191 |
+
|
| 192 |
+
#if !defined(__CUDACC__) && !defined(__CUDA_LIBDEVICE__)
|
| 193 |
+
|
| 194 |
+
#undef __annotate__
|
| 195 |
+
#define __annotate__(a)
|
| 196 |
+
|
| 197 |
+
#else /* !__CUDACC__ && !__CUDA_LIBDEVICE__ */
|
| 198 |
+
|
| 199 |
+
#define __launch_bounds__(...) \
|
| 200 |
+
__annotate__(launch_bounds(__VA_ARGS__))
|
| 201 |
+
|
| 202 |
+
#endif /* !__CUDACC__ && !__CUDA_LIBDEVICE__ */
|
| 203 |
+
|
| 204 |
+
#if defined(__CUDACC__) || defined(__CUDA_LIBDEVICE__) || \
|
| 205 |
+
defined(__GNUC__) || defined(_WIN64)
|
| 206 |
+
|
| 207 |
+
#define __builtin_align__(a) \
|
| 208 |
+
__align__(a)
|
| 209 |
+
|
| 210 |
+
#else /* __CUDACC__ || __CUDA_LIBDEVICE__ || __GNUC__ || _WIN64 */
|
| 211 |
+
|
| 212 |
+
#define __builtin_align__(a)
|
| 213 |
+
|
| 214 |
+
#endif /* __CUDACC__ || __CUDA_LIBDEVICE__ || __GNUC__ || _WIN64 */
|
| 215 |
+
|
| 216 |
+
#if defined(__CUDACC__) || !defined(__grid_constant__)
|
| 217 |
+
#define __grid_constant__ \
|
| 218 |
+
__location__(grid_constant)
|
| 219 |
+
#endif /* defined(__CUDACC__) || !defined(__grid_constant__) */
|
| 220 |
+
|
| 221 |
+
#if defined(__CUDACC__) || !defined(__host__)
|
| 222 |
+
#define __host__ \
|
| 223 |
+
__location__(host)
|
| 224 |
+
#endif /* defined(__CUDACC__) || !defined(__host__) */
|
| 225 |
+
#if defined(__CUDACC__) || !defined(__device__)
|
| 226 |
+
#define __device__ \
|
| 227 |
+
__location__(device)
|
| 228 |
+
#endif /* defined(__CUDACC__) || !defined(__device__) */
|
| 229 |
+
#if defined(__CUDACC__) || !defined(__global__)
|
| 230 |
+
#define __global__ \
|
| 231 |
+
__location__(global)
|
| 232 |
+
#endif /* defined(__CUDACC__) || !defined(__global__) */
|
| 233 |
+
#if defined(__CUDACC__) || !defined(__shared__)
|
| 234 |
+
#define __shared__ \
|
| 235 |
+
__location__(shared)
|
| 236 |
+
#endif /* defined(__CUDACC__) || !defined(__shared__) */
|
| 237 |
+
#if defined(__CUDACC__) || !defined(__constant__)
|
| 238 |
+
#define __constant__ \
|
| 239 |
+
__location__(constant)
|
| 240 |
+
#endif /* defined(__CUDACC__) || !defined(__constant__) */
|
| 241 |
+
#if defined(__CUDACC__) || !defined(__managed__)
|
| 242 |
+
#define __managed__ \
|
| 243 |
+
__location__(managed)
|
| 244 |
+
#endif /* defined(__CUDACC__) || !defined(__managed__) */
|
| 245 |
+
#if defined(__CUDACC__) || !defined(__nv_pure__)
|
| 246 |
+
#define __nv_pure__ \
|
| 247 |
+
__location__(nv_pure)
|
| 248 |
+
#endif /* defined(__CUDACC__) || !defined(__nv_pure__) */
|
| 249 |
+
#if !defined(__CUDACC__)
|
| 250 |
+
#define __device_builtin__
|
| 251 |
+
#define __device_builtin_texture_type__
|
| 252 |
+
#define __device_builtin_surface_type__
|
| 253 |
+
#define __cudart_builtin__
|
| 254 |
+
#else /* defined(__CUDACC__) */
|
| 255 |
+
#define __device_builtin__ \
|
| 256 |
+
__location__(device_builtin)
|
| 257 |
+
#define __device_builtin_texture_type__ \
|
| 258 |
+
__location__(device_builtin_texture_type)
|
| 259 |
+
#define __device_builtin_surface_type__ \
|
| 260 |
+
__location__(device_builtin_surface_type)
|
| 261 |
+
#define __cudart_builtin__ \
|
| 262 |
+
__location__(cudart_builtin)
|
| 263 |
+
#endif /* !defined(__CUDACC__) */
|
| 264 |
+
|
| 265 |
+
#if defined(__CUDACC__) || !defined(__cluster_dims__)
|
| 266 |
+
#if defined(_MSC_VER)
|
| 267 |
+
#define __cluster_dims__(...) \
|
| 268 |
+
__declspec(__cluster_dims__(__VA_ARGS__))
|
| 269 |
+
|
| 270 |
+
#else /* !defined(_MSC_VER) */
|
| 271 |
+
#define __cluster_dims__(...) \
|
| 272 |
+
__attribute__((cluster_dims(__VA_ARGS__)))
|
| 273 |
+
#endif /* defined(_MSC_VER) */
|
| 274 |
+
#endif /* defined(__CUDACC__) || !defined(__cluster_dims__) */
|
| 275 |
+
|
| 276 |
+
#define __CUDA_ARCH_HAS_FEATURE__(_FEAT) __CUDA_ARCH_FEAT_##_FEAT
|
| 277 |
+
|
| 278 |
+
#endif /* !__HOST_DEFINES_H__ */
|
| 279 |
+
|
| 280 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H__)
|
| 281 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 282 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_DEFINES_H__
|
| 283 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/host_runtime.h
ADDED
|
@@ -0,0 +1,306 @@
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* NVIDIA_COPYRIGHT_BEGIN
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) 2008-2023, NVIDIA CORPORATION. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
* NVIDIA CORPORATION and its licensors retain all intellectual property
|
| 7 |
+
* and proprietary rights in and to this software, related documentation
|
| 8 |
+
* and any modifications thereto. Any use, reproduction, disclosure or
|
| 9 |
+
* distribution of this software and related documentation without an express
|
| 10 |
+
* license agreement from NVIDIA CORPORATION is strictly prohibited.
|
| 11 |
+
*
|
| 12 |
+
* NVIDIA_COPYRIGHT_END
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 16 |
+
#if defined(_MSC_VER)
|
| 17 |
+
#pragma message("crt/device_functions.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 18 |
+
#else
|
| 19 |
+
#warning "crt/device_functions.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 20 |
+
#endif
|
| 21 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 22 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_RUNTIME_H__
|
| 23 |
+
#endif
|
| 24 |
+
|
| 25 |
+
#if !defined(__CUDA_INTERNAL_COMPILATION__)
|
| 26 |
+
|
| 27 |
+
#define __CUDA_INTERNAL_COMPILATION__
|
| 28 |
+
#define __text__
|
| 29 |
+
#define __surf__
|
| 30 |
+
#define __name__shadow_var(c, cpp) \
|
| 31 |
+
#c
|
| 32 |
+
#define __name__text_var(c, cpp) \
|
| 33 |
+
#cpp
|
| 34 |
+
#define __host__shadow_var(c, cpp) \
|
| 35 |
+
cpp
|
| 36 |
+
#define __text_var(c, cpp) \
|
| 37 |
+
cpp
|
| 38 |
+
#define __device_fun(fun) \
|
| 39 |
+
#fun
|
| 40 |
+
#define __device_var(var) \
|
| 41 |
+
#var
|
| 42 |
+
#define __device__text_var(c, cpp) \
|
| 43 |
+
#c
|
| 44 |
+
#define __device__shadow_var(c, cpp) \
|
| 45 |
+
#c
|
| 46 |
+
|
| 47 |
+
#if defined(_WIN32) && !defined(_WIN64)
|
| 48 |
+
|
| 49 |
+
#define __pad__(f) \
|
| 50 |
+
f
|
| 51 |
+
|
| 52 |
+
#else /* _WIN32 && !_WIN64 */
|
| 53 |
+
|
| 54 |
+
#define __pad__(f)
|
| 55 |
+
|
| 56 |
+
#endif /* _WIN32 && !_WIN64 */
|
| 57 |
+
|
| 58 |
+
#include "builtin_types.h"
|
| 59 |
+
#include "storage_class.h"
|
| 60 |
+
|
| 61 |
+
#else /* !__CUDA_INTERNAL_COMPILATION__ */
|
| 62 |
+
|
| 63 |
+
template <typename T>
|
| 64 |
+
static inline T *__cudaAddressOf(T &val)
|
| 65 |
+
{
|
| 66 |
+
return (T *)((void *)(&(const_cast<char &>(reinterpret_cast<const volatile char &>(val)))));
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
#define __cudaRegisterBinary(X) \
|
| 70 |
+
__cudaFatCubinHandle = __cudaRegisterFatBinary((void*)&__fatDeviceText); \
|
| 71 |
+
{ void (*callback_fp)(void **) = (void (*)(void **))(X); (*callback_fp)(__cudaFatCubinHandle); __cudaRegisterFatBinaryEnd(__cudaFatCubinHandle); }\
|
| 72 |
+
atexit(__cudaUnregisterBinaryUtil)
|
| 73 |
+
|
| 74 |
+
#define __cudaRegisterVariable(handle, var, ext, size, constant, global) \
|
| 75 |
+
__cudaRegisterVar(handle, (char*)&__host##var, (char*)__device##var, __name##var, ext, size, constant, global)
|
| 76 |
+
#define __cudaRegisterManagedVariable(handle, var, ext, size, constant, global) \
|
| 77 |
+
__cudaRegisterManagedVar(handle, (void **)&__host##var, (char*)__device##var, __name##var, ext, size, constant, global)
|
| 78 |
+
|
| 79 |
+
#define __cudaRegisterGlobalTexture(handle, tex, dim, norm, ext) \
|
| 80 |
+
__cudaRegisterTexture(handle, (const struct textureReference*)&tex, (const void**)(void*)__device##tex, __name##tex, dim, norm, ext)
|
| 81 |
+
#define __cudaRegisterGlobalSurface(handle, surf, dim, ext) \
|
| 82 |
+
__cudaRegisterSurface(handle, (const struct surfaceReference*)&surf, (const void**)(void*)__device##surf, __name##surf, dim, ext)
|
| 83 |
+
#define __cudaRegisterEntry(handle, funptr, fun, thread_limit) \
|
| 84 |
+
__cudaRegisterFunction(handle, (const char*)funptr, (char*)__device_fun(fun), #fun, -1, (uint3*)0, (uint3*)0, (dim3*)0, (dim3*)0, (int*)0)
|
| 85 |
+
|
| 86 |
+
extern "C" cudaError_t CUDARTAPI __cudaPopCallConfiguration(
|
| 87 |
+
dim3 *gridDim,
|
| 88 |
+
dim3 *blockDim,
|
| 89 |
+
size_t *sharedMem,
|
| 90 |
+
void *stream
|
| 91 |
+
);
|
| 92 |
+
|
| 93 |
+
#define __cudaLaunchPrologue(size) \
|
| 94 |
+
void * __args_arr[size]; \
|
| 95 |
+
int __args_idx = 0
|
| 96 |
+
|
| 97 |
+
#define __cudaSetupArg(arg, offset) \
|
| 98 |
+
__args_arr[__args_idx] = (void *)__cudaAddressOf(arg); ++__args_idx
|
| 99 |
+
|
| 100 |
+
#define __cudaSetupArgSimple(arg, offset) \
|
| 101 |
+
__args_arr[__args_idx] = (void *)(char *)&arg; ++__args_idx
|
| 102 |
+
|
| 103 |
+
#if defined(__GNUC__)
|
| 104 |
+
#define __NV_ATTR_UNUSED_FOR_LAUNCH __attribute__((unused))
|
| 105 |
+
#else /* !__GNUC__ */
|
| 106 |
+
#define __NV_ATTR_UNUSED_FOR_LAUNCH
|
| 107 |
+
#endif /* __GNUC__ */
|
| 108 |
+
|
| 109 |
+
#ifdef __NV_LEGACY_LAUNCH
|
| 110 |
+
/* the use of __args_idx in the expression below avoids host compiler warning about it being an
|
| 111 |
+
unused variable when the launch has no arguments */
|
| 112 |
+
#define __cudaLaunch(fun) \
|
| 113 |
+
{ volatile static char *__f __NV_ATTR_UNUSED_FOR_LAUNCH; __f = fun; \
|
| 114 |
+
dim3 __gridDim, __blockDim;\
|
| 115 |
+
size_t __sharedMem; \
|
| 116 |
+
cudaStream_t __stream; \
|
| 117 |
+
if (__cudaPopCallConfiguration(&__gridDim, &__blockDim, &__sharedMem, &__stream) != cudaSuccess) \
|
| 118 |
+
return; \
|
| 119 |
+
if (__args_idx == 0) {\
|
| 120 |
+
(void)cudaLaunchKernel(fun, __gridDim, __blockDim, &__args_arr[__args_idx], __sharedMem, __stream);\
|
| 121 |
+
} else { \
|
| 122 |
+
(void)cudaLaunchKernel(fun, __gridDim, __blockDim, &__args_arr[0], __sharedMem, __stream);\
|
| 123 |
+
}\
|
| 124 |
+
}
|
| 125 |
+
#else /* !__NV_LEGACY_LAUNCH */
|
| 126 |
+
#define __cudaLaunch(fun) \
|
| 127 |
+
{ volatile static char *__f __NV_ATTR_UNUSED_FOR_LAUNCH; __f = fun; \
|
| 128 |
+
static cudaKernel_t __handle = 0; \
|
| 129 |
+
volatile static bool __tmp __NV_ATTR_UNUSED_FOR_LAUNCH = (__cudaGetKernel(&__handle, (const void *)fun) == cudaSuccess); \
|
| 130 |
+
dim3 __gridDim, __blockDim;\
|
| 131 |
+
size_t __sharedMem; \
|
| 132 |
+
cudaStream_t __stream; \
|
| 133 |
+
if (__cudaPopCallConfiguration(&__gridDim, &__blockDim, &__sharedMem, &__stream) != cudaSuccess) \
|
| 134 |
+
return; \
|
| 135 |
+
if (__args_idx == 0) {\
|
| 136 |
+
(void)__cudaLaunchKernel_helper(__handle, __gridDim, __blockDim, &__args_arr[__args_idx], __sharedMem, __stream);\
|
| 137 |
+
} else { \
|
| 138 |
+
(void)__cudaLaunchKernel_helper(__handle, __gridDim, __blockDim, &__args_arr[0], __sharedMem, __stream);\
|
| 139 |
+
}\
|
| 140 |
+
}
|
| 141 |
+
#endif /* __NV_LEGACY_LAUNCH */
|
| 142 |
+
|
| 143 |
+
#if defined(__GNUC__)
|
| 144 |
+
#define __nv_dummy_param_ref(param) \
|
| 145 |
+
{ volatile static void **__ref __attribute__((unused)); __ref = (volatile void **)param; }
|
| 146 |
+
#else /* __GNUC__ */
|
| 147 |
+
#define __nv_dummy_param_ref(param) \
|
| 148 |
+
{ volatile static void **__ref; __ref = (volatile void **)param; }
|
| 149 |
+
#endif /* __GNUC__ */
|
| 150 |
+
|
| 151 |
+
static void ____nv_dummy_param_ref(void *param) __nv_dummy_param_ref(param)
|
| 152 |
+
|
| 153 |
+
#define __REGISTERFUNCNAME_CORE(X) __cudaRegisterLinkedBinary##X
|
| 154 |
+
#define __REGISTERFUNCNAME(X) __REGISTERFUNCNAME_CORE(X)
|
| 155 |
+
|
| 156 |
+
extern "C" {
|
| 157 |
+
void __REGISTERFUNCNAME( __NV_MODULE_ID ) ( void (*)(void **), void *, void *, void (*)(void *));
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
#define __TO_STRING_CORE(X) #X
|
| 161 |
+
#define __TO_STRING(X) __TO_STRING_CORE(X)
|
| 162 |
+
|
| 163 |
+
extern "C" {
|
| 164 |
+
#if defined(_WIN32)
|
| 165 |
+
#pragma data_seg("__nv_module_id")
|
| 166 |
+
static const __declspec(allocate("__nv_module_id")) unsigned char __module_id_str[] = __TO_STRING(__NV_MODULE_ID);
|
| 167 |
+
#pragma data_seg()
|
| 168 |
+
#elif defined(__APPLE__)
|
| 169 |
+
static const unsigned char __module_id_str[] __attribute__((section ("__NV_CUDA,__nv_module_id"))) = __TO_STRING(__NV_MODULE_ID);
|
| 170 |
+
#else
|
| 171 |
+
static const unsigned char __module_id_str[] __attribute__((section ("__nv_module_id"))) = __TO_STRING(__NV_MODULE_ID);
|
| 172 |
+
#endif
|
| 173 |
+
|
| 174 |
+
#undef __FATIDNAME_CORE
|
| 175 |
+
#undef __FATIDNAME
|
| 176 |
+
#define __FATIDNAME_CORE(X) __fatbinwrap##X
|
| 177 |
+
#define __FATIDNAME(X) __FATIDNAME_CORE(X)
|
| 178 |
+
|
| 179 |
+
#define ____cudaRegisterLinkedBinary(X) \
|
| 180 |
+
{ __REGISTERFUNCNAME(__NV_MODULE_ID) (( void (*)(void **))(X), (void *)&__FATIDNAME(__NV_MODULE_ID), (void *)&__module_id_str, (void (*)(void *))&____nv_dummy_param_ref); }
|
| 181 |
+
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
extern "C" {
|
| 185 |
+
extern void** CUDARTAPI __cudaRegisterFatBinary(
|
| 186 |
+
void *fatCubin
|
| 187 |
+
);
|
| 188 |
+
|
| 189 |
+
extern void CUDARTAPI __cudaRegisterFatBinaryEnd(
|
| 190 |
+
void **fatCubinHandle
|
| 191 |
+
);
|
| 192 |
+
|
| 193 |
+
extern void CUDARTAPI __cudaUnregisterFatBinary(
|
| 194 |
+
void **fatCubinHandle
|
| 195 |
+
);
|
| 196 |
+
|
| 197 |
+
extern void CUDARTAPI __cudaRegisterVar(
|
| 198 |
+
void **fatCubinHandle,
|
| 199 |
+
char *hostVar,
|
| 200 |
+
char *deviceAddress,
|
| 201 |
+
const char *deviceName,
|
| 202 |
+
int ext,
|
| 203 |
+
size_t size,
|
| 204 |
+
int constant,
|
| 205 |
+
int global
|
| 206 |
+
);
|
| 207 |
+
|
| 208 |
+
extern void CUDARTAPI __cudaRegisterManagedVar(
|
| 209 |
+
void **fatCubinHandle,
|
| 210 |
+
void **hostVarPtrAddress,
|
| 211 |
+
char *deviceAddress,
|
| 212 |
+
const char *deviceName,
|
| 213 |
+
int ext,
|
| 214 |
+
size_t size,
|
| 215 |
+
int constant,
|
| 216 |
+
int global
|
| 217 |
+
);
|
| 218 |
+
|
| 219 |
+
extern char CUDARTAPI __cudaInitModule(
|
| 220 |
+
void **fatCubinHandle
|
| 221 |
+
);
|
| 222 |
+
|
| 223 |
+
extern void CUDARTAPI __cudaRegisterTexture(
|
| 224 |
+
void **fatCubinHandle,
|
| 225 |
+
const struct textureReference *hostVar,
|
| 226 |
+
const void **deviceAddress,
|
| 227 |
+
const char *deviceName,
|
| 228 |
+
int dim,
|
| 229 |
+
int norm,
|
| 230 |
+
int ext
|
| 231 |
+
);
|
| 232 |
+
|
| 233 |
+
extern void CUDARTAPI __cudaRegisterSurface(
|
| 234 |
+
void **fatCubinHandle,
|
| 235 |
+
const struct surfaceReference *hostVar,
|
| 236 |
+
const void **deviceAddress,
|
| 237 |
+
const char *deviceName,
|
| 238 |
+
int dim,
|
| 239 |
+
int ext
|
| 240 |
+
);
|
| 241 |
+
|
| 242 |
+
extern void CUDARTAPI __cudaRegisterFunction(
|
| 243 |
+
void **fatCubinHandle,
|
| 244 |
+
const char *hostFun,
|
| 245 |
+
char *deviceFun,
|
| 246 |
+
const char *deviceName,
|
| 247 |
+
int thread_limit,
|
| 248 |
+
uint3 *tid,
|
| 249 |
+
uint3 *bid,
|
| 250 |
+
dim3 *bDim,
|
| 251 |
+
dim3 *gDim,
|
| 252 |
+
int *wSize
|
| 253 |
+
);
|
| 254 |
+
|
| 255 |
+
#if defined(__APPLE__)
|
| 256 |
+
extern "C" int atexit(void (*)(void));
|
| 257 |
+
|
| 258 |
+
#elif defined(__GNUC__) && !defined(__ANDROID__) && !defined(__HORIZON__)
|
| 259 |
+
extern int atexit(void(*)(void)) throw();
|
| 260 |
+
|
| 261 |
+
#elif defined(__HORIZON__)
|
| 262 |
+
|
| 263 |
+
// __TEMP_WAR__ 200132570 HOS : Disable atexit call until it works
|
| 264 |
+
#define atexit(p)
|
| 265 |
+
|
| 266 |
+
#else /* __GNUC__ && !__ANDROID__ */
|
| 267 |
+
extern int __cdecl atexit(void(__cdecl *)(void));
|
| 268 |
+
#endif
|
| 269 |
+
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
static void **__cudaFatCubinHandle;
|
| 273 |
+
|
| 274 |
+
static void __cdecl __cudaUnregisterBinaryUtil(void)
|
| 275 |
+
{
|
| 276 |
+
____nv_dummy_param_ref((void *)&__cudaFatCubinHandle);
|
| 277 |
+
__cudaUnregisterFatBinary(__cudaFatCubinHandle);
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
static char __nv_init_managed_rt_with_module(void **handle)
|
| 281 |
+
{
|
| 282 |
+
return __cudaInitModule(handle);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
#include "common_functions.h"
|
| 286 |
+
|
| 287 |
+
#pragma pack()
|
| 288 |
+
|
| 289 |
+
#if defined(_WIN32)
|
| 290 |
+
|
| 291 |
+
#pragma warning(disable: 4099)
|
| 292 |
+
|
| 293 |
+
#if !defined(_WIN64)
|
| 294 |
+
|
| 295 |
+
#pragma warning(disable: 4408)
|
| 296 |
+
|
| 297 |
+
#endif /* !_WIN64 */
|
| 298 |
+
|
| 299 |
+
#endif /* _WIN32 */
|
| 300 |
+
|
| 301 |
+
#endif /* !__CUDA_INTERNAL_COMPILATION__ */
|
| 302 |
+
|
| 303 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_RUNTIME_H__)
|
| 304 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 305 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_HOST_RUNTIME_H__
|
| 306 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/math_functions.h
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/math_functions.hpp
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/mma.h
ADDED
|
@@ -0,0 +1,761 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2017-2024 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/mma.h is an internal header file and must not be used directly. Please use mma.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/mma.h is an internal header file and must not be used directly. Please use mma.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_MMA_H__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__CUDA_MMA_H__)
|
| 61 |
+
#define __CUDA_MMA_H__
|
| 62 |
+
|
| 63 |
+
#include <cuda_fp16.h>
|
| 64 |
+
#include <cuda_bf16.h>
|
| 65 |
+
|
| 66 |
+
#define __CUDA_MMA_DEVICE_DECL__ static __device__ __inline__
|
| 67 |
+
|
| 68 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 69 |
+
|
| 70 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 74 |
+
#define __DEF_IF_HOST { }
|
| 75 |
+
#else /* !__CUDA_ARCH__ && !_NVHPC_CUDA */
|
| 76 |
+
#define __DEF_IF_HOST ;
|
| 77 |
+
#endif /* __CUDA_ARCH__ || _NVHPC_CUDA */
|
| 78 |
+
|
| 79 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 720
|
| 80 |
+
#define __CUDA_IMMA__ 1
|
| 81 |
+
#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 720 */
|
| 82 |
+
|
| 83 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 730
|
| 84 |
+
#define __CUDA_SUBBYTE_IMMA__ 1
|
| 85 |
+
#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 730 */
|
| 86 |
+
|
| 87 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
|
| 88 |
+
#define __CUDA_AMPERE_MMA__ 1
|
| 89 |
+
#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800 */
|
| 90 |
+
|
| 91 |
+
namespace nvcuda {
|
| 92 |
+
namespace wmma {
|
| 93 |
+
|
| 94 |
+
// utility functions
|
| 95 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 96 |
+
inline __device__ float __float_to_tf32(float in)
|
| 97 |
+
{
|
| 98 |
+
float ret;
|
| 99 |
+
asm("{\n .reg .b32 __$1;"
|
| 100 |
+
"\n cvt.rna.tf32.f32 __$1, %1;"
|
| 101 |
+
"\n mov.b32 %0, __$1;\n}\n" : "=f"(ret) : "f"(in) );
|
| 102 |
+
return ret;
|
| 103 |
+
}
|
| 104 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 105 |
+
|
| 106 |
+
//
|
| 107 |
+
// tags
|
| 108 |
+
//
|
| 109 |
+
struct row_major;
|
| 110 |
+
struct col_major;
|
| 111 |
+
struct matrix_a;
|
| 112 |
+
struct matrix_b;
|
| 113 |
+
struct accumulator;
|
| 114 |
+
|
| 115 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 116 |
+
namespace precision {
|
| 117 |
+
struct tf32;
|
| 118 |
+
}
|
| 119 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 120 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 121 |
+
namespace experimental {
|
| 122 |
+
namespace precision {
|
| 123 |
+
struct u4; // 4-bit unsigned
|
| 124 |
+
struct s4; // 4-bit signed
|
| 125 |
+
struct b1; // 1-bit
|
| 126 |
+
}
|
| 127 |
+
enum bmmaBitOp { bmmaBitOpXOR = 1
|
| 128 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 129 |
+
, bmmaBitOpAND = 2
|
| 130 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 131 |
+
};
|
| 132 |
+
enum bmmaAccumulateOp { bmmaAccumulateOpPOPC = 1 };
|
| 133 |
+
}
|
| 134 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 135 |
+
|
| 136 |
+
//
|
| 137 |
+
// layout
|
| 138 |
+
//
|
| 139 |
+
enum layout_t {
|
| 140 |
+
mem_row_major, mem_col_major
|
| 141 |
+
};
|
| 142 |
+
|
| 143 |
+
template <typename T>
|
| 144 |
+
struct helper_traits {
|
| 145 |
+
typedef T element_type;
|
| 146 |
+
typedef T storage_element_type;
|
| 147 |
+
typedef T fill_argument_type;
|
| 148 |
+
};
|
| 149 |
+
|
| 150 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 151 |
+
template<> struct helper_traits<experimental::precision::u4> {
|
| 152 |
+
typedef experimental::precision::u4 element_type;
|
| 153 |
+
typedef unsigned int storage_element_type;
|
| 154 |
+
typedef unsigned int fill_argument_type;
|
| 155 |
+
};
|
| 156 |
+
|
| 157 |
+
template<> struct helper_traits<experimental::precision::s4> {
|
| 158 |
+
typedef experimental::precision::s4 element_type;
|
| 159 |
+
typedef int storage_element_type;
|
| 160 |
+
typedef int fill_argument_type;
|
| 161 |
+
};
|
| 162 |
+
|
| 163 |
+
template<> struct helper_traits<experimental::precision::b1> {
|
| 164 |
+
typedef experimental::precision::b1 element_type;
|
| 165 |
+
typedef unsigned int storage_element_type;
|
| 166 |
+
typedef unsigned int fill_argument_type;
|
| 167 |
+
};
|
| 168 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 169 |
+
|
| 170 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 171 |
+
template<> struct helper_traits<precision::tf32> {
|
| 172 |
+
typedef precision::tf32 element_type;
|
| 173 |
+
typedef float storage_element_type;
|
| 174 |
+
typedef float fill_argument_type;
|
| 175 |
+
};
|
| 176 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 177 |
+
|
| 178 |
+
#if defined(_MSC_VER)
|
| 179 |
+
#pragma warning(push)
|
| 180 |
+
#pragma warning(disable:4324)
|
| 181 |
+
#endif
|
| 182 |
+
//
|
| 183 |
+
// The base fragment type
|
| 184 |
+
//
|
| 185 |
+
/* note: alignment required for compiler implementation */
|
| 186 |
+
template <typename T, int size, int packed_size = size>
|
| 187 |
+
struct __align__(8) __frag_base {
|
| 188 |
+
|
| 189 |
+
/* Number of elements in the fragment */
|
| 190 |
+
enum {num_elements = size};
|
| 191 |
+
|
| 192 |
+
/* Number of storage elements in the fragment.
|
| 193 |
+
|
| 194 |
+
The elements of the fragment are packed together when the
|
| 195 |
+
fragment element type is experimental::precision::u4,
|
| 196 |
+
experimental::precision::s4 or experimental::precision::b1.
|
| 197 |
+
When elements are packed, num_storage_elements
|
| 198 |
+
will be smaller than num_elements.
|
| 199 |
+
*/
|
| 200 |
+
enum {num_storage_elements = packed_size};
|
| 201 |
+
|
| 202 |
+
/* element type of the fragment */
|
| 203 |
+
typedef T element_type;
|
| 204 |
+
|
| 205 |
+
/* element type of the storage representation.
|
| 206 |
+
|
| 207 |
+
The mapping from element_type to storage_element_type is as follows:
|
| 208 |
+
experimental::precision::u4 -> unsigned (8 elements in 1 storage element)
|
| 209 |
+
experimental::precision::s4 -> int (8 elements in 1 storage element)
|
| 210 |
+
experimental::precision::b1 -> unsigned (32 elements in 1 storage element)
|
| 211 |
+
precision::tf32 -> float (1 element in 1 storage element)
|
| 212 |
+
all other types T -> T
|
| 213 |
+
*/
|
| 214 |
+
typedef typename helper_traits<T>::storage_element_type storage_element_type;
|
| 215 |
+
|
| 216 |
+
/* Storage for the (possibly packed) fragment elements. */
|
| 217 |
+
storage_element_type x[num_storage_elements];
|
| 218 |
+
};
|
| 219 |
+
#if defined(_MSC_VER)
|
| 220 |
+
#pragma warning(pop)
|
| 221 |
+
#endif
|
| 222 |
+
|
| 223 |
+
template <typename FragEleType, typename StorageType, typename ArgType>
|
| 224 |
+
static inline __device__ StorageType __get_storage_value(ArgType in) { return in; }
|
| 225 |
+
|
| 226 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 227 |
+
template<>
|
| 228 |
+
__device__ inline unsigned
|
| 229 |
+
__get_storage_value<experimental::precision::u4, unsigned, unsigned>(unsigned in)
|
| 230 |
+
{
|
| 231 |
+
/* For experimental::precision::u4 fragment element type, pack 8 elements into a single
|
| 232 |
+
32-bit unsigned int storage element */
|
| 233 |
+
unsigned val = in & 0xf;
|
| 234 |
+
return (val | (val << 4) | (val << 8) | (val << 12) | (val << 16) |
|
| 235 |
+
(val << 20) | (val << 24) | (val << 28));
|
| 236 |
+
};
|
| 237 |
+
|
| 238 |
+
template<>
|
| 239 |
+
__device__ inline int
|
| 240 |
+
__get_storage_value<experimental::precision::s4, int, int>(int in)
|
| 241 |
+
{
|
| 242 |
+
/* For experimental::precision::s4 fragment element type, pack 8 elements into a single
|
| 243 |
+
32-bit signed int storage element */
|
| 244 |
+
int val = in & 0xf;
|
| 245 |
+
return (val | (val << 4) | (val << 8) | (val << 12) | (val << 16) |
|
| 246 |
+
(val << 20) | (val << 24) | (val << 28));
|
| 247 |
+
};
|
| 248 |
+
|
| 249 |
+
template<>
|
| 250 |
+
__device__ inline unsigned
|
| 251 |
+
__get_storage_value<experimental::precision::b1, unsigned, unsigned>(unsigned in)
|
| 252 |
+
{
|
| 253 |
+
/* For experimental::precision::b1 fragment element type, pack 32 elements into a
|
| 254 |
+
single 32-bit unsigned int storage element */
|
| 255 |
+
return (in & 0x1) ? 0xFFFFFFFFU : 0;
|
| 256 |
+
}
|
| 257 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 258 |
+
|
| 259 |
+
template <typename FragEleType, int size, int packed_size>
|
| 260 |
+
__CUDA_MMA_DEVICE_DECL__ void fill_fragment(__frag_base<FragEleType, size, packed_size>& f,
|
| 261 |
+
/* The mapping from fragment element type (FragEleType) to fill_argument_type is:
|
| 262 |
+
experimental::precision::u4 -> unsigned (only lower 4 bits taken)
|
| 263 |
+
experimental::precision::s4 -> int (only lower 4 bits taken)
|
| 264 |
+
experimental::precision::b1 -> unsigned (only lowest 1 bit taken)
|
| 265 |
+
precision::tf32 -> float
|
| 266 |
+
all other types T -> T
|
| 267 |
+
*/
|
| 268 |
+
const typename helper_traits<FragEleType>::fill_argument_type & in) {
|
| 269 |
+
|
| 270 |
+
/* get the (possibly packed) storage element value. See the specializations above for fragment
|
| 271 |
+
element types where the storage representation is packed */
|
| 272 |
+
typedef typename helper_traits<FragEleType>::storage_element_type storage_type;
|
| 273 |
+
storage_type v = __get_storage_value<FragEleType, storage_type>(in);
|
| 274 |
+
#pragma unroll
|
| 275 |
+
for (int i=0; i< f.num_storage_elements; i++)
|
| 276 |
+
f.x[i] = v;
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
//
|
| 280 |
+
// Fragment template
|
| 281 |
+
//
|
| 282 |
+
template<typename Use, int m, int n, int k, typename T, typename Layout=void> class fragment;
|
| 283 |
+
|
| 284 |
+
//
|
| 285 |
+
// Fragments for 16x16x16
|
| 286 |
+
//
|
| 287 |
+
template<> class fragment<matrix_a, 16, 16, 16, __half, row_major> : public __frag_base<__half, 16> {};
|
| 288 |
+
template<> class fragment<matrix_a, 16, 16, 16, __half, col_major> : public __frag_base<__half, 16> {};
|
| 289 |
+
template<> class fragment<matrix_b, 16, 16, 16, __half, row_major> : public __frag_base<__half, 16> {};
|
| 290 |
+
template<> class fragment<matrix_b, 16, 16, 16, __half, col_major> : public __frag_base<__half, 16> {};
|
| 291 |
+
template<> class fragment<accumulator, 16, 16, 16, __half> : public __frag_base<__half, 8> {};
|
| 292 |
+
template<> class fragment<accumulator, 16, 16, 16, float> : public __frag_base<float, 8> {};
|
| 293 |
+
|
| 294 |
+
#ifdef __CUDA_IMMA__
|
| 295 |
+
template<> class fragment<matrix_a, 16, 16, 16, signed char, row_major> : public __frag_base<signed char, 8> {};
|
| 296 |
+
template<> class fragment<matrix_a, 16, 16, 16, signed char, col_major> : public __frag_base<signed char, 8> {};
|
| 297 |
+
template<> class fragment<matrix_a, 16, 16, 16, unsigned char, row_major> : public __frag_base<unsigned char, 8> {};
|
| 298 |
+
template<> class fragment<matrix_a, 16, 16, 16, unsigned char, col_major> : public __frag_base<unsigned char, 8> {};
|
| 299 |
+
template<> class fragment<matrix_b, 16, 16, 16, signed char, row_major> : public __frag_base<signed char, 8> {};
|
| 300 |
+
template<> class fragment<matrix_b, 16, 16, 16, signed char, col_major> : public __frag_base<signed char, 8> {};
|
| 301 |
+
template<> class fragment<matrix_b, 16, 16, 16, unsigned char, row_major> : public __frag_base<unsigned char, 8> {};
|
| 302 |
+
template<> class fragment<matrix_b, 16, 16, 16, unsigned char, col_major> : public __frag_base<unsigned char, 8> {};
|
| 303 |
+
template<> class fragment<accumulator, 16, 16, 16, int> : public __frag_base<int, 8> {};
|
| 304 |
+
#endif /* __CUDA_IMMA__ */
|
| 305 |
+
|
| 306 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 307 |
+
template<> class fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major> : public __frag_base<__nv_bfloat16, 8> {};
|
| 308 |
+
template<> class fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major> : public __frag_base<__nv_bfloat16, 8> {};
|
| 309 |
+
template<> class fragment<matrix_b, 16, 16, 16, __nv_bfloat16, row_major> : public __frag_base<__nv_bfloat16, 8> {};
|
| 310 |
+
template<> class fragment<matrix_b, 16, 16, 16, __nv_bfloat16, col_major> : public __frag_base<__nv_bfloat16, 8> {};
|
| 311 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 312 |
+
|
| 313 |
+
//
|
| 314 |
+
// Fragments for 32x8x16
|
| 315 |
+
//
|
| 316 |
+
template<> class fragment<matrix_a, 32, 8, 16, __half, row_major> : public __frag_base<__half, 16> {};
|
| 317 |
+
template<> class fragment<matrix_a, 32, 8, 16, __half, col_major> : public __frag_base<__half, 16> {};
|
| 318 |
+
template<> class fragment<matrix_b, 32, 8, 16, __half, row_major> : public __frag_base<__half, 16> {};
|
| 319 |
+
template<> class fragment<matrix_b, 32, 8, 16, __half, col_major> : public __frag_base<__half, 16> {};
|
| 320 |
+
template<> class fragment<accumulator, 32, 8, 16, __half> : public __frag_base<__half, 8> {};
|
| 321 |
+
template<> class fragment<accumulator, 32, 8, 16, float> : public __frag_base<float, 8> {};
|
| 322 |
+
|
| 323 |
+
#ifdef __CUDA_IMMA__
|
| 324 |
+
template<> class fragment<matrix_a, 32, 8, 16, signed char, row_major> : public __frag_base<signed char, 16> {};
|
| 325 |
+
template<> class fragment<matrix_a, 32, 8, 16, signed char, col_major> : public __frag_base<signed char, 16> {};
|
| 326 |
+
template<> class fragment<matrix_a, 32, 8, 16, unsigned char, row_major> : public __frag_base<unsigned char, 16> {};
|
| 327 |
+
template<> class fragment<matrix_a, 32, 8, 16, unsigned char, col_major> : public __frag_base<unsigned char, 16> {};
|
| 328 |
+
template<> class fragment<matrix_b, 32, 8, 16, signed char, row_major> : public __frag_base<signed char, 4> {};
|
| 329 |
+
template<> class fragment<matrix_b, 32, 8, 16, signed char, col_major> : public __frag_base<signed char, 4> {};
|
| 330 |
+
template<> class fragment<matrix_b, 32, 8, 16, unsigned char, row_major> : public __frag_base<unsigned char, 4> {};
|
| 331 |
+
template<> class fragment<matrix_b, 32, 8, 16, unsigned char, col_major> : public __frag_base<unsigned char, 4> {};
|
| 332 |
+
template<> class fragment<accumulator, 32, 8, 16, int> : public __frag_base<int, 8> {};
|
| 333 |
+
#endif /* __CUDA_IMMA__ */
|
| 334 |
+
|
| 335 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 336 |
+
template<> class fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major> : public __frag_base<__nv_bfloat16, 16> {};
|
| 337 |
+
template<> class fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major> : public __frag_base<__nv_bfloat16, 16> {};
|
| 338 |
+
template<> class fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major> : public __frag_base<__nv_bfloat16, 4> {};
|
| 339 |
+
template<> class fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major> : public __frag_base<__nv_bfloat16, 4> {};
|
| 340 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 341 |
+
|
| 342 |
+
//
|
| 343 |
+
// Fragments for 8x32x16
|
| 344 |
+
//
|
| 345 |
+
template<> class fragment<matrix_a, 8, 32, 16, __half, row_major> : public __frag_base<__half, 16> {};
|
| 346 |
+
template<> class fragment<matrix_a, 8, 32, 16, __half, col_major> : public __frag_base<__half, 16> {};
|
| 347 |
+
template<> class fragment<matrix_b, 8, 32, 16, __half, row_major> : public __frag_base<__half, 16> {};
|
| 348 |
+
template<> class fragment<matrix_b, 8, 32, 16, __half, col_major> : public __frag_base<__half, 16> {};
|
| 349 |
+
template<> class fragment<accumulator, 8, 32, 16, __half> : public __frag_base<__half, 8> {};
|
| 350 |
+
template<> class fragment<accumulator, 8, 32, 16, float> : public __frag_base<float, 8> {};
|
| 351 |
+
|
| 352 |
+
#ifdef __CUDA_IMMA__
|
| 353 |
+
template<> class fragment<matrix_a, 8, 32, 16, signed char, row_major> : public __frag_base<signed char, 4> {};
|
| 354 |
+
template<> class fragment<matrix_a, 8, 32, 16, signed char, col_major> : public __frag_base<signed char, 4> {};
|
| 355 |
+
template<> class fragment<matrix_a, 8, 32, 16, unsigned char, row_major> : public __frag_base<unsigned char, 4> {};
|
| 356 |
+
template<> class fragment<matrix_a, 8, 32, 16, unsigned char, col_major> : public __frag_base<unsigned char, 4> {};
|
| 357 |
+
template<> class fragment<matrix_b, 8, 32, 16, signed char, row_major> : public __frag_base<signed char, 16> {};
|
| 358 |
+
template<> class fragment<matrix_b, 8, 32, 16, signed char, col_major> : public __frag_base<signed char, 16> {};
|
| 359 |
+
template<> class fragment<matrix_b, 8, 32, 16, unsigned char, row_major> : public __frag_base<unsigned char, 16> {};
|
| 360 |
+
template<> class fragment<matrix_b, 8, 32, 16, unsigned char, col_major> : public __frag_base<unsigned char, 16> {};
|
| 361 |
+
template<> class fragment<accumulator, 8, 32, 16, int> : public __frag_base<int, 8> {};
|
| 362 |
+
#endif /* __CUDA_IMMA__ */
|
| 363 |
+
|
| 364 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 365 |
+
template<> class fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major> : public __frag_base<__nv_bfloat16, 4> {};
|
| 366 |
+
template<> class fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major> : public __frag_base<__nv_bfloat16, 4> {};
|
| 367 |
+
template<> class fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major> : public __frag_base<__nv_bfloat16, 16> {};
|
| 368 |
+
template<> class fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major> : public __frag_base<__nv_bfloat16, 16> {};
|
| 369 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 370 |
+
|
| 371 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 372 |
+
//
|
| 373 |
+
// Fragments for 8x8x32
|
| 374 |
+
//
|
| 375 |
+
template<> class fragment<matrix_a, 8, 8, 32, experimental::precision::u4, row_major> : public __frag_base<experimental::precision::u4, 8, 1> {};
|
| 376 |
+
template<> class fragment<matrix_a, 8, 8, 32, experimental::precision::s4, row_major> : public __frag_base<experimental::precision::s4, 8, 1> {};
|
| 377 |
+
template<> class fragment<matrix_b, 8, 8, 32, experimental::precision::u4, col_major> : public __frag_base<experimental::precision::u4, 8, 1> {};
|
| 378 |
+
template<> class fragment<matrix_b, 8, 8, 32, experimental::precision::s4, col_major> : public __frag_base<experimental::precision::s4, 8, 1> {};
|
| 379 |
+
template<> class fragment<accumulator, 8, 8, 32, int> : public __frag_base<int, 2> {};
|
| 380 |
+
|
| 381 |
+
//
|
| 382 |
+
// Fragments for 8x8x128
|
| 383 |
+
//
|
| 384 |
+
template<> class fragment<matrix_a, 8, 8, 128, experimental::precision::b1, row_major> : public __frag_base<experimental::precision::b1, 32, 1> {};
|
| 385 |
+
template<> class fragment<matrix_b, 8, 8, 128, experimental::precision::b1, col_major> : public __frag_base<experimental::precision::b1, 32, 1> {};
|
| 386 |
+
template<> class fragment<accumulator, 8, 8, 128, int> : public __frag_base<int, 2> {};
|
| 387 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 388 |
+
|
| 389 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 390 |
+
//
|
| 391 |
+
// Fragments for 16x16x8
|
| 392 |
+
//
|
| 393 |
+
template<> class fragment<matrix_a, 16, 16, 8, precision::tf32, row_major> : public __frag_base<precision::tf32, 4> {};
|
| 394 |
+
template<> class fragment<matrix_a, 16, 16, 8, precision::tf32, col_major> : public __frag_base<precision::tf32, 4> {};
|
| 395 |
+
template<> class fragment<matrix_b, 16, 16, 8, precision::tf32, row_major> : public __frag_base<precision::tf32, 4> {};
|
| 396 |
+
template<> class fragment<matrix_b, 16, 16, 8, precision::tf32, col_major> : public __frag_base<precision::tf32, 4> {};
|
| 397 |
+
template<> class fragment<accumulator, 16, 16, 8, float> : public __frag_base<float, 8> {};
|
| 398 |
+
|
| 399 |
+
//
|
| 400 |
+
// Fragments for 8x8x4
|
| 401 |
+
//
|
| 402 |
+
template<> class fragment<matrix_a, 8, 8, 4, double, row_major> : public __frag_base<double, 1> {};
|
| 403 |
+
template<> class fragment<matrix_a, 8, 8, 4, double, col_major> : public __frag_base<double, 1> {};
|
| 404 |
+
template<> class fragment<matrix_b, 8, 8, 4, double, row_major> : public __frag_base<double, 1> {};
|
| 405 |
+
template<> class fragment<matrix_b, 8, 8, 4, double, col_major> : public __frag_base<double, 1> {};
|
| 406 |
+
template<> class fragment<accumulator, 8, 8, 4, double> : public __frag_base<double, 2> {};
|
| 407 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
//
|
| 411 |
+
// Load functions for frags of shape m16n16k16
|
| 412 |
+
//
|
| 413 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 414 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 415 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, __half, row_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 416 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, __half, col_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 417 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 16, 16, 16, __half>& a, const __half* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 418 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 16, 16, 16, float>& a, const float* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 419 |
+
|
| 420 |
+
#ifdef __CUDA_IMMA__
|
| 421 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 422 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 423 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 424 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 425 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 426 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 427 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 428 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 429 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 16, 16, 16, int>& a, const int* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 430 |
+
#endif /* __CUDA_IMMA__ */
|
| 431 |
+
|
| 432 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 433 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 434 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 435 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 436 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 437 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 438 |
+
|
| 439 |
+
//
|
| 440 |
+
// Load functions for frags of shape m32n8k16
|
| 441 |
+
//
|
| 442 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 443 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 444 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __half, row_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 445 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __half, col_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 446 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 32, 8, 16, __half>& a, const __half* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 447 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 32, 8, 16, float>& a, const float* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 448 |
+
|
| 449 |
+
#ifdef __CUDA_IMMA__
|
| 450 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 451 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 452 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 453 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 454 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 455 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 456 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 457 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 458 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 32, 8, 16, int>& a, const int* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 459 |
+
#endif /* __CUDA_IMMA__ */
|
| 460 |
+
|
| 461 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 462 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 463 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 464 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 465 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 466 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 467 |
+
|
| 468 |
+
//
|
| 469 |
+
// Load functions for frags of shape m8n32k16
|
| 470 |
+
//
|
| 471 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 472 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 473 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __half, row_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 474 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __half, col_major>& a, const __half* p, unsigned ldm) __DEF_IF_HOST
|
| 475 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 32, 16, __half>& a, const __half* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 476 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 32, 16, float>& a, const float* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 477 |
+
|
| 478 |
+
#ifdef __CUDA_IMMA__
|
| 479 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 480 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 481 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 482 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 483 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 484 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) __DEF_IF_HOST
|
| 485 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 486 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) __DEF_IF_HOST
|
| 487 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 32, 16, int>& a, const int* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 488 |
+
#endif /* __CUDA_IMMA__ */
|
| 489 |
+
|
| 490 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 491 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 492 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 493 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 494 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) __DEF_IF_HOST
|
| 495 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 496 |
+
|
| 497 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 498 |
+
//
|
| 499 |
+
// Load functions for frags of shape m8n8k32
|
| 500 |
+
//
|
| 501 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 32, experimental::precision::s4, row_major>& a, const void* p, unsigned ldm) __DEF_IF_HOST
|
| 502 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 32, experimental::precision::u4, row_major>& a, const void* p, unsigned ldm) __DEF_IF_HOST
|
| 503 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 32, experimental::precision::s4, col_major>& a, const void* p, unsigned ldm) __DEF_IF_HOST
|
| 504 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 32, experimental::precision::u4, col_major>& a, const void* p, unsigned ldm) __DEF_IF_HOST
|
| 505 |
+
|
| 506 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 8, 32, int>& a, const int* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 507 |
+
|
| 508 |
+
//
|
| 509 |
+
// Load functions for frags of shape m8n8k128
|
| 510 |
+
//
|
| 511 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 128, experimental::precision::b1, row_major>& a, const void* p, unsigned ldm) __DEF_IF_HOST
|
| 512 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 128, experimental::precision::b1, col_major>& a, const void* p, unsigned ldm) __DEF_IF_HOST
|
| 513 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 8, 128, int>& a, const int* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 514 |
+
|
| 515 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 516 |
+
|
| 517 |
+
|
| 518 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 519 |
+
//
|
| 520 |
+
// Load functions for frags of shape m16n16k8
|
| 521 |
+
//
|
| 522 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 8, precision::tf32, row_major>& a, const float* p, unsigned ldm) __DEF_IF_HOST
|
| 523 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 8, precision::tf32, col_major>& a, const float* p, unsigned ldm) __DEF_IF_HOST
|
| 524 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 8, precision::tf32, row_major>& a, const float* p, unsigned ldm) __DEF_IF_HOST
|
| 525 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 8, precision::tf32, col_major>& a, const float* p, unsigned ldm) __DEF_IF_HOST
|
| 526 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 16, 16, 8, float>& a, const float* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 527 |
+
|
| 528 |
+
//
|
| 529 |
+
// Load functions for frags of shape m8n8k4
|
| 530 |
+
//
|
| 531 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 4, double, row_major>& a, const double* p, unsigned ldm) __DEF_IF_HOST
|
| 532 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 4, double, col_major>& a, const double* p, unsigned ldm) __DEF_IF_HOST
|
| 533 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 4, double, row_major>& a, const double* p, unsigned ldm) __DEF_IF_HOST
|
| 534 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 4, double, col_major>& a, const double* p, unsigned ldm) __DEF_IF_HOST
|
| 535 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 8, 4, double>& a, const double* p, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 536 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 537 |
+
|
| 538 |
+
//
|
| 539 |
+
// Store functions for frags of shape m16n16k16
|
| 540 |
+
//
|
| 541 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(__half *p, const fragment<accumulator, 16, 16, 16, __half>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 542 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 16, 16, 16, float>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 543 |
+
#ifdef __CUDA_IMMA__
|
| 544 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 16, 16, 16, int>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 545 |
+
#endif /* __CUDA_IMMA__ */
|
| 546 |
+
|
| 547 |
+
//
|
| 548 |
+
// Store functions for frags of shape m32n8k16
|
| 549 |
+
//
|
| 550 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(__half *p, const fragment<accumulator, 32, 8, 16, __half>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 551 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 32, 8, 16, float>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 552 |
+
#ifdef __CUDA_IMMA__
|
| 553 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 32, 8, 16, int>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 554 |
+
#endif /* __CUDA_IMMA__ */
|
| 555 |
+
|
| 556 |
+
//
|
| 557 |
+
// Store functions for frags of shape m8n32k16
|
| 558 |
+
//
|
| 559 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(__half *p, const fragment<accumulator, 8, 32, 16, __half>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 560 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 8, 32, 16, float>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 561 |
+
#ifdef __CUDA_IMMA__
|
| 562 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 8, 32, 16, int>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 563 |
+
#endif /* __CUDA_IMMA__ */
|
| 564 |
+
|
| 565 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 566 |
+
//
|
| 567 |
+
// Store functions for frags of shape m8n8k32
|
| 568 |
+
//
|
| 569 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 8, 8, 32, int>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 570 |
+
|
| 571 |
+
//
|
| 572 |
+
// Store functions for frags of shape m8n8k128
|
| 573 |
+
//
|
| 574 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 8, 8, 128, int>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 575 |
+
|
| 576 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 577 |
+
|
| 578 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 579 |
+
//
|
| 580 |
+
// Store functions for frags of shape m16n16k8
|
| 581 |
+
//
|
| 582 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 16, 16, 8, float>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 583 |
+
|
| 584 |
+
//
|
| 585 |
+
// Store functions for frags of shape m8n8k4
|
| 586 |
+
//
|
| 587 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(double *p, const fragment<accumulator, 8, 8, 4, double>& a, unsigned ldm, layout_t layout) __DEF_IF_HOST
|
| 588 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 589 |
+
|
| 590 |
+
//
|
| 591 |
+
// MMA functions for shape m16n16k16
|
| 592 |
+
//
|
| 593 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 594 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 595 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 596 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 597 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 598 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 599 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 600 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) __DEF_IF_HOST
|
| 601 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 602 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 603 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 604 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 605 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 606 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 607 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 608 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 609 |
+
|
| 610 |
+
#ifdef __CUDA_IMMA__
|
| 611 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, row_major>& a, const fragment<matrix_b,16, 16, 16, signed char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 612 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, col_major>& a, const fragment<matrix_b,16, 16, 16, signed char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 613 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, row_major>& a, const fragment<matrix_b,16, 16, 16, signed char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 614 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, col_major>& a, const fragment<matrix_b,16, 16, 16, signed char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 615 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, row_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 616 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, col_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 617 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, row_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 618 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, col_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 619 |
+
#endif /* __CUDA_IMMA__ */
|
| 620 |
+
|
| 621 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 622 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 623 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 624 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 625 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) __DEF_IF_HOST
|
| 626 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 627 |
+
|
| 628 |
+
//
|
| 629 |
+
// MMA functions for shape m32n8k16
|
| 630 |
+
//
|
| 631 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 632 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 633 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 634 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 635 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 636 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 637 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 638 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, __half>& c) __DEF_IF_HOST
|
| 639 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 640 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 641 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 642 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 643 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 644 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 645 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 646 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b, 32, 8, 16, __half, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 647 |
+
|
| 648 |
+
#ifdef __CUDA_IMMA__
|
| 649 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, row_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 650 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, col_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 651 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, row_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 652 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, col_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 653 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, row_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 654 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, col_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 655 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, row_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 656 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, col_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 657 |
+
#endif /* __CUDA_IMMA__ */
|
| 658 |
+
|
| 659 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 660 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 661 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 662 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 663 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) __DEF_IF_HOST
|
| 664 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 665 |
+
|
| 666 |
+
//
|
| 667 |
+
// MMA functions for shape m8n32k16
|
| 668 |
+
//
|
| 669 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 670 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 671 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 672 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 673 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 674 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 675 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 676 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, __half>& c) __DEF_IF_HOST
|
| 677 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 678 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 679 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 680 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 681 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 682 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 683 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 684 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b, 8, 32, 16, __half, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 685 |
+
|
| 686 |
+
#ifdef __CUDA_IMMA__
|
| 687 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, row_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 688 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, col_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 689 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, row_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 690 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, col_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 691 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, row_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 692 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, col_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 693 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, row_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 694 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, col_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf=false) __DEF_IF_HOST
|
| 695 |
+
#endif /* __CUDA_IMMA__ */
|
| 696 |
+
|
| 697 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 698 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 699 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 700 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 701 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) __DEF_IF_HOST
|
| 702 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 703 |
+
|
| 704 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 705 |
+
//
|
| 706 |
+
// MMA functions for shape m8n8k32
|
| 707 |
+
//
|
| 708 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 32, int>& d, const fragment<matrix_a, 8, 8, 32, experimental::precision::s4, row_major>& a, const fragment<matrix_b, 8, 8, 32, experimental::precision::s4, col_major>& b, const fragment<accumulator, 8, 8, 32, int>& c, bool satf=false) __DEF_IF_HOST
|
| 709 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 32, int>& d, const fragment<matrix_a, 8, 8, 32, experimental::precision::u4, row_major>& a, const fragment<matrix_b, 8, 8, 32, experimental::precision::u4, col_major>& b, const fragment<accumulator, 8, 8, 32, int>& c, bool satf=false) __DEF_IF_HOST
|
| 710 |
+
|
| 711 |
+
|
| 712 |
+
//
|
| 713 |
+
// MMA functions for shape m8n8k128
|
| 714 |
+
//
|
| 715 |
+
__CUDA_MMA_DEVICE_DECL__ void bmma_sync(fragment<accumulator, 8, 8, 128, int>& d, const fragment<matrix_a, 8, 8, 128, experimental::precision::b1, row_major>& a, const fragment<matrix_b, 8, 8, 128, experimental::precision::b1, col_major>& b, const fragment<accumulator, 8, 8, 128, int>& c,
|
| 716 |
+
experimental::bmmaBitOp = experimental::bmmaBitOpXOR,
|
| 717 |
+
experimental::bmmaAccumulateOp = experimental::bmmaAccumulateOpPOPC) __DEF_IF_HOST
|
| 718 |
+
|
| 719 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 720 |
+
|
| 721 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 722 |
+
//
|
| 723 |
+
// MMA functions for shape m16n16k8
|
| 724 |
+
//
|
| 725 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, row_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, col_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) __DEF_IF_HOST
|
| 726 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, col_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, col_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) __DEF_IF_HOST
|
| 727 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, row_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, row_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) __DEF_IF_HOST
|
| 728 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, col_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, row_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) __DEF_IF_HOST
|
| 729 |
+
|
| 730 |
+
//
|
| 731 |
+
// MMA functions for shape m8n8k4
|
| 732 |
+
//
|
| 733 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, row_major>& a, const fragment<matrix_b, 8, 8, 4, double, col_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) __DEF_IF_HOST
|
| 734 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, col_major>& a, const fragment<matrix_b, 8, 8, 4, double, col_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) __DEF_IF_HOST
|
| 735 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, row_major>& a, const fragment<matrix_b, 8, 8, 4, double, row_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) __DEF_IF_HOST
|
| 736 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, col_major>& a, const fragment<matrix_b, 8, 8, 4, double, row_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) __DEF_IF_HOST
|
| 737 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 738 |
+
};
|
| 739 |
+
};
|
| 740 |
+
|
| 741 |
+
#undef __DEF_IF_HOST
|
| 742 |
+
#undef __CUDA_IMMA__
|
| 743 |
+
#undef __CUDA_SUBBYTE_IMMA__
|
| 744 |
+
#undef __CUDA_AMPERE_MMA__
|
| 745 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 700 */
|
| 746 |
+
|
| 747 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 748 |
+
|
| 749 |
+
#undef __CUDA_MMA_DEVICE_DECL__
|
| 750 |
+
|
| 751 |
+
#if defined(__CUDA_ARCH__)
|
| 752 |
+
#include "mma.hpp"
|
| 753 |
+
#endif /* defined(__CUDA_ARCH__) */
|
| 754 |
+
|
| 755 |
+
|
| 756 |
+
#endif /* !__CUDA_MMA_H__ */
|
| 757 |
+
|
| 758 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_MMA_H__)
|
| 759 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 760 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_MMA_H__
|
| 761 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/mma.hpp
ADDED
|
@@ -0,0 +1,1128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2017-2020 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/mma.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/mma.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_MMA_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__CUDA_MMA_HPP__)
|
| 61 |
+
#define __CUDA_MMA_HPP__
|
| 62 |
+
|
| 63 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 64 |
+
|
| 65 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700
|
| 66 |
+
|
| 67 |
+
#include <cuda_fp16.h>
|
| 68 |
+
#include <cuda_bf16.h>
|
| 69 |
+
|
| 70 |
+
#define __CUDA_MMA_DEVICE_DECL__ static __device__ __inline__
|
| 71 |
+
|
| 72 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 720
|
| 73 |
+
#define __CUDA_IMMA__ 1
|
| 74 |
+
#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 720 */
|
| 75 |
+
|
| 76 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 730
|
| 77 |
+
#define __CUDA_SUBBYTE_IMMA__ 1
|
| 78 |
+
#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 730 */
|
| 79 |
+
|
| 80 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
|
| 81 |
+
#define __CUDA_AMPERE_MMA__ 1
|
| 82 |
+
#endif /* !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800 */
|
| 83 |
+
|
| 84 |
+
namespace nvcuda {
|
| 85 |
+
namespace wmma {
|
| 86 |
+
|
| 87 |
+
//
|
| 88 |
+
// Load functions for frags of shape m16n16k16
|
| 89 |
+
//
|
| 90 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const __half* p, unsigned ldm) {
|
| 91 |
+
__hmma_m16n16k16_ld_a((int*)&a, (const int*)p, ldm, 0);
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const __half* p, unsigned ldm) {
|
| 95 |
+
__hmma_m16n16k16_ld_a((int*)&a, (const int*)p, ldm, 1);
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b,16, 16, 16, __half, row_major>& a, const __half* p, unsigned ldm) {
|
| 99 |
+
__hmma_m16n16k16_ld_b((int*)&a, (const int*)p, ldm, 0);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b,16, 16, 16, __half, col_major>& a, const __half* p, unsigned ldm) {
|
| 103 |
+
__hmma_m16n16k16_ld_b((int*)&a, (const int*)p, ldm, 1);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator,16, 16, 16, __half>& a, const __half* p, unsigned ldm, layout_t layout) {
|
| 107 |
+
if (layout == mem_row_major)
|
| 108 |
+
__hmma_m16n16k16_ld_c_f16((int*)&a, (const int*)p, ldm, 0);
|
| 109 |
+
else
|
| 110 |
+
__hmma_m16n16k16_ld_c_f16((int*)&a, (const int*)p, ldm, 1);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator,16, 16, 16, float>& a, const float* p, unsigned ldm, layout_t layout) {
|
| 114 |
+
if (layout == mem_row_major)
|
| 115 |
+
__hmma_m16n16k16_ld_c_f32((float*)&a, (const float*)p, ldm, 0);
|
| 116 |
+
else
|
| 117 |
+
__hmma_m16n16k16_ld_c_f32((float*)&a, (const float*)p, ldm, 1);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
#ifdef __CUDA_IMMA__
|
| 121 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) {
|
| 122 |
+
__imma_m16n16k16_ld_a_s8((int *)&a, (const int *)p, ldm, 0);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) {
|
| 126 |
+
__imma_m16n16k16_ld_a_s8((int *)&a, (const int *)p, ldm, 1);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) {
|
| 130 |
+
__imma_m16n16k16_ld_a_u8((int *)&a, (const int *)p, ldm, 0);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) {
|
| 134 |
+
__imma_m16n16k16_ld_a_u8((int *)&a, (const int *)p, ldm, 1);
|
| 135 |
+
}
|
| 136 |
+
|
| 137 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) {
|
| 138 |
+
__imma_m16n16k16_ld_b_s8((int *)&a, (const int *)p, ldm, 0);
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) {
|
| 142 |
+
__imma_m16n16k16_ld_b_s8((int *)&a, (const int *)p, ldm, 1);
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) {
|
| 146 |
+
__imma_m16n16k16_ld_b_u8((int *)&a, (const int *)p, ldm, 0);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) {
|
| 150 |
+
__imma_m16n16k16_ld_b_u8((int *)&a, (const int *)p, ldm, 1);
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator,16, 16, 16, int>& a, const int* p, unsigned ldm, layout_t layout) {
|
| 154 |
+
if (layout == mem_row_major)
|
| 155 |
+
__imma_m16n16k16_ld_c((int *)&a, (const int*)p, ldm, 0);
|
| 156 |
+
else
|
| 157 |
+
__imma_m16n16k16_ld_c((int *)&a, (const int*)p, ldm, 1);
|
| 158 |
+
}
|
| 159 |
+
#endif /* __CUDA_IMMA__ */
|
| 160 |
+
|
| 161 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 162 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 163 |
+
__mma_bf16_m16n16k16_ld_a((int*)&a, (const int*)p, ldm, 0);
|
| 164 |
+
}
|
| 165 |
+
|
| 166 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 167 |
+
__mma_bf16_m16n16k16_ld_a((int*)&a, (const int*)p, ldm, 1);
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 171 |
+
__mma_bf16_m16n16k16_ld_b((int*)&a, (const int*)p, ldm, 0);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 175 |
+
__mma_bf16_m16n16k16_ld_b((int*)&a, (const int*)p, ldm, 1);
|
| 176 |
+
}
|
| 177 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
//
|
| 181 |
+
// Load functions for frags of shape m32n8k16
|
| 182 |
+
//
|
| 183 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const __half* p, unsigned ldm) {
|
| 184 |
+
__hmma_m32n8k16_ld_a((int*)&a, (const int*)p, ldm, 0);
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const __half* p, unsigned ldm) {
|
| 188 |
+
__hmma_m32n8k16_ld_a((int*)&a, (const int*)p, ldm, 1);
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __half, row_major>& a, const __half* p, unsigned ldm) {
|
| 192 |
+
__hmma_m32n8k16_ld_b((int*)&a, (const int*)p, ldm, 0);
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __half, col_major>& a, const __half* p, unsigned ldm) {
|
| 196 |
+
__hmma_m32n8k16_ld_b((int*)&a, (const int*)p, ldm, 1);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 32, 8, 16, __half>& a, const __half* p, unsigned ldm, layout_t layout) {
|
| 200 |
+
if (layout == mem_row_major)
|
| 201 |
+
__hmma_m32n8k16_ld_c_f16((int*)&a, (const int*)p, ldm, 0);
|
| 202 |
+
else
|
| 203 |
+
__hmma_m32n8k16_ld_c_f16((int*)&a, (const int*)p, ldm, 1);
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 32, 8, 16, float>& a, const float* p, unsigned ldm, layout_t layout) {
|
| 207 |
+
if (layout == mem_row_major)
|
| 208 |
+
__hmma_m32n8k16_ld_c_f32((float*)&a, (const float*)p, ldm, 0);
|
| 209 |
+
else
|
| 210 |
+
__hmma_m32n8k16_ld_c_f32((float*)&a, (const float*)p, ldm, 1);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
#ifdef __CUDA_IMMA__
|
| 214 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) {
|
| 215 |
+
__imma_m32n8k16_ld_a_s8((int *)&a, (const int *)p, ldm, 0);
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) {
|
| 219 |
+
__imma_m32n8k16_ld_a_s8((int *)&a, (const int *)p, ldm, 1);
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) {
|
| 223 |
+
__imma_m32n8k16_ld_a_u8((int *)&a, (const int *)p, ldm, 0);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) {
|
| 227 |
+
__imma_m32n8k16_ld_a_u8((int *)&a, (const int *)p, ldm, 1);
|
| 228 |
+
}
|
| 229 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) {
|
| 230 |
+
__imma_m32n8k16_ld_b_s8((int *)&a, (const int *)p, ldm, 0);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) {
|
| 234 |
+
__imma_m32n8k16_ld_b_s8((int *)&a, (const int *)p, ldm, 1);
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) {
|
| 238 |
+
__imma_m32n8k16_ld_b_u8((int *)&a, (const int *)p, ldm, 0);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) {
|
| 242 |
+
__imma_m32n8k16_ld_b_u8((int *)&a, (const int *)p, ldm, 1);
|
| 243 |
+
}
|
| 244 |
+
|
| 245 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 32, 8, 16, int>& a, const int* p, unsigned ldm, layout_t layout) {
|
| 246 |
+
if (layout == mem_row_major)
|
| 247 |
+
__imma_m32n8k16_ld_c((int *)&a, (const int*)p, ldm, 0);
|
| 248 |
+
else
|
| 249 |
+
__imma_m32n8k16_ld_c((int *)&a, (const int*)p, ldm, 1);
|
| 250 |
+
}
|
| 251 |
+
#endif /* __CUDA_IMMA__ */
|
| 252 |
+
|
| 253 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 254 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 255 |
+
__mma_bf16_m32n8k16_ld_a((int*)&a, (const int*)p, ldm, 0);
|
| 256 |
+
}
|
| 257 |
+
|
| 258 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 259 |
+
__mma_bf16_m32n8k16_ld_a((int*)&a, (const int*)p, ldm, 1);
|
| 260 |
+
}
|
| 261 |
+
|
| 262 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 263 |
+
__mma_bf16_m32n8k16_ld_b((int*)&a, (const int*)p, ldm, 0);
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 267 |
+
__mma_bf16_m32n8k16_ld_b((int*)&a, (const int*)p, ldm, 1);
|
| 268 |
+
}
|
| 269 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 270 |
+
|
| 271 |
+
|
| 272 |
+
//
|
| 273 |
+
// Load functions for frags of shape m8n32k16
|
| 274 |
+
//
|
| 275 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const __half* p, unsigned ldm) {
|
| 276 |
+
__hmma_m8n32k16_ld_a((int*)&a, (const int*)p, ldm, 0);
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const __half* p, unsigned ldm) {
|
| 280 |
+
__hmma_m8n32k16_ld_a((int*)&a, (const int*)p, ldm, 1);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __half, row_major>& a, const __half* p, unsigned ldm) {
|
| 284 |
+
__hmma_m8n32k16_ld_b((int*)&a, (const int*)p, ldm, 0);
|
| 285 |
+
}
|
| 286 |
+
|
| 287 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __half, col_major>& a, const __half* p, unsigned ldm) {
|
| 288 |
+
__hmma_m8n32k16_ld_b((int*)&a, (const int*)p, ldm, 1);
|
| 289 |
+
}
|
| 290 |
+
|
| 291 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 32, 16, __half>& a, const __half* p, unsigned ldm, layout_t layout) {
|
| 292 |
+
if (layout == mem_row_major)
|
| 293 |
+
__hmma_m8n32k16_ld_c_f16((int*)&a, (const int*)p, ldm, 0);
|
| 294 |
+
else
|
| 295 |
+
__hmma_m8n32k16_ld_c_f16((int*)&a, (const int*)p, ldm, 1);
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 32, 16, float>& a, const float* p, unsigned ldm, layout_t layout) {
|
| 299 |
+
if (layout == mem_row_major)
|
| 300 |
+
__hmma_m8n32k16_ld_c_f32((float*)&a, (const float*)p, ldm, 0);
|
| 301 |
+
else
|
| 302 |
+
__hmma_m8n32k16_ld_c_f32((float*)&a, (const float*)p, ldm, 1);
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
#ifdef __CUDA_IMMA__
|
| 306 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) {
|
| 307 |
+
__imma_m8n32k16_ld_a_s8((int *)&a, (const int *)p, ldm, 0);
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) {
|
| 311 |
+
__imma_m8n32k16_ld_a_s8((int *)&a, (const int *)p, ldm, 1);
|
| 312 |
+
}
|
| 313 |
+
|
| 314 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) {
|
| 315 |
+
__imma_m8n32k16_ld_a_u8((int *)&a, (const int *)p, ldm, 0);
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) {
|
| 319 |
+
__imma_m8n32k16_ld_a_u8((int *)&a, (const int *)p, ldm, 1);
|
| 320 |
+
}
|
| 321 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, signed char, row_major>& a, const signed char* p, unsigned ldm) {
|
| 322 |
+
__imma_m8n32k16_ld_b_s8((int *)&a, (const int *)p, ldm, 0);
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, signed char, col_major>& a, const signed char* p, unsigned ldm) {
|
| 326 |
+
__imma_m8n32k16_ld_b_s8((int *)&a, (const int *)p, ldm, 1);
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, unsigned char, row_major>& a, const unsigned char* p, unsigned ldm) {
|
| 330 |
+
__imma_m8n32k16_ld_b_u8((int *)&a, (const int *)p, ldm, 0);
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, unsigned char, col_major>& a, const unsigned char* p, unsigned ldm) {
|
| 334 |
+
__imma_m8n32k16_ld_b_u8((int *)&a, (const int *)p, ldm, 1);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 32, 16, int>& a, const int* p, unsigned ldm, layout_t layout) {
|
| 338 |
+
if (layout == mem_row_major)
|
| 339 |
+
__imma_m8n32k16_ld_c((int *)&a, (const int*)p, ldm, 0);
|
| 340 |
+
else
|
| 341 |
+
__imma_m8n32k16_ld_c((int *)&a, (const int*)p, ldm, 1);
|
| 342 |
+
}
|
| 343 |
+
#endif /* __CUDA_IMMA__ */
|
| 344 |
+
|
| 345 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 346 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 347 |
+
__mma_bf16_m8n32k16_ld_a((int*)&a, (const int*)p, ldm, 0);
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 351 |
+
__mma_bf16_m8n32k16_ld_a((int*)&a, (const int*)p, ldm, 1);
|
| 352 |
+
}
|
| 353 |
+
|
| 354 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 355 |
+
__mma_bf16_m8n32k16_ld_b((int*)&a, (const int*)p, ldm, 0);
|
| 356 |
+
}
|
| 357 |
+
|
| 358 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major>& a, const __nv_bfloat16* p, unsigned ldm) {
|
| 359 |
+
__mma_bf16_m8n32k16_ld_b((int*)&a, (const int*)p, ldm, 1);
|
| 360 |
+
}
|
| 361 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 362 |
+
|
| 363 |
+
|
| 364 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 365 |
+
//
|
| 366 |
+
// Load functions for frags of shape m8n8k32
|
| 367 |
+
//
|
| 368 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 32, experimental::precision::s4, row_major>& a, const void* p, unsigned ldm) {
|
| 369 |
+
__imma_m8n8k32_ld_a_s4((int *)&a, (const int *)p, ldm, 0);
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 32, experimental::precision::u4, row_major>& a, const void* p, unsigned ldm) {
|
| 373 |
+
__imma_m8n8k32_ld_a_u4((int *)&a, (const int *)p, ldm, 0);
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 32, experimental::precision::s4, col_major>& a, const void* p, unsigned ldm) {
|
| 377 |
+
__imma_m8n8k32_ld_b_s4((int *)&a, (const int *)p, ldm, 1);
|
| 378 |
+
}
|
| 379 |
+
|
| 380 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 32, experimental::precision::u4, col_major>& a, const void* p, unsigned ldm) {
|
| 381 |
+
__imma_m8n8k32_ld_b_u4((int *)&a, (const int *)p, ldm, 1);
|
| 382 |
+
}
|
| 383 |
+
|
| 384 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 8, 32, int>& a, const int* p, unsigned ldm, layout_t layout) {
|
| 385 |
+
if (layout == mem_row_major)
|
| 386 |
+
__imma_m8n8k32_ld_c((int *)&a, (const int*)p, ldm, 0);
|
| 387 |
+
else
|
| 388 |
+
__imma_m8n8k32_ld_c((int *)&a, (const int*)p, ldm, 1);
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
//
|
| 392 |
+
// Load functions for frags of shape m8n8k128
|
| 393 |
+
//
|
| 394 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 128, experimental::precision::b1, row_major>& a, const void* p, unsigned ldm) {
|
| 395 |
+
__bmma_m8n8k128_ld_a_b1((int *)&a, (const int *)p, ldm, 0);
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 128, experimental::precision::b1, col_major>& a, const void* p, unsigned ldm) {
|
| 399 |
+
__bmma_m8n8k128_ld_b_b1((int *)&a, (const int *)p, ldm, 1);
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 8, 128, int>& a, const int* p, unsigned ldm, layout_t layout) {
|
| 403 |
+
if (layout == mem_row_major)
|
| 404 |
+
__bmma_m8n8k128_ld_c((int *)&a, (const int*)p, ldm, 0);
|
| 405 |
+
else
|
| 406 |
+
__bmma_m8n8k128_ld_c((int *)&a, (const int*)p, ldm, 1);
|
| 407 |
+
}
|
| 408 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
|
| 412 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 413 |
+
// load functions for frags of shape m16n16k8
|
| 414 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 8, precision::tf32, row_major>& a, const float* p, unsigned ldm) {
|
| 415 |
+
__mma_tf32_m16n16k8_ld_a((int *)&a, (const int *)p, ldm, 0);
|
| 416 |
+
}
|
| 417 |
+
|
| 418 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 16, 16, 8, precision::tf32, col_major>& a, const float* p, unsigned ldm) {
|
| 419 |
+
__mma_tf32_m16n16k8_ld_a((int *)&a, (const int *)p, ldm, 1);
|
| 420 |
+
}
|
| 421 |
+
|
| 422 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 8, precision::tf32, row_major>& a, const float* p, unsigned ldm) {
|
| 423 |
+
__mma_tf32_m16n16k8_ld_b((int *)&a, (const int *)p, ldm, 0);
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 16, 16, 8, precision::tf32, col_major>& a, const float* p, unsigned ldm) {
|
| 427 |
+
__mma_tf32_m16n16k8_ld_b((int *)&a, (const int *)p, ldm, 1);
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 16, 16, 8, float>& a, const float* p, unsigned ldm, layout_t layout) {
|
| 431 |
+
if (layout == mem_row_major)
|
| 432 |
+
__mma_tf32_m16n16k8_ld_c((float *)&a, p, ldm, 0);
|
| 433 |
+
else
|
| 434 |
+
__mma_tf32_m16n16k8_ld_c((float *)&a, p, ldm, 1);
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
// load functions for frags of shape m8n8k4
|
| 438 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 4, double, row_major>& a, const double* p, unsigned ldm) {
|
| 439 |
+
__dmma_m8n8k4_ld_a((double *)&a, p, ldm, 0);
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_a, 8, 8, 4, double, col_major>& a, const double* p, unsigned ldm) {
|
| 443 |
+
__dmma_m8n8k4_ld_a((double *)&a, p, ldm, 1);
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 4, double, row_major>& a, const double* p, unsigned ldm) {
|
| 447 |
+
__dmma_m8n8k4_ld_b((double *)&a, p, ldm, 0);
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<matrix_b, 8, 8, 4, double, col_major>& a, const double* p, unsigned ldm) {
|
| 451 |
+
__dmma_m8n8k4_ld_b((double *)&a, p, ldm, 1);
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
__CUDA_MMA_DEVICE_DECL__ void load_matrix_sync(fragment<accumulator, 8, 8, 4, double>& a, const double* p, unsigned ldm, layout_t layout) {
|
| 455 |
+
if (layout == mem_row_major)
|
| 456 |
+
__dmma_m8n8k4_ld_c((double *)&a, p, ldm, 0);
|
| 457 |
+
else
|
| 458 |
+
__dmma_m8n8k4_ld_c((double *)&a, p, ldm, 1);
|
| 459 |
+
}
|
| 460 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 461 |
+
|
| 462 |
+
//
|
| 463 |
+
// Store functions for frags of shape m16n16k16
|
| 464 |
+
//
|
| 465 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(__half *p, const fragment<accumulator,16, 16, 16, __half>& a, unsigned ldm, layout_t layout) {
|
| 466 |
+
if (layout == mem_row_major)
|
| 467 |
+
__hmma_m16n16k16_st_c_f16((int*)p, (int*)&a, ldm, 0);
|
| 468 |
+
else
|
| 469 |
+
__hmma_m16n16k16_st_c_f16((int*)p, (int*)&a, ldm, 1);
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator,16, 16, 16, float>& a, unsigned ldm, layout_t layout) {
|
| 473 |
+
if (layout == mem_row_major)
|
| 474 |
+
__hmma_m16n16k16_st_c_f32((float*)p, (float*)&a, ldm, 0);
|
| 475 |
+
else
|
| 476 |
+
__hmma_m16n16k16_st_c_f32((float*)p, (float*)&a, ldm, 1);
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
#ifdef __CUDA_IMMA__
|
| 480 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator,16, 16, 16, int>& a, unsigned ldm, layout_t layout) {
|
| 481 |
+
if (layout == mem_row_major)
|
| 482 |
+
__imma_m16n16k16_st_c_i32(p, (const int*)&a, ldm, 0);
|
| 483 |
+
else
|
| 484 |
+
__imma_m16n16k16_st_c_i32(p, (const int*)&a, ldm, 1);
|
| 485 |
+
}
|
| 486 |
+
#endif /* __CUDA_IMMA__ */
|
| 487 |
+
|
| 488 |
+
//
|
| 489 |
+
// Store functions for frags of shape m32n8k16
|
| 490 |
+
//
|
| 491 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(__half *p, const fragment<accumulator, 32, 8, 16, __half>& a, unsigned ldm, layout_t layout) {
|
| 492 |
+
if (layout == mem_row_major)
|
| 493 |
+
__hmma_m32n8k16_st_c_f16((int*)p, (int*)&a, ldm, 0);
|
| 494 |
+
else
|
| 495 |
+
__hmma_m32n8k16_st_c_f16((int*)p, (int*)&a, ldm, 1);
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 32, 8, 16, float>& a, unsigned ldm, layout_t layout) {
|
| 499 |
+
if (layout == mem_row_major)
|
| 500 |
+
__hmma_m32n8k16_st_c_f32((float*)p, (float*)&a, ldm, 0);
|
| 501 |
+
else
|
| 502 |
+
__hmma_m32n8k16_st_c_f32((float*)p, (float*)&a, ldm, 1);
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
#ifdef __CUDA_IMMA__
|
| 506 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 32, 8, 16, int>& a, unsigned ldm, layout_t layout) {
|
| 507 |
+
if (layout == mem_row_major)
|
| 508 |
+
__imma_m32n8k16_st_c_i32(p, (const int*)&a, ldm, 0);
|
| 509 |
+
else
|
| 510 |
+
__imma_m32n8k16_st_c_i32(p, (const int*)&a, ldm, 1);
|
| 511 |
+
}
|
| 512 |
+
#endif /* __CUDA_IMMA__ */
|
| 513 |
+
|
| 514 |
+
//
|
| 515 |
+
// Store functions for frags of shape m8n32k16
|
| 516 |
+
//
|
| 517 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(__half *p, const fragment<accumulator, 8, 32, 16, __half>& a, unsigned ldm, layout_t layout) {
|
| 518 |
+
if (layout == mem_row_major)
|
| 519 |
+
__hmma_m8n32k16_st_c_f16((int*)p, (int*)&a, ldm, 0);
|
| 520 |
+
else
|
| 521 |
+
__hmma_m8n32k16_st_c_f16((int*)p, (int*)&a, ldm, 1);
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 8, 32, 16, float>& a, unsigned ldm, layout_t layout) {
|
| 525 |
+
if (layout == mem_row_major)
|
| 526 |
+
__hmma_m8n32k16_st_c_f32((float*)p, (float*)&a, ldm, 0);
|
| 527 |
+
else
|
| 528 |
+
__hmma_m8n32k16_st_c_f32((float*)p, (float*)&a, ldm, 1);
|
| 529 |
+
}
|
| 530 |
+
|
| 531 |
+
#ifdef __CUDA_IMMA__
|
| 532 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 8, 32, 16, int>& a, unsigned ldm, layout_t layout) {
|
| 533 |
+
if (layout == mem_row_major)
|
| 534 |
+
__imma_m8n32k16_st_c_i32(p, (const int*)&a, ldm, 0);
|
| 535 |
+
else
|
| 536 |
+
__imma_m8n32k16_st_c_i32(p, (const int*)&a, ldm, 1);
|
| 537 |
+
}
|
| 538 |
+
#endif /* __CUDA_IMMA__ */
|
| 539 |
+
|
| 540 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 541 |
+
//
|
| 542 |
+
// Store functions for frags of shape m8n8k32
|
| 543 |
+
//
|
| 544 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 8, 8, 32, int>& a, unsigned ldm, layout_t layout) {
|
| 545 |
+
if (layout == mem_row_major)
|
| 546 |
+
__imma_m8n8k32_st_c_i32(p, (const int*)&a, ldm, 0);
|
| 547 |
+
else
|
| 548 |
+
__imma_m8n8k32_st_c_i32(p, (const int*)&a, ldm, 1);
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
//
|
| 552 |
+
// Store functions for frags of shape m8n8k128
|
| 553 |
+
//
|
| 554 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(int *p, const fragment<accumulator, 8, 8, 128, int>& a, unsigned ldm, layout_t layout) {
|
| 555 |
+
if (layout == mem_row_major)
|
| 556 |
+
__bmma_m8n8k128_st_c_i32(p, (const int*)&a, ldm, 0);
|
| 557 |
+
else
|
| 558 |
+
__bmma_m8n8k128_st_c_i32(p, (const int*)&a, ldm, 1);
|
| 559 |
+
}
|
| 560 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 561 |
+
|
| 562 |
+
|
| 563 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 564 |
+
|
| 565 |
+
//
|
| 566 |
+
// Store functions for frags of shape m16n16k8
|
| 567 |
+
//
|
| 568 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(float *p, const fragment<accumulator, 16, 16, 8, float>& a, unsigned ldm, layout_t layout) {
|
| 569 |
+
if (layout == mem_row_major)
|
| 570 |
+
__mma_m16n16k8_st_c_f32(p, (const float*)&a, ldm, 0);
|
| 571 |
+
else
|
| 572 |
+
__mma_m16n16k8_st_c_f32(p, (const float*)&a, ldm, 1);
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
|
| 576 |
+
//
|
| 577 |
+
// Store functions for frags of shape m8n8k4
|
| 578 |
+
//
|
| 579 |
+
__CUDA_MMA_DEVICE_DECL__ void store_matrix_sync(double *p, const fragment<accumulator, 8, 8, 4, double>& a, unsigned ldm, layout_t layout) {
|
| 580 |
+
if (layout == mem_row_major)
|
| 581 |
+
__dmma_m8n8k4_st_c_f64(p, (const double*)&a, ldm, 0);
|
| 582 |
+
else
|
| 583 |
+
__dmma_m8n8k4_st_c_f64(p, (const double*)&a, ldm, 1);
|
| 584 |
+
}
|
| 585 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 586 |
+
|
| 587 |
+
//
|
| 588 |
+
// MMA functions for shape m16n16k16
|
| 589 |
+
//
|
| 590 |
+
// D fp16, C fp16
|
| 591 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 592 |
+
__hmma_m16n16k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 1, 0);
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 596 |
+
__hmma_m16n16k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 3, 0);
|
| 597 |
+
}
|
| 598 |
+
|
| 599 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 600 |
+
__hmma_m16n16k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 0, 0);
|
| 601 |
+
}
|
| 602 |
+
|
| 603 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 604 |
+
__hmma_m16n16k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 2, 0);
|
| 605 |
+
}
|
| 606 |
+
|
| 607 |
+
// D fp32, C fp16
|
| 608 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 609 |
+
__hmma_m16n16k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 1, 0);
|
| 610 |
+
}
|
| 611 |
+
|
| 612 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 613 |
+
__hmma_m16n16k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 3, 0);
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 617 |
+
__hmma_m16n16k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 0, 0);
|
| 618 |
+
}
|
| 619 |
+
|
| 620 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, __half>& c) {
|
| 621 |
+
__hmma_m16n16k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 2, 0);
|
| 622 |
+
}
|
| 623 |
+
|
| 624 |
+
// D fp32, C fp32
|
| 625 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 626 |
+
__hmma_m16n16k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 627 |
+
}
|
| 628 |
+
|
| 629 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 630 |
+
__hmma_m16n16k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 631 |
+
}
|
| 632 |
+
|
| 633 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 634 |
+
__hmma_m16n16k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 635 |
+
}
|
| 636 |
+
|
| 637 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 638 |
+
__hmma_m16n16k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
// D fp16, C fp32
|
| 642 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 643 |
+
__hmma_m16n16k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 647 |
+
__hmma_m16n16k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 648 |
+
}
|
| 649 |
+
|
| 650 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, row_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 651 |
+
__hmma_m16n16k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 652 |
+
}
|
| 653 |
+
|
| 654 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, __half>& d, const fragment<matrix_a, 16, 16, 16, __half, col_major>& a, const fragment<matrix_b,16, 16, 16, __half, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 655 |
+
__hmma_m16n16k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
#ifdef __CUDA_IMMA__
|
| 659 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, row_major>& a, const fragment<matrix_b,16, 16, 16, signed char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 660 |
+
if (satf)
|
| 661 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 1, 1);
|
| 662 |
+
else
|
| 663 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 1, 0);
|
| 664 |
+
}
|
| 665 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, col_major>& a, const fragment<matrix_b,16, 16, 16, signed char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 666 |
+
if (satf)
|
| 667 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 3, 1);
|
| 668 |
+
else
|
| 669 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 3, 0);
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, row_major>& a, const fragment<matrix_b,16, 16, 16, signed char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 673 |
+
if (satf)
|
| 674 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 0, 1);
|
| 675 |
+
else
|
| 676 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 0, 0);
|
| 677 |
+
}
|
| 678 |
+
|
| 679 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, signed char, col_major>& a, const fragment<matrix_b,16, 16, 16, signed char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 680 |
+
if (satf)
|
| 681 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 2, 1);
|
| 682 |
+
else
|
| 683 |
+
__imma_m16n16k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 2, 0);
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, row_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 687 |
+
if (satf)
|
| 688 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 1, 1);
|
| 689 |
+
else
|
| 690 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 1, 0);
|
| 691 |
+
}
|
| 692 |
+
|
| 693 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, col_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, col_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 694 |
+
if (satf)
|
| 695 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 3, 1);
|
| 696 |
+
else
|
| 697 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 3, 0);
|
| 698 |
+
}
|
| 699 |
+
|
| 700 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, row_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 701 |
+
if (satf)
|
| 702 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 0, 1);
|
| 703 |
+
else
|
| 704 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 0, 0);
|
| 705 |
+
}
|
| 706 |
+
|
| 707 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, int>& d, const fragment<matrix_a, 16, 16, 16, unsigned char, col_major>& a, const fragment<matrix_b,16, 16, 16, unsigned char, row_major>& b, const fragment<accumulator,16, 16, 16, int>& c, bool satf) {
|
| 708 |
+
if (satf)
|
| 709 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 2, 1);
|
| 710 |
+
else
|
| 711 |
+
__imma_m16n16k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int *)&c, 2, 0);
|
| 712 |
+
}
|
| 713 |
+
#endif /* __CUDA_IMMA__ */
|
| 714 |
+
|
| 715 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 716 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 717 |
+
__mma_bf16_m16n16k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 718 |
+
}
|
| 719 |
+
|
| 720 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 721 |
+
__mma_bf16_m16n16k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 722 |
+
}
|
| 723 |
+
|
| 724 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 725 |
+
__mma_bf16_m16n16k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 726 |
+
}
|
| 727 |
+
|
| 728 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,16, 16, 16, float>& d, const fragment<matrix_a, 16, 16, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b,16, 16, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator,16, 16, 16, float>& c) {
|
| 729 |
+
__mma_bf16_m16n16k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 730 |
+
}
|
| 731 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 732 |
+
|
| 733 |
+
|
| 734 |
+
//
|
| 735 |
+
// MMA functions for shape m32n8k16
|
| 736 |
+
//
|
| 737 |
+
// D fp16, C fp16
|
| 738 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 739 |
+
__hmma_m32n8k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 1, 0);
|
| 740 |
+
}
|
| 741 |
+
|
| 742 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 743 |
+
__hmma_m32n8k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 3, 0);
|
| 744 |
+
}
|
| 745 |
+
|
| 746 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 747 |
+
__hmma_m32n8k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 0, 0);
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 751 |
+
__hmma_m32n8k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 2, 0);
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
// D fp32, C fp16
|
| 755 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 756 |
+
__hmma_m32n8k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 1, 0);
|
| 757 |
+
}
|
| 758 |
+
|
| 759 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 760 |
+
__hmma_m32n8k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 3, 0);
|
| 761 |
+
}
|
| 762 |
+
|
| 763 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 764 |
+
__hmma_m32n8k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 0, 0);
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, __half>& c) {
|
| 768 |
+
__hmma_m32n8k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 2, 0);
|
| 769 |
+
}
|
| 770 |
+
|
| 771 |
+
// D fp32, C fp32
|
| 772 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 773 |
+
__hmma_m32n8k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 774 |
+
}
|
| 775 |
+
|
| 776 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 777 |
+
__hmma_m32n8k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 778 |
+
}
|
| 779 |
+
|
| 780 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 781 |
+
__hmma_m32n8k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 785 |
+
__hmma_m32n8k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 786 |
+
}
|
| 787 |
+
|
| 788 |
+
// D fp16, C fp32
|
| 789 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 790 |
+
__hmma_m32n8k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 791 |
+
}
|
| 792 |
+
|
| 793 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, col_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 794 |
+
__hmma_m32n8k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, row_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 798 |
+
__hmma_m32n8k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 799 |
+
}
|
| 800 |
+
|
| 801 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,32, 8, 16, __half>& d, const fragment<matrix_a, 32, 8, 16, __half, col_major>& a, const fragment<matrix_b,32, 8, 16, __half, row_major>& b, const fragment<accumulator,32, 8, 16, float>& c) {
|
| 802 |
+
__hmma_m32n8k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 803 |
+
}
|
| 804 |
+
|
| 805 |
+
#ifdef __CUDA_IMMA__
|
| 806 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, row_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 807 |
+
if (satf)
|
| 808 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 1);
|
| 809 |
+
else
|
| 810 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 0);
|
| 811 |
+
}
|
| 812 |
+
|
| 813 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, col_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 814 |
+
if (satf)
|
| 815 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 1);
|
| 816 |
+
else
|
| 817 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 0);
|
| 818 |
+
}
|
| 819 |
+
|
| 820 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, row_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 821 |
+
if (satf)
|
| 822 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 1);
|
| 823 |
+
else
|
| 824 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 0);
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, signed char, col_major>& a, const fragment<matrix_b, 32, 8, 16, signed char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 828 |
+
if (satf)
|
| 829 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 1);
|
| 830 |
+
else
|
| 831 |
+
__imma_m32n8k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 0);
|
| 832 |
+
}
|
| 833 |
+
|
| 834 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, row_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 835 |
+
if (satf)
|
| 836 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 1);
|
| 837 |
+
else
|
| 838 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 0);
|
| 839 |
+
}
|
| 840 |
+
|
| 841 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, col_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, col_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 842 |
+
if (satf)
|
| 843 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 1);
|
| 844 |
+
else
|
| 845 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 0);
|
| 846 |
+
|
| 847 |
+
}
|
| 848 |
+
|
| 849 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, row_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 850 |
+
if (satf)
|
| 851 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 1);
|
| 852 |
+
else
|
| 853 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 0);
|
| 854 |
+
|
| 855 |
+
}
|
| 856 |
+
|
| 857 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, int>& d, const fragment<matrix_a, 32, 8, 16, unsigned char, col_major>& a, const fragment<matrix_b, 32, 8, 16, unsigned char, row_major>& b, const fragment<accumulator, 32, 8, 16, int>& c, bool satf) {
|
| 858 |
+
if (satf)
|
| 859 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 1);
|
| 860 |
+
else
|
| 861 |
+
__imma_m32n8k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 0);
|
| 862 |
+
|
| 863 |
+
}
|
| 864 |
+
#endif /* __CUDA_IMMA__ */
|
| 865 |
+
|
| 866 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 867 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) {
|
| 868 |
+
__mma_bf16_m32n8k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 869 |
+
}
|
| 870 |
+
|
| 871 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) {
|
| 872 |
+
__mma_bf16_m32n8k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) {
|
| 876 |
+
__mma_bf16_m32n8k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 877 |
+
}
|
| 878 |
+
|
| 879 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 32, 8, 16, float>& d, const fragment<matrix_a, 32, 8, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 32, 8, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 32, 8, 16, float>& c) {
|
| 880 |
+
__mma_bf16_m32n8k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 881 |
+
}
|
| 882 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 883 |
+
|
| 884 |
+
//
|
| 885 |
+
// MMA functions for shape m8n32k16
|
| 886 |
+
//
|
| 887 |
+
// D fp16, C fp16
|
| 888 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 889 |
+
__hmma_m8n32k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 1, 0);
|
| 890 |
+
}
|
| 891 |
+
|
| 892 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 893 |
+
__hmma_m8n32k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 3, 0);
|
| 894 |
+
}
|
| 895 |
+
|
| 896 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 897 |
+
__hmma_m8n32k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 0, 0);
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 901 |
+
__hmma_m8n32k16_mma_f16f16((int*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 2, 0);
|
| 902 |
+
}
|
| 903 |
+
|
| 904 |
+
// D fp32, C fp16
|
| 905 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 906 |
+
__hmma_m8n32k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 1, 0);
|
| 907 |
+
}
|
| 908 |
+
|
| 909 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 910 |
+
__hmma_m8n32k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 3, 0);
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 914 |
+
__hmma_m8n32k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 0, 0);
|
| 915 |
+
}
|
| 916 |
+
|
| 917 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, __half>& c) {
|
| 918 |
+
__hmma_m8n32k16_mma_f32f16((float*)&d, (const int*)&a, (const int*)&b, (const int*)&c, 2, 0);
|
| 919 |
+
}
|
| 920 |
+
|
| 921 |
+
// D fp32, C fp32
|
| 922 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 923 |
+
__hmma_m8n32k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 924 |
+
}
|
| 925 |
+
|
| 926 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 927 |
+
__hmma_m8n32k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 931 |
+
__hmma_m8n32k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 935 |
+
__hmma_m8n32k16_mma_f32f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 936 |
+
}
|
| 937 |
+
|
| 938 |
+
// D fp16, C fp32
|
| 939 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 940 |
+
__hmma_m8n32k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 941 |
+
}
|
| 942 |
+
|
| 943 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, col_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 944 |
+
__hmma_m8n32k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 945 |
+
}
|
| 946 |
+
|
| 947 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, row_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 948 |
+
__hmma_m8n32k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 949 |
+
}
|
| 950 |
+
|
| 951 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator,8, 32, 16, __half>& d, const fragment<matrix_a, 8, 32, 16, __half, col_major>& a, const fragment<matrix_b,8, 32, 16, __half, row_major>& b, const fragment<accumulator,8, 32, 16, float>& c) {
|
| 952 |
+
__hmma_m8n32k16_mma_f16f32((int*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 953 |
+
}
|
| 954 |
+
|
| 955 |
+
#ifdef __CUDA_IMMA__
|
| 956 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, row_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 957 |
+
if (satf)
|
| 958 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 1);
|
| 959 |
+
else
|
| 960 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 0);
|
| 961 |
+
}
|
| 962 |
+
|
| 963 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, col_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 964 |
+
if (satf)
|
| 965 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 1);
|
| 966 |
+
else
|
| 967 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 0);
|
| 968 |
+
}
|
| 969 |
+
|
| 970 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, row_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 971 |
+
if (satf)
|
| 972 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 1);
|
| 973 |
+
else
|
| 974 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 0);
|
| 975 |
+
}
|
| 976 |
+
|
| 977 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, signed char, col_major>& a, const fragment<matrix_b, 8, 32, 16, signed char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 978 |
+
if (satf)
|
| 979 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 1);
|
| 980 |
+
else
|
| 981 |
+
__imma_m8n32k16_mma_s8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 0);
|
| 982 |
+
}
|
| 983 |
+
|
| 984 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, row_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 985 |
+
if (satf)
|
| 986 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 1);
|
| 987 |
+
else
|
| 988 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 0);
|
| 989 |
+
}
|
| 990 |
+
|
| 991 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, col_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, col_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 992 |
+
if (satf)
|
| 993 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 1);
|
| 994 |
+
else
|
| 995 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 3, 0);
|
| 996 |
+
}
|
| 997 |
+
|
| 998 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, row_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 999 |
+
if (satf)
|
| 1000 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 1);
|
| 1001 |
+
else
|
| 1002 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 0, 0);
|
| 1003 |
+
}
|
| 1004 |
+
|
| 1005 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, int>& d, const fragment<matrix_a, 8, 32, 16, unsigned char, col_major>& a, const fragment<matrix_b, 8, 32, 16, unsigned char, row_major>& b, const fragment<accumulator, 8, 32, 16, int>& c, bool satf) {
|
| 1006 |
+
if (satf)
|
| 1007 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 1);
|
| 1008 |
+
else
|
| 1009 |
+
__imma_m8n32k16_mma_u8((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 2, 0);
|
| 1010 |
+
}
|
| 1011 |
+
#endif /* __CUDA_IMMA__ */
|
| 1012 |
+
|
| 1013 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 1014 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) {
|
| 1015 |
+
__mma_bf16_m8n32k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 1016 |
+
}
|
| 1017 |
+
|
| 1018 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, col_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) {
|
| 1019 |
+
__mma_bf16_m8n32k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 1020 |
+
}
|
| 1021 |
+
|
| 1022 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, row_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) {
|
| 1023 |
+
__mma_bf16_m8n32k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 1024 |
+
}
|
| 1025 |
+
|
| 1026 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 32, 16, float>& d, const fragment<matrix_a, 8, 32, 16, __nv_bfloat16, col_major>& a, const fragment<matrix_b, 8, 32, 16, __nv_bfloat16, row_major>& b, const fragment<accumulator, 8, 32, 16, float>& c) {
|
| 1027 |
+
__mma_bf16_m8n32k16_mma_f32((float*)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 1028 |
+
}
|
| 1029 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 1030 |
+
|
| 1031 |
+
|
| 1032 |
+
#ifdef __CUDA_SUBBYTE_IMMA__
|
| 1033 |
+
//
|
| 1034 |
+
// MMA functions for shape m8n8k32
|
| 1035 |
+
//
|
| 1036 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 32, int>& d, const fragment<matrix_a, 8, 8, 32, experimental::precision::s4, row_major>& a, const fragment<matrix_b, 8, 8, 32, experimental::precision::s4, col_major>& b, const fragment<accumulator, 8, 8, 32, int>& c, bool satf) {
|
| 1037 |
+
if (satf)
|
| 1038 |
+
__imma_m8n8k32_mma_s4((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 1);
|
| 1039 |
+
else
|
| 1040 |
+
__imma_m8n8k32_mma_s4((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 0);
|
| 1041 |
+
}
|
| 1042 |
+
|
| 1043 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 32, int>& d, const fragment<matrix_a, 8, 8, 32, experimental::precision::u4, row_major>& a, const fragment<matrix_b, 8, 8, 32, experimental::precision::u4, col_major>& b, const fragment<accumulator, 8, 8, 32, int>& c, bool satf) {
|
| 1044 |
+
if (satf)
|
| 1045 |
+
__imma_m8n8k32_mma_u4((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 1);
|
| 1046 |
+
else
|
| 1047 |
+
__imma_m8n8k32_mma_u4((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1, 0);
|
| 1048 |
+
}
|
| 1049 |
+
|
| 1050 |
+
//
|
| 1051 |
+
// MMA functions for shape m8n8k128
|
| 1052 |
+
//
|
| 1053 |
+
__CUDA_MMA_DEVICE_DECL__ void bmma_sync(fragment<accumulator, 8, 8, 128, int>& d, const fragment<matrix_a, 8, 8, 128, experimental::precision::b1, row_major>& a, const fragment<matrix_b, 8, 8, 128, experimental::precision::b1, col_major>& b, const fragment<accumulator, 8, 8, 128, int>& c,
|
| 1054 |
+
experimental::bmmaBitOp op, experimental::bmmaAccumulateOp)
|
| 1055 |
+
{
|
| 1056 |
+
|
| 1057 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 1058 |
+
if (op == experimental::bmmaBitOpAND)
|
| 1059 |
+
__bmma_m8n8k128_mma_and_popc_b1((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1);
|
| 1060 |
+
else
|
| 1061 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 1062 |
+
__bmma_m8n8k128_mma_xor_popc_b1((int*)&d, (const int *)&a, (const int *)&b, (const int*)&c, 1);
|
| 1063 |
+
}
|
| 1064 |
+
|
| 1065 |
+
|
| 1066 |
+
#endif /* __CUDA_SUBBYTE_IMMA__ */
|
| 1067 |
+
|
| 1068 |
+
#ifdef __CUDA_AMPERE_MMA__
|
| 1069 |
+
//
|
| 1070 |
+
// MMA functions for shape m16n16k8
|
| 1071 |
+
//
|
| 1072 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, row_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, col_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) {
|
| 1073 |
+
__mma_tf32_m16n16k8_mma_f32((float *)&d, (const int*)&a, (const int*)&b, (const float*)&c, 1, 0);
|
| 1074 |
+
}
|
| 1075 |
+
|
| 1076 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, col_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, col_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) {
|
| 1077 |
+
__mma_tf32_m16n16k8_mma_f32((float *)&d, (const int*)&a, (const int*)&b, (const float*)&c, 3, 0);
|
| 1078 |
+
}
|
| 1079 |
+
|
| 1080 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, row_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, row_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) {
|
| 1081 |
+
__mma_tf32_m16n16k8_mma_f32((float *)&d, (const int*)&a, (const int*)&b, (const float*)&c, 0, 0);
|
| 1082 |
+
}
|
| 1083 |
+
|
| 1084 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 16, 16, 8, float>& d, const fragment<matrix_a, 16, 16, 8, precision::tf32, col_major>& a, const fragment<matrix_b, 16, 16, 8, precision::tf32, row_major>& b, const fragment<accumulator, 16, 16, 8, float>& c) {
|
| 1085 |
+
__mma_tf32_m16n16k8_mma_f32((float *)&d, (const int*)&a, (const int*)&b, (const float*)&c, 2, 0);
|
| 1086 |
+
}
|
| 1087 |
+
|
| 1088 |
+
|
| 1089 |
+
//
|
| 1090 |
+
// MMA functions for shape m8n8k4
|
| 1091 |
+
//
|
| 1092 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, row_major>& a, const fragment<matrix_b, 8, 8, 4, double, col_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) {
|
| 1093 |
+
__dmma_m8n8k4_mma_f64((double *)&d, (const double*)&a, (const double*)&b, (const double*)&c, 1, 0);
|
| 1094 |
+
}
|
| 1095 |
+
|
| 1096 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, col_major>& a, const fragment<matrix_b, 8, 8, 4, double, col_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) {
|
| 1097 |
+
__dmma_m8n8k4_mma_f64((double *)&d, (const double*)&a, (const double*)&b, (const double*)&c, 3, 0);
|
| 1098 |
+
}
|
| 1099 |
+
|
| 1100 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, row_major>& a, const fragment<matrix_b, 8, 8, 4, double, row_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) {
|
| 1101 |
+
__dmma_m8n8k4_mma_f64((double *)&d, (const double*)&a, (const double*)&b, (const double*)&c, 0, 0);
|
| 1102 |
+
}
|
| 1103 |
+
|
| 1104 |
+
__CUDA_MMA_DEVICE_DECL__ void mma_sync(fragment<accumulator, 8, 8, 4, double>& d, const fragment<matrix_a, 8, 8, 4, double, col_major>& a, const fragment<matrix_b, 8, 8, 4, double, row_major>& b, const fragment<accumulator, 8, 8, 4, double>& c) {
|
| 1105 |
+
__dmma_m8n8k4_mma_f64((double *)&d, (const double*)&a, (const double*)&b, (const double*)&c, 2, 0);
|
| 1106 |
+
}
|
| 1107 |
+
|
| 1108 |
+
#endif /* __CUDA_AMPERE_MMA__ */
|
| 1109 |
+
|
| 1110 |
+
};
|
| 1111 |
+
};
|
| 1112 |
+
|
| 1113 |
+
#undef __CUDA_IMMA__
|
| 1114 |
+
#undef __CUDA_SUBBYTE_IMMA__
|
| 1115 |
+
#undef __CUDA_MMA_DEVICE_DECL__
|
| 1116 |
+
#undef __CUDA_AMPERE_MMA__
|
| 1117 |
+
|
| 1118 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 700 */
|
| 1119 |
+
|
| 1120 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 1121 |
+
|
| 1122 |
+
|
| 1123 |
+
#endif /* __CUDA_MMA_HPP__ */
|
| 1124 |
+
|
| 1125 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_MMA_HPP__)
|
| 1126 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 1127 |
+
#undef __UNDEF_CUDA_INCLUDE_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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* NVIDIA_COPYRIGHT_BEGIN
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
* NVIDIA CORPORATION and its licensors retain all intellectual property
|
| 7 |
+
* and proprietary rights in and to this software, related documentation
|
| 8 |
+
* and any modifications thereto. Any use, reproduction, disclosure or
|
| 9 |
+
* distribution of this software and related documentation without an express
|
| 10 |
+
* license agreement from NVIDIA CORPORATION is strictly prohibited.
|
| 11 |
+
*
|
| 12 |
+
* NVIDIA_COPYRIGHT_END
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 16 |
+
#if defined(_MSC_VER)
|
| 17 |
+
#pragma message("crt/nvfunctional is an internal header file and must not be used directly. Please use nvfunctional instead.")
|
| 18 |
+
#else
|
| 19 |
+
#warning "crt/nvfunctional is an internal header file and must not be used directly. Please use nvfunctional instead."
|
| 20 |
+
#endif
|
| 21 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 22 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_NV_LIBCXX_FUNCTIONAL_H__
|
| 23 |
+
#endif
|
| 24 |
+
|
| 25 |
+
#ifndef __NV_LIBCXX_FUNCTIONAL_H__
|
| 26 |
+
#define __NV_LIBCXX_FUNCTIONAL_H__
|
| 27 |
+
|
| 28 |
+
#if __cplusplus < 201103L
|
| 29 |
+
#if defined(_MSC_VER)
|
| 30 |
+
#if _MSC_VER < 1800
|
| 31 |
+
#error This library requires VS 2013 and above
|
| 32 |
+
#endif /* _MSC_VER < 1800 */
|
| 33 |
+
#else /* !_MSC_VER */
|
| 34 |
+
#error This library requires support for the ISO C++ 2011 standard
|
| 35 |
+
#endif /* _MSC_VER */
|
| 36 |
+
#endif /* __cplusplus */
|
| 37 |
+
|
| 38 |
+
#if defined(_MSC_VER)
|
| 39 |
+
#define __NV_ALIGNOF __alignof
|
| 40 |
+
#define __NV_NOEXCEPT
|
| 41 |
+
#define __NV_CONSTEXPR
|
| 42 |
+
#else /* !_MSC_VER */
|
| 43 |
+
#define __NV_ALIGNOF alignof
|
| 44 |
+
#define __NV_NOEXCEPT noexcept
|
| 45 |
+
#define __NV_CONSTEXPR constexpr
|
| 46 |
+
#endif /* _MSC_VER */
|
| 47 |
+
|
| 48 |
+
#include <type_traits>
|
| 49 |
+
#include <cstddef>
|
| 50 |
+
#include <new>
|
| 51 |
+
|
| 52 |
+
// n3290 20.8
|
| 53 |
+
namespace nvstd
|
| 54 |
+
{
|
| 55 |
+
|
| 56 |
+
namespace internal {
|
| 57 |
+
|
| 58 |
+
// D.8.1 base (deprecated) [depr.base]
|
| 59 |
+
template <class _Arg, class _Result>
|
| 60 |
+
struct unary_function
|
| 61 |
+
{
|
| 62 |
+
typedef _Arg argument_type;
|
| 63 |
+
typedef _Result result_type;
|
| 64 |
+
};
|
| 65 |
+
|
| 66 |
+
template <class _Arg1, class _Arg2, class _Result>
|
| 67 |
+
struct binary_function
|
| 68 |
+
{
|
| 69 |
+
typedef _Arg1 first_argument_type;
|
| 70 |
+
typedef _Arg2 second_argument_type;
|
| 71 |
+
typedef _Result result_type;
|
| 72 |
+
};
|
| 73 |
+
|
| 74 |
+
// move
|
| 75 |
+
template <class _T>
|
| 76 |
+
inline __device__ __host__
|
| 77 |
+
typename std::remove_reference<_T>::type&& move(_T&& __t) __NV_NOEXCEPT
|
| 78 |
+
{
|
| 79 |
+
return static_cast<typename std::remove_reference<_T>::type&&>(__t);
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// 20.2.2 swap [utility.swap]
|
| 83 |
+
// swap
|
| 84 |
+
template<class _T,
|
| 85 |
+
class = typename std::enable_if<
|
| 86 |
+
std::is_move_constructible<_T>::value &&
|
| 87 |
+
std::is_move_assignable<_T>::value>::type>
|
| 88 |
+
inline __device__ __host__
|
| 89 |
+
void swap(_T& __a, _T& __b)
|
| 90 |
+
#if !defined(_MSC_VER)
|
| 91 |
+
noexcept(std::is_nothrow_move_constructible<_T>::value &&
|
| 92 |
+
std::is_nothrow_move_assignable<_T>::value)
|
| 93 |
+
#endif /* !defined(_MSC_VER) */
|
| 94 |
+
{
|
| 95 |
+
_T __t(internal::move(__a));
|
| 96 |
+
__a = internal::move(__b);
|
| 97 |
+
__b = internal::move(__t);
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// 20.2.3 forward/move helpers [forward]
|
| 101 |
+
// forward
|
| 102 |
+
template <class _T>
|
| 103 |
+
inline __device__ __host__
|
| 104 |
+
_T&& forward(typename std::remove_reference<_T>::type& __t) __NV_NOEXCEPT
|
| 105 |
+
{
|
| 106 |
+
return static_cast<_T&&>(__t);
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
template <class _T>
|
| 110 |
+
inline __device__ __host__
|
| 111 |
+
_T&& forward(typename std::remove_reference<_T>::type&& __t) __NV_NOEXCEPT
|
| 112 |
+
{
|
| 113 |
+
static_assert(!std::is_lvalue_reference<_T>::value,
|
| 114 |
+
"Error: __t is instantiated with an lvalue reference type");
|
| 115 |
+
return static_cast<_T&&>(__t);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
} // namespace internal
|
| 119 |
+
|
| 120 |
+
namespace __functional_helpers
|
| 121 |
+
{
|
| 122 |
+
|
| 123 |
+
struct __dummy_class;
|
| 124 |
+
|
| 125 |
+
// Store small functors locally:
|
| 126 |
+
// a functor is legitimate to local storage if it is one of the following types:
|
| 127 |
+
// * member object pointer;
|
| 128 |
+
// * member function pointer;
|
| 129 |
+
// * closure type of size less than or equal to the largest size of
|
| 130 |
+
// the above types;
|
| 131 |
+
// * function pointer;
|
| 132 |
+
// * any callable class whose size is less than or equal to
|
| 133 |
+
// the largest one of the above types;
|
| 134 |
+
union _Small_functor_types
|
| 135 |
+
{
|
| 136 |
+
void *__obj;
|
| 137 |
+
void (*__func_ptr)();
|
| 138 |
+
void (__dummy_class::*mem_fn_ptr)();
|
| 139 |
+
};
|
| 140 |
+
|
| 141 |
+
struct _Small_functor_data {
|
| 142 |
+
char __data[sizeof(_Small_functor_types)];
|
| 143 |
+
};
|
| 144 |
+
|
| 145 |
+
template <class _RetType, class ..._ArgTypes>
|
| 146 |
+
struct __maybe_base_function
|
| 147 |
+
{ };
|
| 148 |
+
|
| 149 |
+
template <class _RetType, class _T1>
|
| 150 |
+
struct __maybe_base_function<_RetType(_T1)>
|
| 151 |
+
: public internal::unary_function<_T1, _RetType>
|
| 152 |
+
{ };
|
| 153 |
+
|
| 154 |
+
template <class _RetType, class _T1, class _T2>
|
| 155 |
+
struct __maybe_base_function<_RetType(_T1, _T2)>
|
| 156 |
+
: public internal::binary_function<_T1, _T2, _RetType>
|
| 157 |
+
{ };
|
| 158 |
+
|
| 159 |
+
} // namespace __functional_helpers
|
| 160 |
+
|
| 161 |
+
// 20.8.11 Polymorphic function wrappers [func.wrap]
|
| 162 |
+
|
| 163 |
+
// 20.8.11.1 Class bad_function_call [func.wrap.badcall]
|
| 164 |
+
// unimplemented because of exception
|
| 165 |
+
// class bad_function_call : public std::exception
|
| 166 |
+
|
| 167 |
+
// 20.8.11.2 Class template function [func.wrap.func]
|
| 168 |
+
|
| 169 |
+
template<class> class function; // undefined
|
| 170 |
+
|
| 171 |
+
// Simplified version of template class function, which
|
| 172 |
+
// * does not support allocator_arg_t;
|
| 173 |
+
// * does not support target and target_type that rely on RTTI
|
| 174 |
+
// * does not throw bad_function_call exception on invoking a NULL target
|
| 175 |
+
template <class _RetType, class ..._ArgTypes>
|
| 176 |
+
class function<_RetType(_ArgTypes...)>
|
| 177 |
+
: public __functional_helpers::__maybe_base_function<_RetType(_ArgTypes...)>
|
| 178 |
+
{
|
| 179 |
+
__functional_helpers::_Small_functor_data __small_functor_data;
|
| 180 |
+
void *__obj;
|
| 181 |
+
typedef _RetType(*__meta_fn_type)(void *, _ArgTypes...);
|
| 182 |
+
__meta_fn_type __meta_fn;
|
| 183 |
+
typedef void(*__cloner_type)(function &, const function &);
|
| 184 |
+
__cloner_type __cloner;
|
| 185 |
+
typedef void(*__destructor_type)(function *);
|
| 186 |
+
__destructor_type __destructor;
|
| 187 |
+
|
| 188 |
+
#pragma nv_exec_check_disable
|
| 189 |
+
template <class _F>
|
| 190 |
+
__device__ __host__
|
| 191 |
+
__NV_CONSTEXPR bool __use_small_functor_data() const
|
| 192 |
+
{
|
| 193 |
+
return (sizeof(_F) <= sizeof(__small_functor_data) &&
|
| 194 |
+
__NV_ALIGNOF(_F) <= __NV_ALIGNOF(
|
| 195 |
+
__functional_helpers::_Small_functor_types));
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
#pragma nv_exec_check_disable
|
| 199 |
+
__device__ __host__
|
| 200 |
+
void* __get_small_functor_data() const
|
| 201 |
+
{
|
| 202 |
+
return (void*)(&__small_functor_data.__data[0]);
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
#pragma nv_exec_check_disable
|
| 206 |
+
__device__ __host__
|
| 207 |
+
bool __is_small_functor_data() const
|
| 208 |
+
{
|
| 209 |
+
return __obj == __get_small_functor_data();
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
#pragma nv_exec_check_disable
|
| 213 |
+
template <class _F>
|
| 214 |
+
__device__ __host__
|
| 215 |
+
static _F& __get_functor(void *__p)
|
| 216 |
+
{
|
| 217 |
+
return *((_F*)__p);
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
#pragma nv_exec_check_disable
|
| 221 |
+
template <class _F>
|
| 222 |
+
__device__ __host__
|
| 223 |
+
static bool __is_empty_functor(const _F& /*__p*/)
|
| 224 |
+
{
|
| 225 |
+
return false;
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
#pragma nv_exec_check_disable
|
| 229 |
+
template <class _F>
|
| 230 |
+
__device__ __host__
|
| 231 |
+
static bool __is_empty_functor(const _F* __p)
|
| 232 |
+
{
|
| 233 |
+
return !__p;
|
| 234 |
+
}
|
| 235 |
+
|
| 236 |
+
#pragma nv_exec_check_disable
|
| 237 |
+
template <class _Res, class _C>
|
| 238 |
+
__device__ __host__
|
| 239 |
+
static bool __is_empty_functor(const _Res _C::* __p)
|
| 240 |
+
{
|
| 241 |
+
return !__p;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
#pragma nv_exec_check_disable
|
| 245 |
+
template <class _Res, class... _Args>
|
| 246 |
+
__device__ __host__
|
| 247 |
+
static bool __is_empty_functor(const function<_Res(_Args...)>& __p)
|
| 248 |
+
{
|
| 249 |
+
return !__p;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
template <class _F>
|
| 253 |
+
struct __make_cloner
|
| 254 |
+
{
|
| 255 |
+
#pragma nv_exec_check_disable
|
| 256 |
+
__device__ __host__
|
| 257 |
+
static void __clone_data(function &__dest, const function &__src)
|
| 258 |
+
{
|
| 259 |
+
if (__dest.__use_small_functor_data<_F>()) {
|
| 260 |
+
__dest.__obj = __dest.__get_small_functor_data();
|
| 261 |
+
new (__dest.__obj) _F(__src.__get_functor<_F>(__src.__obj));
|
| 262 |
+
}
|
| 263 |
+
else {
|
| 264 |
+
__dest.__obj = new _F(__src.__get_functor<_F>(__src.__obj));
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
};
|
| 268 |
+
|
| 269 |
+
template <class _F>
|
| 270 |
+
struct __make_destructor
|
| 271 |
+
{
|
| 272 |
+
#pragma nv_exec_check_disable
|
| 273 |
+
__device__ __host__
|
| 274 |
+
static void __destruct(function *__fn)
|
| 275 |
+
{
|
| 276 |
+
if (__fn->__use_small_functor_data<_F>()) {
|
| 277 |
+
(__fn->__get_functor<_F>(__fn->__obj)).~_F();
|
| 278 |
+
}
|
| 279 |
+
else {
|
| 280 |
+
delete (_F*)(__fn->__obj);
|
| 281 |
+
}
|
| 282 |
+
}
|
| 283 |
+
};
|
| 284 |
+
|
| 285 |
+
// We cannot simple define __make_functor in the following way:
|
| 286 |
+
// template <class _T, _F>
|
| 287 |
+
// __make_functor;
|
| 288 |
+
// template <class _RetType1, class _F, class... _ArgTypes1>
|
| 289 |
+
// struct __make_functor<_RetType1(_ArgTypes1...), _F>
|
| 290 |
+
//
|
| 291 |
+
// because VS 2013 cannot unpack _RetType1(_ArgTypes1...)
|
| 292 |
+
template <class _RetType1, class _F, class... _ArgTypes1>
|
| 293 |
+
struct __make_functor
|
| 294 |
+
{
|
| 295 |
+
typedef _RetType1 type;
|
| 296 |
+
|
| 297 |
+
#pragma nv_exec_check_disable
|
| 298 |
+
__device__ __host__
|
| 299 |
+
static _RetType1 __invoke(void *__d, _ArgTypes1... __args)
|
| 300 |
+
{
|
| 301 |
+
return __get_functor<_F>(__d)(
|
| 302 |
+
internal::forward<_ArgTypes1>(__args)...);
|
| 303 |
+
}
|
| 304 |
+
};
|
| 305 |
+
|
| 306 |
+
template <class _RetType1, class _C, class _M, class... _ArgTypes1>
|
| 307 |
+
struct __make_functor<_RetType1, _M _C::*,_ArgTypes1...>
|
| 308 |
+
{
|
| 309 |
+
typedef _RetType1 type;
|
| 310 |
+
typedef _RetType1(*_Fn)(_ArgTypes1...);
|
| 311 |
+
|
| 312 |
+
#pragma nv_exec_check_disable
|
| 313 |
+
__device__ __host__
|
| 314 |
+
static _RetType1 __invoke(void *__d, _ArgTypes1... __args)
|
| 315 |
+
{
|
| 316 |
+
return __get_functor<_Fn>(__d)(
|
| 317 |
+
internal::forward<_ArgTypes1>(__args)...);
|
| 318 |
+
}
|
| 319 |
+
};
|
| 320 |
+
|
| 321 |
+
// workaround for GCC version below 4.8
|
| 322 |
+
#if (__GNUC__ == 4) && (__GNUC_MINOR__ < 8)
|
| 323 |
+
template <class _F>
|
| 324 |
+
struct __check_callability
|
| 325 |
+
: public std::integral_constant<bool,
|
| 326 |
+
!std::is_same<_F, std::nullptr_t>::value>
|
| 327 |
+
{ };
|
| 328 |
+
#elif defined(_MSC_VER)
|
| 329 |
+
// simulate VC 2013's behavior...
|
| 330 |
+
template <class _F>
|
| 331 |
+
struct __check_callability1
|
| 332 |
+
: public
|
| 333 |
+
std::integral_constant<bool,
|
| 334 |
+
// std::result_of does not handle member pointers well
|
| 335 |
+
std::is_member_pointer<_F>::value ||
|
| 336 |
+
std::is_convertible<
|
| 337 |
+
_RetType,
|
| 338 |
+
typename std::result_of<_F(_ArgTypes...)>::type
|
| 339 |
+
>::value
|
| 340 |
+
>
|
| 341 |
+
{ };
|
| 342 |
+
|
| 343 |
+
template <class _F>
|
| 344 |
+
struct __check_callability
|
| 345 |
+
: public std::integral_constant<
|
| 346 |
+
bool,
|
| 347 |
+
!std::is_same<_F, function>::value &&
|
| 348 |
+
__check_callability1<typename std::remove_cv<_F>::type>::value>
|
| 349 |
+
{ };
|
| 350 |
+
#else /* !((__GNUC__ == 4) && (__GNUC_MINOR__ < 8)) _MSC_VER */
|
| 351 |
+
template <class _F,
|
| 352 |
+
class _T = typename std::result_of<_F(_ArgTypes...)>::type>
|
| 353 |
+
struct __check_callability
|
| 354 |
+
: public std::integral_constant<
|
| 355 |
+
bool,
|
| 356 |
+
!std::is_same<_F, function>::value &&
|
| 357 |
+
std::is_convertible< _T, _RetType>::value>
|
| 358 |
+
{ };
|
| 359 |
+
#endif /* __GNUC__ == 4) && (__GNUC_MINOR__ < 8) */
|
| 360 |
+
|
| 361 |
+
#pragma nv_exec_check_disable
|
| 362 |
+
__device__ __host__
|
| 363 |
+
void __destroy()
|
| 364 |
+
{
|
| 365 |
+
if (__obj) {
|
| 366 |
+
__destructor(this);
|
| 367 |
+
__obj = 0;
|
| 368 |
+
}
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
#pragma nv_exec_check_disable
|
| 372 |
+
__device__ __host__
|
| 373 |
+
void __clear()
|
| 374 |
+
{
|
| 375 |
+
__obj = 0;
|
| 376 |
+
__meta_fn = 0;
|
| 377 |
+
__cloner = 0;
|
| 378 |
+
__destructor = 0;
|
| 379 |
+
}
|
| 380 |
+
|
| 381 |
+
public:
|
| 382 |
+
typedef _RetType result_type;
|
| 383 |
+
|
| 384 |
+
/*
|
| 385 |
+
* These typedef(s) are derived from __maybe_base_function
|
| 386 |
+
* typedef T1 argument_type; // only if sizeof...(ArgTypes) == 1 and
|
| 387 |
+
* // the type in ArgTypes is T1
|
| 388 |
+
* typedef T1 first_argument_type; // only if sizeof...(ArgTypes) == 2 and
|
| 389 |
+
* // ArgTypes contains T1 and T2
|
| 390 |
+
* typedef T2 second_argument_type; // only if sizeof...(ArgTypes) == 2 and
|
| 391 |
+
* // ArgTypes contains T1 and T2
|
| 392 |
+
*/
|
| 393 |
+
|
| 394 |
+
// 20.8.11.2.1 construct/copy/destroy [func.wrap.con]
|
| 395 |
+
|
| 396 |
+
#pragma nv_exec_check_disable
|
| 397 |
+
__device__ __host__
|
| 398 |
+
function() __NV_NOEXCEPT
|
| 399 |
+
: __obj(0), __meta_fn(0), __cloner(0), __destructor(0) {}
|
| 400 |
+
|
| 401 |
+
#pragma nv_exec_check_disable
|
| 402 |
+
__device__ __host__
|
| 403 |
+
function(std::nullptr_t) __NV_NOEXCEPT
|
| 404 |
+
: __obj(0), __meta_fn(0), __cloner(0), __destructor(0) {}
|
| 405 |
+
|
| 406 |
+
#pragma nv_exec_check_disable
|
| 407 |
+
__device__ __host__
|
| 408 |
+
function(const function &__fn)
|
| 409 |
+
{
|
| 410 |
+
if (__fn.__obj == 0) {
|
| 411 |
+
__clear();
|
| 412 |
+
}
|
| 413 |
+
else {
|
| 414 |
+
__meta_fn = __fn.__meta_fn;
|
| 415 |
+
__destructor = __fn.__destructor;
|
| 416 |
+
__fn.__cloner(*this, __fn);
|
| 417 |
+
__cloner = __fn.__cloner;
|
| 418 |
+
}
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
#pragma nv_exec_check_disable
|
| 422 |
+
__device__ __host__
|
| 423 |
+
function(function &&__fn)
|
| 424 |
+
{
|
| 425 |
+
__fn.swap(*this);
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
// VS 2013 cannot process __check_callability type trait.
|
| 429 |
+
// So, we check callability using static_assert instead of
|
| 430 |
+
// using SFINAE such as
|
| 431 |
+
// template<class _F,
|
| 432 |
+
// class = typename std::enable_if<
|
| 433 |
+
// __check_callability<_F>::value
|
| 434 |
+
// >::type>
|
| 435 |
+
|
| 436 |
+
#pragma nv_exec_check_disable
|
| 437 |
+
template<class _F>
|
| 438 |
+
__device__ __host__
|
| 439 |
+
function(_F);
|
| 440 |
+
|
| 441 |
+
// copy and swap
|
| 442 |
+
#pragma nv_exec_check_disable
|
| 443 |
+
__device__ __host__
|
| 444 |
+
function& operator=(const function& __fn)
|
| 445 |
+
{
|
| 446 |
+
function(__fn).swap(*this);
|
| 447 |
+
return *this;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
#pragma nv_exec_check_disable
|
| 451 |
+
__device__ __host__
|
| 452 |
+
function& operator=(function&& __fn)
|
| 453 |
+
{
|
| 454 |
+
function(internal::move(__fn)).swap(*this);
|
| 455 |
+
return *this;
|
| 456 |
+
}
|
| 457 |
+
|
| 458 |
+
#pragma nv_exec_check_disable
|
| 459 |
+
__device__ __host__
|
| 460 |
+
function& operator=(std::nullptr_t)
|
| 461 |
+
{
|
| 462 |
+
__destroy();
|
| 463 |
+
return *this;
|
| 464 |
+
}
|
| 465 |
+
|
| 466 |
+
#pragma nv_exec_check_disable
|
| 467 |
+
template<class _F>
|
| 468 |
+
__device__ __host__
|
| 469 |
+
function&
|
| 470 |
+
operator=(_F&& __fn)
|
| 471 |
+
{
|
| 472 |
+
static_assert(__check_callability<_F>::value,
|
| 473 |
+
"Unable to create functor object!");
|
| 474 |
+
function(internal::forward<_F>(__fn)).swap(*this);
|
| 475 |
+
return *this;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
#pragma nv_exec_check_disable
|
| 479 |
+
__device__ __host__
|
| 480 |
+
~function()
|
| 481 |
+
{
|
| 482 |
+
__destroy();
|
| 483 |
+
}
|
| 484 |
+
|
| 485 |
+
// 20.8.11.2.2 function modifiers [func.wrap.func.mod]
|
| 486 |
+
#pragma nv_exec_check_disable
|
| 487 |
+
__device__ __host__
|
| 488 |
+
void swap(function& __fn) __NV_NOEXCEPT
|
| 489 |
+
{
|
| 490 |
+
internal::swap(__meta_fn, __fn.__meta_fn);
|
| 491 |
+
internal::swap(__cloner, __fn.__cloner);
|
| 492 |
+
internal::swap(__destructor, __fn.__destructor);
|
| 493 |
+
|
| 494 |
+
if (__is_small_functor_data() && __fn.__is_small_functor_data()) {
|
| 495 |
+
internal::swap(__small_functor_data, __fn.__small_functor_data);
|
| 496 |
+
}
|
| 497 |
+
else if (__is_small_functor_data()) {
|
| 498 |
+
internal::swap(__small_functor_data, __fn.__small_functor_data);
|
| 499 |
+
internal::swap(__obj, __fn.__obj);
|
| 500 |
+
__fn.__obj = __fn.__get_small_functor_data();
|
| 501 |
+
}
|
| 502 |
+
else if (__fn.__is_small_functor_data()) {
|
| 503 |
+
internal::swap(__small_functor_data, __fn.__small_functor_data);
|
| 504 |
+
internal::swap(__obj, __fn.__obj);
|
| 505 |
+
__obj = __get_small_functor_data();
|
| 506 |
+
}
|
| 507 |
+
else {
|
| 508 |
+
internal::swap(__obj, __fn.__obj);
|
| 509 |
+
}
|
| 510 |
+
}
|
| 511 |
+
|
| 512 |
+
// 20.8.11.2.3 function capacity [func.wrap.func.cap]
|
| 513 |
+
#pragma nv_exec_check_disable
|
| 514 |
+
__device__ __host__
|
| 515 |
+
explicit operator bool() const __NV_NOEXCEPT
|
| 516 |
+
{
|
| 517 |
+
return __obj;
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
// 20.8.11.2.4 function invocation [func.wrap.func.inv]
|
| 521 |
+
// function::operator() can only be called in device code
|
| 522 |
+
// to avoid cross-execution space calls
|
| 523 |
+
#pragma nv_exec_check_disable
|
| 524 |
+
__device__ __host__
|
| 525 |
+
_RetType operator()(_ArgTypes...) const;
|
| 526 |
+
|
| 527 |
+
};
|
| 528 |
+
|
| 529 |
+
// Out-of-line definitions
|
| 530 |
+
#pragma nv_exec_check_disable
|
| 531 |
+
template<class _RetType, class... _ArgTypes>
|
| 532 |
+
template<class _F>
|
| 533 |
+
__device__ __host__
|
| 534 |
+
function<_RetType(_ArgTypes...)>::function(_F __fn)
|
| 535 |
+
: __obj(0), __meta_fn(0), __cloner(0), __destructor(0)
|
| 536 |
+
{
|
| 537 |
+
static_assert(__check_callability<_F>::value,
|
| 538 |
+
"Unable to construct functor object!");
|
| 539 |
+
if (__is_empty_functor(__fn))
|
| 540 |
+
return;
|
| 541 |
+
__meta_fn = &__make_functor<_RetType, _F, _ArgTypes...>::__invoke;
|
| 542 |
+
__cloner = &__make_cloner<_F>::__clone_data;
|
| 543 |
+
__destructor = &__make_destructor<_F>::__destruct;
|
| 544 |
+
|
| 545 |
+
if (__use_small_functor_data<_F>()) {
|
| 546 |
+
__obj = __get_small_functor_data();
|
| 547 |
+
new ((void*)__obj) _F(internal::move(__fn));
|
| 548 |
+
}
|
| 549 |
+
else {
|
| 550 |
+
__obj = new _F(internal::move(__fn));
|
| 551 |
+
}
|
| 552 |
+
}
|
| 553 |
+
|
| 554 |
+
#pragma nv_exec_check_disable
|
| 555 |
+
template <class _RetType, class..._ArgTypes>
|
| 556 |
+
__device__ __host__
|
| 557 |
+
_RetType
|
| 558 |
+
function<_RetType(_ArgTypes...)>::operator()(_ArgTypes... __args) const
|
| 559 |
+
{
|
| 560 |
+
return __meta_fn(__obj, internal::forward<_ArgTypes>(__args)...);
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
// 20.8.11.2.6, Null pointer comparisons:
|
| 564 |
+
|
| 565 |
+
#pragma nv_exec_check_disable
|
| 566 |
+
template <class _R, class... _ArgTypes>
|
| 567 |
+
__device__ __host__
|
| 568 |
+
bool operator==(const function<_R(_ArgTypes...)>& __fn, std::nullptr_t)
|
| 569 |
+
__NV_NOEXCEPT
|
| 570 |
+
{
|
| 571 |
+
return !__fn;
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
#pragma nv_exec_check_disable
|
| 575 |
+
template <class _R, class... _ArgTypes>
|
| 576 |
+
__device__ __host__
|
| 577 |
+
bool operator==(std::nullptr_t, const function<_R(_ArgTypes...)>& __fn)
|
| 578 |
+
__NV_NOEXCEPT
|
| 579 |
+
{
|
| 580 |
+
return !__fn;
|
| 581 |
+
}
|
| 582 |
+
|
| 583 |
+
#pragma nv_exec_check_disable
|
| 584 |
+
template <class _R, class... _ArgTypes>
|
| 585 |
+
__device__ __host__
|
| 586 |
+
bool operator!=(const function<_R(_ArgTypes...)>& __fn, std::nullptr_t)
|
| 587 |
+
__NV_NOEXCEPT
|
| 588 |
+
{
|
| 589 |
+
return static_cast<bool>(__fn);
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
#pragma nv_exec_check_disable
|
| 593 |
+
template <class _R, class... _ArgTypes>
|
| 594 |
+
__device__ __host__
|
| 595 |
+
bool operator!=(std::nullptr_t, const function<_R(_ArgTypes...)>& __fn)
|
| 596 |
+
__NV_NOEXCEPT
|
| 597 |
+
{
|
| 598 |
+
return static_cast<bool>(__fn);
|
| 599 |
+
}
|
| 600 |
+
|
| 601 |
+
// 20.8.11.2.7, specialized algorithms:
|
| 602 |
+
#pragma nv_exec_check_disable
|
| 603 |
+
template <class _R, class... _ArgTypes>
|
| 604 |
+
__device__ __host__
|
| 605 |
+
void swap(function<_R(_ArgTypes...)>& __fn1, function<_R(_ArgTypes...)>& __fn2)
|
| 606 |
+
{
|
| 607 |
+
__fn1.swap(__fn2);
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
} // namespace nvstd
|
| 611 |
+
|
| 612 |
+
#undef __NV_NOEXCEPT
|
| 613 |
+
#undef __NV_CONSTEXPR
|
| 614 |
+
#undef __NV_ALIGNOF
|
| 615 |
+
|
| 616 |
+
#endif // __NV_LIBCXX_FUNCTIONAL_H__
|
| 617 |
+
|
| 618 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_NV_LIBCXX_FUNCTIONAL_H__)
|
| 619 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 620 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_NV_LIBCXX_FUNCTIONAL_H__
|
| 621 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_100_rt.h
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2024 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_100_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_100_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_100_RT_H__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_100_RT_H__)
|
| 61 |
+
#define __SM_100_RT_H__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_100_RT_DECL__ __host__ __device__
|
| 65 |
+
#else /* !__CUDACC_RTC__ */
|
| 66 |
+
#define __SM_100_RT_DECL__ static __device__ __inline__
|
| 67 |
+
#endif /* __CUDACC_RTC__ */
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 1000
|
| 72 |
+
|
| 73 |
+
/*******************************************************************************
|
| 74 |
+
* *
|
| 75 |
+
* *
|
| 76 |
+
* *
|
| 77 |
+
*******************************************************************************/
|
| 78 |
+
|
| 79 |
+
#include "builtin_types.h"
|
| 80 |
+
#include "device_types.h"
|
| 81 |
+
#include "host_defines.h"
|
| 82 |
+
|
| 83 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 84 |
+
#define __DEF_IF_HOST { }
|
| 85 |
+
#else /* !__CUDA_ARCH__ && !_NVHPC_CUDA */
|
| 86 |
+
#define __DEF_IF_HOST ;
|
| 87 |
+
#endif /* __CUDA_ARCH__ || _NVHPC_CUDA */
|
| 88 |
+
|
| 89 |
+
/**
|
| 90 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 91 |
+
* \brief Compute vector fused multiply-add operation
|
| 92 |
+
* \cuda_math_formula x \times y + z \end_cuda_math_formula
|
| 93 |
+
* in round-to-nearest-even mode.
|
| 94 |
+
*
|
| 95 |
+
* Numeric behavior per component is the same as ::__fmaf_rn().
|
| 96 |
+
*
|
| 97 |
+
* \note_requires_sm100
|
| 98 |
+
* \note_float2_perf
|
| 99 |
+
*/
|
| 100 |
+
__SM_100_RT_DECL__ float2 __ffma2_rn(float2 x, float2 y, float2 z) __DEF_IF_HOST
|
| 101 |
+
/**
|
| 102 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 103 |
+
* \brief Compute vector fused multiply-add operation
|
| 104 |
+
* \cuda_math_formula x \times y + z \end_cuda_math_formula
|
| 105 |
+
* in round-towards-zero mode.
|
| 106 |
+
*
|
| 107 |
+
* Numeric behavior per component is the same as ::__fmaf_rz().
|
| 108 |
+
*
|
| 109 |
+
* \note_requires_sm100
|
| 110 |
+
* \note_float2_perf
|
| 111 |
+
*/
|
| 112 |
+
__SM_100_RT_DECL__ float2 __ffma2_rz(float2 x, float2 y, float2 z) __DEF_IF_HOST
|
| 113 |
+
/**
|
| 114 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 115 |
+
* \brief Compute vector fused multiply-add operation
|
| 116 |
+
* \cuda_math_formula x \times y + z \end_cuda_math_formula
|
| 117 |
+
* in round-down mode.
|
| 118 |
+
*
|
| 119 |
+
* Numeric behavior per component is the same as ::__fmaf_rd().
|
| 120 |
+
*
|
| 121 |
+
* \note_requires_sm100
|
| 122 |
+
* \note_float2_perf
|
| 123 |
+
*/
|
| 124 |
+
__SM_100_RT_DECL__ float2 __ffma2_rd(float2 x, float2 y, float2 z) __DEF_IF_HOST
|
| 125 |
+
/**
|
| 126 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 127 |
+
* \brief Compute vector fused multiply-add operation
|
| 128 |
+
* \cuda_math_formula x \times y + z \end_cuda_math_formula
|
| 129 |
+
* in round-up mode.
|
| 130 |
+
*
|
| 131 |
+
* Numeric behavior per component is the same as ::__fmaf_ru().
|
| 132 |
+
*
|
| 133 |
+
* \note_requires_sm100
|
| 134 |
+
* \note_float2_perf
|
| 135 |
+
*/
|
| 136 |
+
__SM_100_RT_DECL__ float2 __ffma2_ru(float2 x, float2 y, float2 z) __DEF_IF_HOST
|
| 137 |
+
|
| 138 |
+
/**
|
| 139 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 140 |
+
* \brief Compute vector add operation
|
| 141 |
+
* \cuda_math_formula x + y \end_cuda_math_formula
|
| 142 |
+
* in round-to-nearest-even mode.
|
| 143 |
+
*
|
| 144 |
+
* Numeric behavior per component is the same as ::__fadd_rn().
|
| 145 |
+
*
|
| 146 |
+
* \note_requires_sm100
|
| 147 |
+
* \note_float2_perf
|
| 148 |
+
*/
|
| 149 |
+
__SM_100_RT_DECL__ float2 __fadd2_rn(float2 x, float2 y) __DEF_IF_HOST
|
| 150 |
+
/**
|
| 151 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 152 |
+
* \brief Compute vector add operation
|
| 153 |
+
* \cuda_math_formula x + y \end_cuda_math_formula
|
| 154 |
+
* in round-towards-zero mode.
|
| 155 |
+
*
|
| 156 |
+
* Numeric behavior per component is the same as ::__fadd_rz().
|
| 157 |
+
*
|
| 158 |
+
* \note_requires_sm100
|
| 159 |
+
* \note_float2_perf
|
| 160 |
+
*/
|
| 161 |
+
__SM_100_RT_DECL__ float2 __fadd2_rz(float2 x, float2 y) __DEF_IF_HOST
|
| 162 |
+
/**
|
| 163 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 164 |
+
* \brief Compute vector add operation
|
| 165 |
+
* \cuda_math_formula x + y \end_cuda_math_formula
|
| 166 |
+
* in round-down mode.
|
| 167 |
+
*
|
| 168 |
+
* Numeric behavior per component is the same as ::__fadd_rd().
|
| 169 |
+
*
|
| 170 |
+
* \note_requires_sm100
|
| 171 |
+
* \note_float2_perf
|
| 172 |
+
*/
|
| 173 |
+
__SM_100_RT_DECL__ float2 __fadd2_rd(float2 x, float2 y) __DEF_IF_HOST
|
| 174 |
+
/**
|
| 175 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 176 |
+
* \brief Compute vector add operation
|
| 177 |
+
* \cuda_math_formula x + y \end_cuda_math_formula
|
| 178 |
+
* in round-up mode.
|
| 179 |
+
*
|
| 180 |
+
* Numeric behavior per component is the same as ::__fadd_ru().
|
| 181 |
+
*
|
| 182 |
+
* \note_requires_sm100
|
| 183 |
+
* \note_float2_perf
|
| 184 |
+
*/
|
| 185 |
+
__SM_100_RT_DECL__ float2 __fadd2_ru(float2 x, float2 y) __DEF_IF_HOST
|
| 186 |
+
|
| 187 |
+
/**
|
| 188 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 189 |
+
* \brief Compute vector multiply operation
|
| 190 |
+
* \cuda_math_formula x \times y \end_cuda_math_formula
|
| 191 |
+
* in round-to-nearest-even mode.
|
| 192 |
+
*
|
| 193 |
+
* Numeric behavior per component is the same as ::__fmul_rn().
|
| 194 |
+
*
|
| 195 |
+
* \note_requires_sm100
|
| 196 |
+
* \note_float2_perf
|
| 197 |
+
*/
|
| 198 |
+
__SM_100_RT_DECL__ float2 __fmul2_rn(float2 x, float2 y) __DEF_IF_HOST
|
| 199 |
+
/**
|
| 200 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 201 |
+
* \brief Compute vector multiply operation
|
| 202 |
+
* \cuda_math_formula x \times y \end_cuda_math_formula
|
| 203 |
+
* in round-towards-zero mode.
|
| 204 |
+
*
|
| 205 |
+
* Numeric behavior per component is the same as ::__fmul_rz().
|
| 206 |
+
*
|
| 207 |
+
* \note_requires_sm100
|
| 208 |
+
* \note_float2_perf
|
| 209 |
+
*/
|
| 210 |
+
__SM_100_RT_DECL__ float2 __fmul2_rz(float2 x, float2 y) __DEF_IF_HOST
|
| 211 |
+
/**
|
| 212 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 213 |
+
* \brief Compute vector multiply operation
|
| 214 |
+
* \cuda_math_formula x \times y \end_cuda_math_formula
|
| 215 |
+
* in round-down mode.
|
| 216 |
+
*
|
| 217 |
+
* Numeric behavior per component is the same as ::__fmul_rd().
|
| 218 |
+
*
|
| 219 |
+
* \note_requires_sm100
|
| 220 |
+
* \note_float2_perf
|
| 221 |
+
*/
|
| 222 |
+
__SM_100_RT_DECL__ float2 __fmul2_rd(float2 x, float2 y) __DEF_IF_HOST
|
| 223 |
+
/**
|
| 224 |
+
* \ingroup CUDA_MATH_INTRINSIC_SINGLE
|
| 225 |
+
* \brief Compute vector multiply operation
|
| 226 |
+
* \cuda_math_formula x \times y \end_cuda_math_formula
|
| 227 |
+
* in round-up mode.
|
| 228 |
+
*
|
| 229 |
+
* Numeric behavior per component is the same as ::__fmul_ru().
|
| 230 |
+
*
|
| 231 |
+
* \note_requires_sm100
|
| 232 |
+
* \note_float2_perf
|
| 233 |
+
*/
|
| 234 |
+
__SM_100_RT_DECL__ float2 __fmul2_ru(float2 x, float2 y) __DEF_IF_HOST
|
| 235 |
+
|
| 236 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 1000 */
|
| 237 |
+
|
| 238 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 239 |
+
|
| 240 |
+
#undef __DEF_IF_HOST
|
| 241 |
+
#undef __SM_100_RT_DECL__
|
| 242 |
+
|
| 243 |
+
#if (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA)
|
| 244 |
+
#include "sm_100_rt.hpp"
|
| 245 |
+
#endif /* (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA) */
|
| 246 |
+
|
| 247 |
+
#endif /* !__SM_100_RT_H__ */
|
| 248 |
+
|
| 249 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_100_RT_H__)
|
| 250 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 251 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_100_RT_H__
|
| 252 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_100_rt.hpp
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2024 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_100_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_100_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_100_RT_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_100_RT_HPP__)
|
| 61 |
+
#define __SM_100_RT_HPP__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_100_RT_DECL__ __host__ __device__
|
| 65 |
+
#else /* !__CUDACC_RTC__ */
|
| 66 |
+
#define __SM_100_RT_DECL__ static __device__ __inline__
|
| 67 |
+
#endif /* __CUDACC_RTC__ */
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 1000
|
| 72 |
+
|
| 73 |
+
/*******************************************************************************
|
| 74 |
+
* *
|
| 75 |
+
* *
|
| 76 |
+
* *
|
| 77 |
+
*******************************************************************************/
|
| 78 |
+
|
| 79 |
+
#include "builtin_types.h"
|
| 80 |
+
#include "device_types.h"
|
| 81 |
+
#include "host_defines.h"
|
| 82 |
+
|
| 83 |
+
/*******************************************************************************
|
| 84 |
+
* *
|
| 85 |
+
* Below are implementations of SM-10.0 builtin functions which are included *
|
| 86 |
+
* as source (instead of being built in to the compiler) *
|
| 87 |
+
* *
|
| 88 |
+
*******************************************************************************/
|
| 89 |
+
|
| 90 |
+
extern "C" {
|
| 91 |
+
__device__ __device_builtin__ float2 __ffma2_rn_impl(float2 x, float2 y, float2 z);
|
| 92 |
+
__device__ __device_builtin__ float2 __ffma2_rz_impl(float2 x, float2 y, float2 z);
|
| 93 |
+
__device__ __device_builtin__ float2 __ffma2_rd_impl(float2 x, float2 y, float2 z);
|
| 94 |
+
__device__ __device_builtin__ float2 __ffma2_ru_impl(float2 x, float2 y, float2 z);
|
| 95 |
+
|
| 96 |
+
__device__ __device_builtin__ float2 __fadd2_rn_impl(float2 x, float2 y);
|
| 97 |
+
__device__ __device_builtin__ float2 __fadd2_rz_impl(float2 x, float2 y);
|
| 98 |
+
__device__ __device_builtin__ float2 __fadd2_rd_impl(float2 x, float2 y);
|
| 99 |
+
__device__ __device_builtin__ float2 __fadd2_ru_impl(float2 x, float2 y);
|
| 100 |
+
|
| 101 |
+
__device__ __device_builtin__ float2 __fmul2_rn_impl(float2 x, float2 y);
|
| 102 |
+
__device__ __device_builtin__ float2 __fmul2_rz_impl(float2 x, float2 y);
|
| 103 |
+
__device__ __device_builtin__ float2 __fmul2_rd_impl(float2 x, float2 y);
|
| 104 |
+
__device__ __device_builtin__ float2 __fmul2_ru_impl(float2 x, float2 y);
|
| 105 |
+
} // extern "C"
|
| 106 |
+
|
| 107 |
+
__SM_100_RT_DECL__ float2 __ffma2_rn(float2 x, float2 y, float2 z) {
|
| 108 |
+
return __ffma2_rn_impl(x, y, z);
|
| 109 |
+
}
|
| 110 |
+
__SM_100_RT_DECL__ float2 __ffma2_rz(float2 x, float2 y, float2 z) {
|
| 111 |
+
return __ffma2_rz_impl(x, y, z);
|
| 112 |
+
}
|
| 113 |
+
__SM_100_RT_DECL__ float2 __ffma2_rd(float2 x, float2 y, float2 z) {
|
| 114 |
+
return __ffma2_rd_impl(x, y, z);
|
| 115 |
+
}
|
| 116 |
+
__SM_100_RT_DECL__ float2 __ffma2_ru(float2 x, float2 y, float2 z) {
|
| 117 |
+
return __ffma2_ru_impl(x, y, z);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
__SM_100_RT_DECL__ float2 __fadd2_rn(float2 x, float2 y) {
|
| 121 |
+
return __fadd2_rn_impl(x, y);
|
| 122 |
+
}
|
| 123 |
+
__SM_100_RT_DECL__ float2 __fadd2_rz(float2 x, float2 y) {
|
| 124 |
+
return __fadd2_rz_impl(x, y);
|
| 125 |
+
}
|
| 126 |
+
__SM_100_RT_DECL__ float2 __fadd2_rd(float2 x, float2 y) {
|
| 127 |
+
return __fadd2_rd_impl(x, y);
|
| 128 |
+
}
|
| 129 |
+
__SM_100_RT_DECL__ float2 __fadd2_ru(float2 x, float2 y) {
|
| 130 |
+
return __fadd2_ru_impl(x, y);
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
__SM_100_RT_DECL__ float2 __fmul2_rn(float2 x, float2 y) {
|
| 134 |
+
return __fmul2_rn_impl(x, y);
|
| 135 |
+
}
|
| 136 |
+
__SM_100_RT_DECL__ float2 __fmul2_rz(float2 x, float2 y) {
|
| 137 |
+
return __fmul2_rz_impl(x, y);
|
| 138 |
+
}
|
| 139 |
+
__SM_100_RT_DECL__ float2 __fmul2_rd(float2 x, float2 y) {
|
| 140 |
+
return __fmul2_rd_impl(x, y);
|
| 141 |
+
}
|
| 142 |
+
__SM_100_RT_DECL__ float2 __fmul2_ru(float2 x, float2 y) {
|
| 143 |
+
return __fmul2_ru_impl(x, y);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 1000 */
|
| 147 |
+
|
| 148 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 149 |
+
|
| 150 |
+
#undef __SM_100_RT_DECL__
|
| 151 |
+
|
| 152 |
+
#endif /* !__SM_100_RT_HPP__ */
|
| 153 |
+
|
| 154 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_100_RT_HPP__)
|
| 155 |
+
#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|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2017-2018 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
//NOTE: For NVRTC, these declarations have been moved into the compiler (to reduce compile time)
|
| 51 |
+
#define EXCLUDE_FROM_RTC
|
| 52 |
+
|
| 53 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 54 |
+
#if defined(_MSC_VER)
|
| 55 |
+
#pragma message("crt/sm_70_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 56 |
+
#else
|
| 57 |
+
#warning "crt/sm_70_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 58 |
+
#endif
|
| 59 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 60 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_70_RT_H__
|
| 61 |
+
#endif
|
| 62 |
+
|
| 63 |
+
#if !defined(__SM_70_RT_H__)
|
| 64 |
+
#define __SM_70_RT_H__
|
| 65 |
+
|
| 66 |
+
#if defined(__CUDACC_RTC__)
|
| 67 |
+
#define __SM_70_RT_DECL__ __host__ __device__
|
| 68 |
+
#elif defined(_NVHPC_CUDA)
|
| 69 |
+
#define __SM_70_RT_DECL__ extern __device__ __cudart_builtin__
|
| 70 |
+
#else /* !__CUDACC_RTC__ */
|
| 71 |
+
#define __SM_70_RT_DECL__ static __device__ __inline__
|
| 72 |
+
#endif /* __CUDACC_RTC__ */
|
| 73 |
+
|
| 74 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 75 |
+
|
| 76 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700
|
| 77 |
+
|
| 78 |
+
/*******************************************************************************
|
| 79 |
+
* *
|
| 80 |
+
* *
|
| 81 |
+
* *
|
| 82 |
+
*******************************************************************************/
|
| 83 |
+
|
| 84 |
+
#include "builtin_types.h"
|
| 85 |
+
#include "device_types.h"
|
| 86 |
+
#include "host_defines.h"
|
| 87 |
+
|
| 88 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 89 |
+
#define __DEF_IF_HOST { }
|
| 90 |
+
#else /* !__CUDA_ARCH__ */
|
| 91 |
+
#define __DEF_IF_HOST ;
|
| 92 |
+
#endif /* __CUDA_ARCH__ */
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
/******************************************************************************
|
| 96 |
+
* match *
|
| 97 |
+
******************************************************************************/
|
| 98 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 99 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, int value) __DEF_IF_HOST
|
| 100 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, unsigned long value) __DEF_IF_HOST
|
| 101 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, long value) __DEF_IF_HOST
|
| 102 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, unsigned long long value) __DEF_IF_HOST
|
| 103 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, long long value) __DEF_IF_HOST
|
| 104 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, float value) __DEF_IF_HOST
|
| 105 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, double value) __DEF_IF_HOST
|
| 106 |
+
|
| 107 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, unsigned value, int *pred) __DEF_IF_HOST
|
| 108 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, int value, int *pred) __DEF_IF_HOST
|
| 109 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, unsigned long value, int *pred) __DEF_IF_HOST
|
| 110 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, long value, int *pred) __DEF_IF_HOST
|
| 111 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, unsigned long long value, int *pred) __DEF_IF_HOST
|
| 112 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, long long value, int *pred) __DEF_IF_HOST
|
| 113 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, float value, int *pred) __DEF_IF_HOST
|
| 114 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, double value, int *pred) __DEF_IF_HOST
|
| 115 |
+
|
| 116 |
+
__SM_70_RT_DECL__ void __nanosleep(unsigned int ns) __DEF_IF_HOST
|
| 117 |
+
|
| 118 |
+
__SM_70_RT_DECL__ unsigned short int atomicCAS(unsigned short int *address, unsigned short int compare, unsigned short int val) __DEF_IF_HOST
|
| 119 |
+
|
| 120 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 700 */
|
| 121 |
+
|
| 122 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 123 |
+
|
| 124 |
+
#undef __DEF_IF_HOST
|
| 125 |
+
#undef __SM_70_RT_DECL__
|
| 126 |
+
|
| 127 |
+
#if (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA)
|
| 128 |
+
#include "sm_70_rt.hpp"
|
| 129 |
+
#endif /* (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA) */
|
| 130 |
+
|
| 131 |
+
#endif /* !__SM_70_RT_H__ */
|
| 132 |
+
|
| 133 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_70_RT_H__)
|
| 134 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 135 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_70_RT_H__
|
| 136 |
+
#endif
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
#undef EXCLUDE_FROM_RTC
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_70_rt.hpp
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2017-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_70_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_70_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_70_RT_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_70_RT_HPP__)
|
| 61 |
+
#define __SM_70_RT_HPP__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_70_RT_DECL__ __host__ __device__
|
| 65 |
+
#else /* !__CUDACC_RTC__ */
|
| 66 |
+
#define __SM_70_RT_DECL__ static __device__ __inline__
|
| 67 |
+
#endif /* __CUDACC_RTC__ */
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 700
|
| 72 |
+
|
| 73 |
+
/*******************************************************************************
|
| 74 |
+
* *
|
| 75 |
+
* *
|
| 76 |
+
* *
|
| 77 |
+
*******************************************************************************/
|
| 78 |
+
|
| 79 |
+
#include "builtin_types.h"
|
| 80 |
+
#include "device_types.h"
|
| 81 |
+
#include "host_defines.h"
|
| 82 |
+
|
| 83 |
+
/*******************************************************************************
|
| 84 |
+
* *
|
| 85 |
+
* Below are implementations of SM-7.0 builtin functions which are included as *
|
| 86 |
+
* source (instead of being built in to the compiler) *
|
| 87 |
+
* *
|
| 88 |
+
*******************************************************************************/
|
| 89 |
+
|
| 90 |
+
//
|
| 91 |
+
// __match_any_sync
|
| 92 |
+
//
|
| 93 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, unsigned value) {
|
| 94 |
+
return __match32_any_sync(mask, value);
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, int value) {
|
| 98 |
+
return __match32_any_sync(mask, value);
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, unsigned long value) {
|
| 102 |
+
return (sizeof(long) == sizeof(long long)) ?
|
| 103 |
+
__match64_any_sync(mask, (unsigned long long)value):
|
| 104 |
+
__match32_any_sync(mask, (unsigned)value);
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, long value) {
|
| 108 |
+
return (sizeof(long) == sizeof(long long)) ?
|
| 109 |
+
__match64_any_sync(mask, (unsigned long long)value):
|
| 110 |
+
__match32_any_sync(mask, (unsigned)value);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, unsigned long long value) {
|
| 114 |
+
return __match64_any_sync(mask, value);
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, long long value) {
|
| 118 |
+
return __match64_any_sync(mask, value);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, float value) {
|
| 122 |
+
return __match32_any_sync(mask, __float_as_uint(value));
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
__SM_70_RT_DECL__ unsigned int __match_any_sync(unsigned mask, double value) {
|
| 126 |
+
return __match64_any_sync(mask, __double_as_longlong(value));
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
//
|
| 130 |
+
// __match_all_sync
|
| 131 |
+
//
|
| 132 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, unsigned value, int *pred) {
|
| 133 |
+
return __match32_all_sync(mask, value, pred);
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, int value, int *pred) {
|
| 137 |
+
return __match32_all_sync(mask, value, pred);
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, unsigned long value, int *pred) {
|
| 141 |
+
return (sizeof(long) == sizeof(long long)) ?
|
| 142 |
+
__match64_all_sync(mask, (unsigned long long)value, pred):
|
| 143 |
+
__match32_all_sync(mask, (unsigned)value, pred);
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, long value, int *pred) {
|
| 147 |
+
return (sizeof(long) == sizeof(long long)) ?
|
| 148 |
+
__match64_all_sync(mask, (unsigned long long)value, pred):
|
| 149 |
+
__match32_all_sync(mask, (unsigned)value, pred);
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, unsigned long long value, int *pred) {
|
| 153 |
+
return __match64_all_sync(mask, value, pred);
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, long long value, int *pred) {
|
| 157 |
+
return __match64_all_sync(mask, value, pred);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, float value, int *pred) {
|
| 161 |
+
return __match32_all_sync(mask, __float_as_uint(value), pred);
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
__SM_70_RT_DECL__ unsigned int __match_all_sync(unsigned mask, double value, int *pred) {
|
| 165 |
+
return __match64_all_sync(mask, __double_as_longlong(value), pred);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
__SM_70_RT_DECL__ void __nanosleep(unsigned int ns) {
|
| 169 |
+
asm volatile("nanosleep.u32 %0;" :: "r"(ns));
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
extern "C" __device__ __device_builtin__
|
| 174 |
+
unsigned short __usAtomicCAS(unsigned short *, unsigned short, unsigned short);
|
| 175 |
+
|
| 176 |
+
__SM_70_RT_DECL__ unsigned short int atomicCAS(unsigned short int *address, unsigned short int compare, unsigned short int val) {
|
| 177 |
+
return __usAtomicCAS(address, compare, val);
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 700 */
|
| 182 |
+
|
| 183 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 184 |
+
|
| 185 |
+
#undef __SM_70_RT_DECL__
|
| 186 |
+
|
| 187 |
+
#endif /* !__SM_70_RT_HPP__ */
|
| 188 |
+
|
| 189 |
+
#if defined(__UN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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2017-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_80_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_80_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_80_RT_H__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_80_RT_H__)
|
| 61 |
+
#define __SM_80_RT_H__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_80_RT_DECL__ __host__ __device__
|
| 65 |
+
#elif defined(_NVHPC_CUDA)
|
| 66 |
+
#define __SM_80_RT_DECL__ extern __device__ __cudart_builtin__
|
| 67 |
+
#else /* !__CUDACC_RTC__ */
|
| 68 |
+
#define __SM_80_RT_DECL__ static __device__ __inline__
|
| 69 |
+
#endif /* __CUDACC_RTC__ */
|
| 70 |
+
|
| 71 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 72 |
+
|
| 73 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
|
| 74 |
+
|
| 75 |
+
/*******************************************************************************
|
| 76 |
+
* *
|
| 77 |
+
* *
|
| 78 |
+
* *
|
| 79 |
+
*******************************************************************************/
|
| 80 |
+
|
| 81 |
+
#include "builtin_types.h"
|
| 82 |
+
#include "device_types.h"
|
| 83 |
+
#include "host_defines.h"
|
| 84 |
+
|
| 85 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 86 |
+
#define __DEF_IF_HOST { }
|
| 87 |
+
#else /* !__CUDA_ARCH__ */
|
| 88 |
+
#define __DEF_IF_HOST ;
|
| 89 |
+
#endif /* __CUDA_ARCH__ */
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
//NOTE: For NVRTC, these declarations have been moved into the compiler (to reduce compile time)
|
| 93 |
+
#define EXCLUDE_FROM_RTC
|
| 94 |
+
/******************************************************************************
|
| 95 |
+
* reduce *
|
| 96 |
+
******************************************************************************/
|
| 97 |
+
__SM_80_RT_DECL__ unsigned __reduce_add_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 98 |
+
__SM_80_RT_DECL__ unsigned __reduce_min_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 99 |
+
__SM_80_RT_DECL__ unsigned __reduce_max_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 100 |
+
|
| 101 |
+
__SM_80_RT_DECL__ int __reduce_add_sync(unsigned mask, int value) __DEF_IF_HOST
|
| 102 |
+
__SM_80_RT_DECL__ int __reduce_min_sync(unsigned mask, int value) __DEF_IF_HOST
|
| 103 |
+
__SM_80_RT_DECL__ int __reduce_max_sync(unsigned mask, int value) __DEF_IF_HOST
|
| 104 |
+
|
| 105 |
+
__SM_80_RT_DECL__ unsigned __reduce_and_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 106 |
+
__SM_80_RT_DECL__ unsigned __reduce_or_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 107 |
+
__SM_80_RT_DECL__ unsigned __reduce_xor_sync(unsigned mask, unsigned value) __DEF_IF_HOST
|
| 108 |
+
|
| 109 |
+
#undef EXCLUDE_FROM_RTC
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
extern "C" {
|
| 113 |
+
inline __device__ void *__nv_associate_access_property(const void *ptr,
|
| 114 |
+
unsigned long long property) {
|
| 115 |
+
extern __device__ void *__nv_associate_access_property_impl(const void *,
|
| 116 |
+
unsigned long long);
|
| 117 |
+
return __nv_associate_access_property_impl(ptr, property);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
inline __device__ void __nv_memcpy_async_shared_global_4(void *dst,
|
| 121 |
+
const void *src,
|
| 122 |
+
unsigned src_size) {
|
| 123 |
+
extern __device__ void __nv_memcpy_async_shared_global_4_impl(void *,
|
| 124 |
+
const void *,
|
| 125 |
+
unsigned);
|
| 126 |
+
__nv_memcpy_async_shared_global_4_impl(dst, src, src_size);
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
inline __device__ void __nv_memcpy_async_shared_global_8(void *dst,
|
| 130 |
+
const void *src,
|
| 131 |
+
unsigned src_size) {
|
| 132 |
+
extern __device__ void __nv_memcpy_async_shared_global_8_impl(void *,
|
| 133 |
+
const void *,
|
| 134 |
+
unsigned);
|
| 135 |
+
__nv_memcpy_async_shared_global_8_impl(dst, src, src_size);
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
inline __device__ void __nv_memcpy_async_shared_global_16(void *dst,
|
| 139 |
+
const void *src,
|
| 140 |
+
unsigned src_size) {
|
| 141 |
+
extern __device__ void __nv_memcpy_async_shared_global_16_impl(void *,
|
| 142 |
+
const void *,
|
| 143 |
+
unsigned);
|
| 144 |
+
__nv_memcpy_async_shared_global_16_impl(dst, src, src_size);
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
}
|
| 148 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 800 */
|
| 149 |
+
|
| 150 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 151 |
+
|
| 152 |
+
#undef __DEF_IF_HOST
|
| 153 |
+
#undef __SM_80_RT_DECL__
|
| 154 |
+
|
| 155 |
+
#if (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA)
|
| 156 |
+
#include "sm_80_rt.hpp"
|
| 157 |
+
#endif /* !__CUDACC_RTC__ && defined(__CUDA_ARCH__) */
|
| 158 |
+
|
| 159 |
+
#endif /* !__SM_80_RT_H__ */
|
| 160 |
+
|
| 161 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_80_RT_H__)
|
| 162 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 163 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER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
|
| 2 |
+
* Copyright 2017-2021 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_80_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_80_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_80_RT_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_80_RT_HPP__)
|
| 61 |
+
#define __SM_80_RT_HPP__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_80_RT_DECL__ __host__ __device__
|
| 65 |
+
#else /* !__CUDACC_RTC__ */
|
| 66 |
+
#define __SM_80_RT_DECL__ static __device__ __inline__
|
| 67 |
+
#endif /* __CUDACC_RTC__ */
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800
|
| 72 |
+
|
| 73 |
+
/*******************************************************************************
|
| 74 |
+
* *
|
| 75 |
+
* *
|
| 76 |
+
* *
|
| 77 |
+
*******************************************************************************/
|
| 78 |
+
|
| 79 |
+
#include "builtin_types.h"
|
| 80 |
+
#include "device_types.h"
|
| 81 |
+
#include "host_defines.h"
|
| 82 |
+
|
| 83 |
+
/*******************************************************************************
|
| 84 |
+
* *
|
| 85 |
+
* Below are implementations of SM-8.0 builtin functions which are included as *
|
| 86 |
+
* source (instead of being built in to the compiler) *
|
| 87 |
+
* *
|
| 88 |
+
*******************************************************************************/
|
| 89 |
+
|
| 90 |
+
extern "C" {
|
| 91 |
+
__device_builtin__ __device__ unsigned __reduce_add_sync_unsigned_impl(unsigned, unsigned);
|
| 92 |
+
__device_builtin__ __device__ unsigned __reduce_min_sync_unsigned_impl(unsigned, unsigned);
|
| 93 |
+
__device_builtin__ __device__ unsigned __reduce_max_sync_unsigned_impl(unsigned, unsigned);
|
| 94 |
+
__device_builtin__ __device__ int __reduce_add_sync_signed_impl(unsigned, int);
|
| 95 |
+
__device_builtin__ __device__ int __reduce_min_sync_signed_impl(unsigned, int);
|
| 96 |
+
__device_builtin__ __device__ int __reduce_max_sync_signed_impl(unsigned, int);
|
| 97 |
+
__device_builtin__ __device__ unsigned __reduce_or_sync_unsigned_impl(unsigned, unsigned);
|
| 98 |
+
__device_builtin__ __device__ unsigned __reduce_and_sync_unsigned_impl(unsigned, unsigned);
|
| 99 |
+
__device_builtin__ __device__ unsigned __reduce_xor_sync_unsigned_impl(unsigned, unsigned);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
__SM_80_RT_DECL__ unsigned __reduce_add_sync(unsigned mask, unsigned value) {
|
| 103 |
+
return __reduce_add_sync_unsigned_impl(mask, value);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
__SM_80_RT_DECL__ unsigned __reduce_min_sync(unsigned mask, unsigned value) {
|
| 107 |
+
return __reduce_min_sync_unsigned_impl(mask, value);
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
__SM_80_RT_DECL__ unsigned __reduce_max_sync(unsigned mask, unsigned value) {
|
| 111 |
+
return __reduce_max_sync_unsigned_impl(mask, value);
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
__SM_80_RT_DECL__ int __reduce_add_sync(unsigned mask, int value) {
|
| 115 |
+
return __reduce_add_sync_signed_impl(mask, value);
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
__SM_80_RT_DECL__ int __reduce_min_sync(unsigned mask, int value) {
|
| 119 |
+
return __reduce_min_sync_signed_impl(mask, value);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
__SM_80_RT_DECL__ int __reduce_max_sync(unsigned mask, int value) {
|
| 123 |
+
return __reduce_max_sync_signed_impl(mask, value);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
__SM_80_RT_DECL__ unsigned __reduce_and_sync(unsigned mask, unsigned value) {
|
| 127 |
+
return __reduce_and_sync_unsigned_impl(mask, value);
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
__SM_80_RT_DECL__ unsigned __reduce_or_sync(unsigned mask, unsigned value) {
|
| 131 |
+
return __reduce_or_sync_unsigned_impl(mask, value);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
__SM_80_RT_DECL__ unsigned __reduce_xor_sync(unsigned mask, unsigned value) {
|
| 135 |
+
return __reduce_xor_sync_unsigned_impl(mask, value);
|
| 136 |
+
}
|
| 137 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 800 */
|
| 138 |
+
|
| 139 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 140 |
+
|
| 141 |
+
#undef __SM_80_RT_DECL__
|
| 142 |
+
|
| 143 |
+
#endif /* !__SM_80_RT_HPP__ */
|
| 144 |
+
|
| 145 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_80_RT_HPP__)
|
| 146 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 147 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_80_RT_HPP__
|
| 148 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_90_rt.h
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2022-2023 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_90_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_90_rt.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_90_RT_H__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_90_RT_H__)
|
| 61 |
+
#define __SM_90_RT_H__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_90_RT_DECL__ __host__ __device__
|
| 65 |
+
#else /* !__CUDACC_RTC__ */
|
| 66 |
+
#define __SM_90_RT_DECL__ static __device__ __inline__
|
| 67 |
+
#endif /* __CUDACC_RTC__ */
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 900
|
| 72 |
+
|
| 73 |
+
/*******************************************************************************
|
| 74 |
+
* *
|
| 75 |
+
* *
|
| 76 |
+
* *
|
| 77 |
+
*******************************************************************************/
|
| 78 |
+
|
| 79 |
+
#include "builtin_types.h"
|
| 80 |
+
#include "device_types.h"
|
| 81 |
+
#include "host_defines.h"
|
| 82 |
+
|
| 83 |
+
#if !defined(__CUDA_ARCH__) && !defined(_NVHPC_CUDA)
|
| 84 |
+
#define __DEF_IF_HOST { }
|
| 85 |
+
#else /* !__CUDA_ARCH__ && !_NVHPC_CUDA */
|
| 86 |
+
#define __DEF_IF_HOST ;
|
| 87 |
+
#endif /* __CUDA_ARCH__ || _NVHPC_CUDA */
|
| 88 |
+
|
| 89 |
+
//NOTE: For NVRTC, these declarations have been moved into the compiler (to reduce compile time)
|
| 90 |
+
#define EXCLUDE_FROM_RTC
|
| 91 |
+
|
| 92 |
+
__SM_90_RT_DECL__ unsigned __isCtaShared(const void *ptr) __DEF_IF_HOST
|
| 93 |
+
__SM_90_RT_DECL__ unsigned __isClusterShared(const void *ptr) __DEF_IF_HOST
|
| 94 |
+
__SM_90_RT_DECL__ void *__cluster_map_shared_rank(const void *ptr, unsigned target_block_rank) __DEF_IF_HOST
|
| 95 |
+
__SM_90_RT_DECL__ unsigned __cluster_query_shared_rank(const void *ptr) __DEF_IF_HOST
|
| 96 |
+
__SM_90_RT_DECL__ uint2 __cluster_map_shared_multicast(const void *ptr, unsigned cluster_cta_mask) __DEF_IF_HOST
|
| 97 |
+
__SM_90_RT_DECL__ unsigned __clusterDimIsSpecified() __DEF_IF_HOST
|
| 98 |
+
__SM_90_RT_DECL__ dim3 __clusterDim() __DEF_IF_HOST
|
| 99 |
+
__SM_90_RT_DECL__ dim3 __clusterRelativeBlockIdx() __DEF_IF_HOST
|
| 100 |
+
__SM_90_RT_DECL__ dim3 __clusterGridDimInClusters() __DEF_IF_HOST
|
| 101 |
+
__SM_90_RT_DECL__ dim3 __clusterIdx() __DEF_IF_HOST
|
| 102 |
+
__SM_90_RT_DECL__ unsigned __clusterRelativeBlockRank() __DEF_IF_HOST
|
| 103 |
+
__SM_90_RT_DECL__ unsigned __clusterSizeInBlocks() __DEF_IF_HOST
|
| 104 |
+
__SM_90_RT_DECL__ void __cluster_barrier_arrive() __DEF_IF_HOST
|
| 105 |
+
__SM_90_RT_DECL__ void __cluster_barrier_arrive_relaxed() __DEF_IF_HOST
|
| 106 |
+
__SM_90_RT_DECL__ void __cluster_barrier_wait() __DEF_IF_HOST
|
| 107 |
+
__SM_90_RT_DECL__ void __threadfence_cluster() __DEF_IF_HOST
|
| 108 |
+
|
| 109 |
+
__SM_90_RT_DECL__ float2 atomicAdd(float2 *__address, float2 val) __DEF_IF_HOST
|
| 110 |
+
__SM_90_RT_DECL__ float2 atomicAdd_block(float2 *__address, float2 val) __DEF_IF_HOST
|
| 111 |
+
__SM_90_RT_DECL__ float2 atomicAdd_system(float2 *__address, float2 val) __DEF_IF_HOST
|
| 112 |
+
__SM_90_RT_DECL__ float4 atomicAdd(float4 *__address, float4 val) __DEF_IF_HOST
|
| 113 |
+
__SM_90_RT_DECL__ float4 atomicAdd_block(float4 *__address, float4 val) __DEF_IF_HOST
|
| 114 |
+
__SM_90_RT_DECL__ float4 atomicAdd_system(float4 *__address, float4 val) __DEF_IF_HOST
|
| 115 |
+
|
| 116 |
+
#undef EXCLUDE_FROM_RTC
|
| 117 |
+
|
| 118 |
+
//Note: below atomic functions are templates, so cannot be represented in NVRTC
|
| 119 |
+
//builtins representation, so they have to be parsed on every NVRTC compilation.
|
| 120 |
+
//(notice 'EXCLUDE_FROM_RTC' ends above)
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
#ifndef __NV_DISABLE_128_ATOMICS
|
| 124 |
+
// lgen definitions for 128b atomics
|
| 125 |
+
extern "C" {
|
| 126 |
+
__device__ __device_builtin__ void __u128AtomicCAS(void *, void *, void *, void *);
|
| 127 |
+
__device__ __device_builtin__ void __u128AtomicCAS_block(void *, void *, void *, void *);
|
| 128 |
+
__device__ __device_builtin__ void __u128AtomicCAS_system(void *, void *, void *, void *);
|
| 129 |
+
__device__ __device_builtin__ void __u128AtomicExch(void *, void *, void *);
|
| 130 |
+
__device__ __device_builtin__ void __u128AtomicExch_block(void *, void *, void *);
|
| 131 |
+
__device__ __device_builtin__ void __u128AtomicExch_system(void *, void *, void *);
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
// macro to get address of object, to workaround situations where the type overloads the "&" operator
|
| 135 |
+
#define __NV_ATOMIC_ADDRESSOF(__val) \
|
| 136 |
+
(void *)(&(const_cast<char &>(reinterpret_cast<const volatile char &>(__val))))
|
| 137 |
+
|
| 138 |
+
// enable_if
|
| 139 |
+
template<bool __b, typename _T>
|
| 140 |
+
struct __nv_atomic_enable_if { };
|
| 141 |
+
|
| 142 |
+
template<typename _T>
|
| 143 |
+
struct __nv_atomic_enable_if<true, _T> { typedef _T __type; };
|
| 144 |
+
|
| 145 |
+
// alignof
|
| 146 |
+
#if defined(__CUDACC_RTC__)
|
| 147 |
+
#define __NV_ATOMIC_ALIGNOF __alignof__
|
| 148 |
+
#else
|
| 149 |
+
#define __NV_ATOMIC_ALIGNOF __alignof
|
| 150 |
+
#endif
|
| 151 |
+
|
| 152 |
+
// trivially copyable
|
| 153 |
+
template <typename _T>
|
| 154 |
+
struct __nv_atomic_triv_cp_helper {
|
| 155 |
+
#if defined(__GNUC__)
|
| 156 |
+
#if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
|
| 157 |
+
static const bool __val = true;
|
| 158 |
+
#elif (__GNUC__ < 5)
|
| 159 |
+
static const bool __val = __has_trivial_copy(_T);
|
| 160 |
+
#else
|
| 161 |
+
static const bool __val = __is_trivially_copyable(_T);
|
| 162 |
+
#endif
|
| 163 |
+
#else
|
| 164 |
+
static const bool __val = __is_trivially_copyable(_T);
|
| 165 |
+
#endif
|
| 166 |
+
};
|
| 167 |
+
#define __NV_ATOMIC_TRIVIALLY_COPYABLE(_T) \
|
| 168 |
+
__nv_atomic_triv_cp_helper<_T>::__val
|
| 169 |
+
|
| 170 |
+
// return type
|
| 171 |
+
#if __cplusplus >= 202002L // C++20 or greater
|
| 172 |
+
#define __NV_ATOMIC_RET_TYPE(_T) _T
|
| 173 |
+
#else
|
| 174 |
+
#define __NV_ATOMIC_RET_TYPE(_T) typename \
|
| 175 |
+
__nv_atomic_enable_if<sizeof(_T) == 16 && \
|
| 176 |
+
__NV_ATOMIC_ALIGNOF(_T) >= 16 && \
|
| 177 |
+
__NV_ATOMIC_TRIVIALLY_COPYABLE(_T), _T>::__type
|
| 178 |
+
#endif
|
| 179 |
+
|
| 180 |
+
// requires
|
| 181 |
+
#if __cplusplus >= 202002L // C++20 or greater
|
| 182 |
+
#define __NV_ATOMIC_REQUIRES(_T) \
|
| 183 |
+
requires(sizeof(_T) == 16 && \
|
| 184 |
+
__NV_ATOMIC_ALIGNOF(_T) >= 16 && \
|
| 185 |
+
__NV_ATOMIC_TRIVIALLY_COPYABLE(_T))
|
| 186 |
+
#else
|
| 187 |
+
#define __NV_ATOMIC_REQUIRES(_T)
|
| 188 |
+
#endif
|
| 189 |
+
|
| 190 |
+
// temp value and return value
|
| 191 |
+
#if __cplusplus >= 201103L || defined(_MSC_VER) // C++11 or greater, or MSC
|
| 192 |
+
#define __NV_ATOMIC_TEMP(_T) union _U \
|
| 193 |
+
{_T __ret; __device__ __inline__ _U() {}}; _U __u
|
| 194 |
+
#define __NV_ATOMIC_RET(_T) __u.__ret
|
| 195 |
+
#else
|
| 196 |
+
#define __NV_ATOMIC_TEMP(_T) _T __ret
|
| 197 |
+
#define __NV_ATOMIC_RET(_T) __ret
|
| 198 |
+
#endif
|
| 199 |
+
|
| 200 |
+
// templated 128-bit atomics
|
| 201 |
+
template <typename _T>
|
| 202 |
+
__SM_90_RT_DECL__ __NV_ATOMIC_RET_TYPE(_T)
|
| 203 |
+
atomicCAS(_T *__address, _T __compare, _T __val) __NV_ATOMIC_REQUIRES(_T) {
|
| 204 |
+
__NV_ATOMIC_TEMP(_T);
|
| 205 |
+
__u128AtomicCAS((void *)(__address),
|
| 206 |
+
__NV_ATOMIC_ADDRESSOF(__compare),
|
| 207 |
+
__NV_ATOMIC_ADDRESSOF(__val),
|
| 208 |
+
__NV_ATOMIC_ADDRESSOF(__NV_ATOMIC_RET(_T)));
|
| 209 |
+
return __NV_ATOMIC_RET(_T);
|
| 210 |
+
}
|
| 211 |
+
|
| 212 |
+
template <typename _T>
|
| 213 |
+
__SM_90_RT_DECL__ __NV_ATOMIC_RET_TYPE(_T)
|
| 214 |
+
atomicCAS_block(_T *__address, _T __compare, _T __val) __NV_ATOMIC_REQUIRES(_T) {
|
| 215 |
+
__NV_ATOMIC_TEMP(_T);
|
| 216 |
+
__u128AtomicCAS_block((void *)(__address),
|
| 217 |
+
__NV_ATOMIC_ADDRESSOF(__compare),
|
| 218 |
+
__NV_ATOMIC_ADDRESSOF(__val),
|
| 219 |
+
__NV_ATOMIC_ADDRESSOF(__NV_ATOMIC_RET(_T)));
|
| 220 |
+
return __NV_ATOMIC_RET(_T);
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
template <typename _T>
|
| 224 |
+
__SM_90_RT_DECL__ __NV_ATOMIC_RET_TYPE(_T)
|
| 225 |
+
atomicCAS_system(_T *__address, _T __compare, _T __val) __NV_ATOMIC_REQUIRES(_T) {
|
| 226 |
+
__NV_ATOMIC_TEMP(_T);
|
| 227 |
+
__u128AtomicCAS_system((void *)(__address),
|
| 228 |
+
__NV_ATOMIC_ADDRESSOF(__compare),
|
| 229 |
+
__NV_ATOMIC_ADDRESSOF(__val),
|
| 230 |
+
__NV_ATOMIC_ADDRESSOF(__NV_ATOMIC_RET(_T)));
|
| 231 |
+
return __NV_ATOMIC_RET(_T);
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
template <typename _T>
|
| 235 |
+
__SM_90_RT_DECL__ __NV_ATOMIC_RET_TYPE(_T)
|
| 236 |
+
atomicExch(_T *__address, _T __val) __NV_ATOMIC_REQUIRES(_T) {
|
| 237 |
+
__NV_ATOMIC_TEMP(_T);
|
| 238 |
+
__u128AtomicExch((void *)(__address),
|
| 239 |
+
__NV_ATOMIC_ADDRESSOF(__val),
|
| 240 |
+
__NV_ATOMIC_ADDRESSOF(__NV_ATOMIC_RET(_T)));
|
| 241 |
+
return __NV_ATOMIC_RET(_T);
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
template <typename _T>
|
| 245 |
+
__SM_90_RT_DECL__ __NV_ATOMIC_RET_TYPE(_T)
|
| 246 |
+
atomicExch_block(_T *__address, _T __val) __NV_ATOMIC_REQUIRES(_T) {
|
| 247 |
+
__NV_ATOMIC_TEMP(_T);
|
| 248 |
+
__u128AtomicExch_block((void *)(__address),
|
| 249 |
+
__NV_ATOMIC_ADDRESSOF(__val),
|
| 250 |
+
__NV_ATOMIC_ADDRESSOF(__NV_ATOMIC_RET(_T)));
|
| 251 |
+
return __NV_ATOMIC_RET(_T);
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
template <typename _T>
|
| 255 |
+
__SM_90_RT_DECL__ __NV_ATOMIC_RET_TYPE(_T)
|
| 256 |
+
atomicExch_system(_T *__address, _T __val) __NV_ATOMIC_REQUIRES(_T) {
|
| 257 |
+
__NV_ATOMIC_TEMP(_T);
|
| 258 |
+
__u128AtomicExch_system((void *)(__address),
|
| 259 |
+
__NV_ATOMIC_ADDRESSOF(__val),
|
| 260 |
+
__NV_ATOMIC_ADDRESSOF(__NV_ATOMIC_RET(_T)));
|
| 261 |
+
return __NV_ATOMIC_RET(_T);
|
| 262 |
+
}
|
| 263 |
+
#endif /* !__NV_DISABLE_128_ATOMICS */
|
| 264 |
+
|
| 265 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 900 */
|
| 266 |
+
|
| 267 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 268 |
+
|
| 269 |
+
#undef __DEF_IF_HOST
|
| 270 |
+
#undef __SM_90_RT_DECL__
|
| 271 |
+
|
| 272 |
+
#if (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA)
|
| 273 |
+
#include "sm_90_rt.hpp"
|
| 274 |
+
#endif /* (!defined(__CUDACC_RTC__) && defined(__CUDA_ARCH__)) || defined(_NVHPC_CUDA) */
|
| 275 |
+
|
| 276 |
+
#endif /* !__SM_90_RT_H__ */
|
| 277 |
+
|
| 278 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_90_RT_H__)
|
| 279 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 280 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_90_RT_H__
|
| 281 |
+
#endif
|
| 282 |
+
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/backends/nvidia/include/crt/sm_90_rt.hpp
ADDED
|
@@ -0,0 +1,248 @@
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* Copyright 2022 NVIDIA Corporation. All rights reserved.
|
| 3 |
+
*
|
| 4 |
+
* NOTICE TO LICENSEE:
|
| 5 |
+
*
|
| 6 |
+
* This source code and/or documentation ("Licensed Deliverables") are
|
| 7 |
+
* subject to NVIDIA intellectual property rights under U.S. and
|
| 8 |
+
* international Copyright laws.
|
| 9 |
+
*
|
| 10 |
+
* These Licensed Deliverables contained herein is PROPRIETARY and
|
| 11 |
+
* CONFIDENTIAL to NVIDIA and is being provided under the terms and
|
| 12 |
+
* conditions of a form of NVIDIA software license agreement by and
|
| 13 |
+
* between NVIDIA and Licensee ("License Agreement") or electronically
|
| 14 |
+
* accepted by Licensee. Notwithstanding any terms or conditions to
|
| 15 |
+
* the contrary in the License Agreement, reproduction or disclosure
|
| 16 |
+
* of the Licensed Deliverables to any third party without the express
|
| 17 |
+
* written consent of NVIDIA is prohibited.
|
| 18 |
+
*
|
| 19 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 20 |
+
* LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
|
| 21 |
+
* SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
|
| 22 |
+
* PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
|
| 23 |
+
* NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
|
| 24 |
+
* DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
|
| 25 |
+
* NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
|
| 26 |
+
* NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
|
| 27 |
+
* LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
|
| 28 |
+
* SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
|
| 29 |
+
* DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
| 30 |
+
* WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
| 31 |
+
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
| 32 |
+
* OF THESE LICENSED DELIVERABLES.
|
| 33 |
+
*
|
| 34 |
+
* U.S. Government End Users. These Licensed Deliverables are a
|
| 35 |
+
* "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
|
| 36 |
+
* 1995), consisting of "commercial computer software" and "commercial
|
| 37 |
+
* computer software documentation" as such terms are used in 48
|
| 38 |
+
* C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
|
| 39 |
+
* only as a commercial end item. Consistent with 48 C.F.R.12.212 and
|
| 40 |
+
* 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
|
| 41 |
+
* U.S. Government End Users acquire the Licensed Deliverables with
|
| 42 |
+
* only those rights set forth herein.
|
| 43 |
+
*
|
| 44 |
+
* Any use of the Licensed Deliverables in individual and commercial
|
| 45 |
+
* software must include, in the user documentation and internal
|
| 46 |
+
* comments to the code, the above Disclaimer and U.S. Government End
|
| 47 |
+
* Users Notice.
|
| 48 |
+
*/
|
| 49 |
+
|
| 50 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 51 |
+
#if defined(_MSC_VER)
|
| 52 |
+
#pragma message("crt/sm_90_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 53 |
+
#else
|
| 54 |
+
#warning "crt/sm_90_rt.hpp is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 55 |
+
#endif
|
| 56 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 57 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_90_RT_HPP__
|
| 58 |
+
#endif
|
| 59 |
+
|
| 60 |
+
#if !defined(__SM_90_RT_HPP__)
|
| 61 |
+
#define __SM_90_RT_HPP__
|
| 62 |
+
|
| 63 |
+
#if defined(__CUDACC_RTC__)
|
| 64 |
+
#define __SM_90_RT_DECL__ __host__ __device__
|
| 65 |
+
#else /* !__CUDACC_RTC__ */
|
| 66 |
+
#define __SM_90_RT_DECL__ static __device__ __inline__
|
| 67 |
+
#endif /* __CUDACC_RTC__ */
|
| 68 |
+
|
| 69 |
+
#if defined(__cplusplus) && defined(__CUDACC__)
|
| 70 |
+
|
| 71 |
+
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 900
|
| 72 |
+
|
| 73 |
+
/*******************************************************************************
|
| 74 |
+
* *
|
| 75 |
+
* *
|
| 76 |
+
* *
|
| 77 |
+
*******************************************************************************/
|
| 78 |
+
|
| 79 |
+
#include "builtin_types.h"
|
| 80 |
+
#include "device_types.h"
|
| 81 |
+
#include "host_defines.h"
|
| 82 |
+
|
| 83 |
+
/*******************************************************************************
|
| 84 |
+
* *
|
| 85 |
+
* Below are implementations of SM-9.0 builtin functions which are included as *
|
| 86 |
+
* source (instead of being built in to the compiler) *
|
| 87 |
+
* *
|
| 88 |
+
*******************************************************************************/
|
| 89 |
+
extern "C" {
|
| 90 |
+
__device__ unsigned __nv_isClusterShared_impl(const void *);
|
| 91 |
+
__device__ void * __nv_cluster_map_shared_rank_impl(const void *, unsigned);
|
| 92 |
+
__device__ unsigned __nv_cluster_query_shared_rank_impl(const void *);
|
| 93 |
+
__device__ unsigned __nv_clusterDimIsSpecifed_impl();
|
| 94 |
+
__device__ void __nv_clusterDim_impl(unsigned *, unsigned *, unsigned *);
|
| 95 |
+
__device__ void __nv_clusterRelativeBlockIdx_impl(unsigned *,
|
| 96 |
+
unsigned *, unsigned *);
|
| 97 |
+
__device__ void __nv_clusterGridDimInClusters_impl(unsigned *,
|
| 98 |
+
unsigned *, unsigned *);
|
| 99 |
+
__device__ void __nv_clusterIdx_impl(unsigned *, unsigned *, unsigned *);
|
| 100 |
+
__device__ unsigned __nv_clusterRelativeBlockRank_impl();
|
| 101 |
+
__device__ unsigned __nv_clusterSizeInBlocks_impl();
|
| 102 |
+
__device__ void __nv_cluster_barrier_arrive_impl();
|
| 103 |
+
__device__ void __nv_cluster_barrier_arrive_relaxed_impl();
|
| 104 |
+
__device__ void __nv_cluster_barrier_wait_impl();
|
| 105 |
+
__device__ void __nv_threadfence_cluster_impl();
|
| 106 |
+
|
| 107 |
+
__device__ __device_builtin__ float2 __f2AtomicAdd(float2 *, float2);
|
| 108 |
+
__device__ __device_builtin__ float2 __f2AtomicAdd_block(float2 *, float2);
|
| 109 |
+
__device__ __device_builtin__ float2 __f2AtomicAdd_system(float2 *, float2);
|
| 110 |
+
__device__ __device_builtin__ float4 __f4AtomicAdd(float4 *, float4);
|
| 111 |
+
__device__ __device_builtin__ float4 __f4AtomicAdd_block(float4 *, float4);
|
| 112 |
+
__device__ __device_builtin__ float4 __f4AtomicAdd_system(float4 *, float4);
|
| 113 |
+
} // extern "C"
|
| 114 |
+
|
| 115 |
+
__SM_90_RT_DECL__ unsigned __isCtaShared(const void *ptr)
|
| 116 |
+
{
|
| 117 |
+
return __isShared(ptr);
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
__SM_90_RT_DECL__ unsigned __isClusterShared(const void *ptr)
|
| 121 |
+
{
|
| 122 |
+
return __nv_isClusterShared_impl(ptr);
|
| 123 |
+
}
|
| 124 |
+
|
| 125 |
+
__SM_90_RT_DECL__ void *__cluster_map_shared_rank(const void *ptr,
|
| 126 |
+
unsigned target_block_rank)
|
| 127 |
+
{
|
| 128 |
+
return __nv_cluster_map_shared_rank_impl(ptr, target_block_rank);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
__SM_90_RT_DECL__ unsigned __cluster_query_shared_rank(const void *ptr)
|
| 132 |
+
{
|
| 133 |
+
return __nv_cluster_query_shared_rank_impl(ptr);
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
__SM_90_RT_DECL__ uint2 __cluster_map_shared_multicast(const void *ptr,
|
| 137 |
+
unsigned int cluster_cta_mask)
|
| 138 |
+
{
|
| 139 |
+
return make_uint2((unsigned)__cvta_generic_to_shared(ptr), cluster_cta_mask);
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
__SM_90_RT_DECL__ unsigned __clusterDimIsSpecified()
|
| 143 |
+
{
|
| 144 |
+
return __nv_clusterDimIsSpecifed_impl();
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
__SM_90_RT_DECL__ dim3 __clusterDim()
|
| 148 |
+
{
|
| 149 |
+
unsigned x, y, z;
|
| 150 |
+
__nv_clusterDim_impl(&x, &y, &z);
|
| 151 |
+
return dim3(x,y,z);
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
__SM_90_RT_DECL__ dim3 __clusterRelativeBlockIdx()
|
| 155 |
+
{
|
| 156 |
+
unsigned x, y, z;
|
| 157 |
+
__nv_clusterRelativeBlockIdx_impl(&x, &y, &z);
|
| 158 |
+
return dim3(x,y,z);
|
| 159 |
+
}
|
| 160 |
+
|
| 161 |
+
__SM_90_RT_DECL__ dim3 __clusterGridDimInClusters()
|
| 162 |
+
{
|
| 163 |
+
unsigned x, y, z;
|
| 164 |
+
__nv_clusterGridDimInClusters_impl(&x, &y, &z);
|
| 165 |
+
return dim3(x,y,z);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
__SM_90_RT_DECL__ dim3 __clusterIdx()
|
| 169 |
+
{
|
| 170 |
+
unsigned x, y, z;
|
| 171 |
+
__nv_clusterIdx_impl(&x, &y, &z);
|
| 172 |
+
return dim3(x,y,z);
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
__SM_90_RT_DECL__ unsigned __clusterRelativeBlockRank()
|
| 176 |
+
{
|
| 177 |
+
return __nv_clusterRelativeBlockRank_impl();
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
__SM_90_RT_DECL__ unsigned __clusterSizeInBlocks()
|
| 181 |
+
{
|
| 182 |
+
return __nv_clusterSizeInBlocks_impl();
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
__SM_90_RT_DECL__ void __cluster_barrier_arrive()
|
| 186 |
+
{
|
| 187 |
+
__nv_cluster_barrier_arrive_impl();
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
__SM_90_RT_DECL__ void __cluster_barrier_arrive_relaxed()
|
| 191 |
+
{
|
| 192 |
+
__nv_cluster_barrier_arrive_relaxed_impl();
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
__SM_90_RT_DECL__ void __cluster_barrier_wait()
|
| 196 |
+
{
|
| 197 |
+
__nv_cluster_barrier_wait_impl();
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
__SM_90_RT_DECL__ void __threadfence_cluster()
|
| 201 |
+
{
|
| 202 |
+
__nv_threadfence_cluster_impl();
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
/* Define __PTR for atomicAdd prototypes below, undef after done */
|
| 207 |
+
#if (defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__)
|
| 208 |
+
#define __PTR "l"
|
| 209 |
+
#else
|
| 210 |
+
#define __PTR "r"
|
| 211 |
+
#endif /*(defined(_MSC_VER) && defined(_WIN64)) || defined(__LP64__) || defined(__CUDACC_RTC__)*/
|
| 212 |
+
|
| 213 |
+
__SM_90_RT_DECL__ float2 atomicAdd(float2 *address, float2 val) {
|
| 214 |
+
return __f2AtomicAdd(address, val);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
__SM_90_RT_DECL__ float2 atomicAdd_block(float2 *address, float2 val) {
|
| 218 |
+
return __f2AtomicAdd_block(address, val);
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
__SM_90_RT_DECL__ float2 atomicAdd_system(float2 *address, float2 val) {
|
| 222 |
+
return __f2AtomicAdd_system(address, val);
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
__SM_90_RT_DECL__ float4 atomicAdd(float4 *address, float4 val) {
|
| 226 |
+
return __f4AtomicAdd(address, val);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
__SM_90_RT_DECL__ float4 atomicAdd_block(float4 *address, float4 val) {
|
| 230 |
+
return __f4AtomicAdd_block(address, val);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
__SM_90_RT_DECL__ float4 atomicAdd_system(float4 *address, float4 val) {
|
| 234 |
+
return __f4AtomicAdd_system(address, val);
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
#endif /* !__CUDA_ARCH__ || __CUDA_ARCH__ >= 900 */
|
| 238 |
+
|
| 239 |
+
#endif /* __cplusplus && __CUDACC__ */
|
| 240 |
+
|
| 241 |
+
#undef __SM_90_RT_DECL__
|
| 242 |
+
|
| 243 |
+
#endif /* !__SM_90_RT_HPP__ */
|
| 244 |
+
|
| 245 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_SM_90_RT_HP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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* NVIDIA_COPYRIGHT_BEGIN
|
| 3 |
+
*
|
| 4 |
+
* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
|
| 5 |
+
*
|
| 6 |
+
* NVIDIA CORPORATION and its licensors retain all intellectual property
|
| 7 |
+
* and proprietary rights in and to this software, related documentation
|
| 8 |
+
* and any modifications thereto. Any use, reproduction, disclosure or
|
| 9 |
+
* distribution of this software and related documentation without an express
|
| 10 |
+
* license agreement from NVIDIA CORPORATION is strictly prohibited.
|
| 11 |
+
*
|
| 12 |
+
* NVIDIA_COPYRIGHT_END
|
| 13 |
+
*/
|
| 14 |
+
|
| 15 |
+
#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
|
| 16 |
+
#if defined(_MSC_VER)
|
| 17 |
+
#pragma message("crt/storage_class.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead.")
|
| 18 |
+
#else
|
| 19 |
+
#warning "crt/storage_class.h is an internal header file and must not be used directly. Please use cuda_runtime_api.h or cuda_runtime.h instead."
|
| 20 |
+
#endif
|
| 21 |
+
#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 22 |
+
#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_STORAGE_CLASS_H__
|
| 23 |
+
#endif
|
| 24 |
+
|
| 25 |
+
#if !defined(__STORAGE_CLASS_H__)
|
| 26 |
+
#define __STORAGE_CLASS_H__
|
| 27 |
+
|
| 28 |
+
#if !defined(__var_used__)
|
| 29 |
+
|
| 30 |
+
#define __var_used__
|
| 31 |
+
|
| 32 |
+
#endif /* __var_used__ */
|
| 33 |
+
|
| 34 |
+
#if !defined(__loc_sc__)
|
| 35 |
+
|
| 36 |
+
#define __loc_sc__(loc, size, sc) \
|
| 37 |
+
__storage##_##sc##size##loc loc
|
| 38 |
+
|
| 39 |
+
#endif /* !__loc_sc__ */
|
| 40 |
+
|
| 41 |
+
#if !defined(__storage___device__)
|
| 42 |
+
#define __storage___device__ static __var_used__
|
| 43 |
+
#endif /* __storage___device__ */
|
| 44 |
+
|
| 45 |
+
#if !defined(__storage_extern__device__)
|
| 46 |
+
#define __storage_extern__device__ static __var_used__
|
| 47 |
+
#endif /* __storage_extern__device__ */
|
| 48 |
+
|
| 49 |
+
#if !defined(__storage_auto__device__)
|
| 50 |
+
#define __storage_auto__device__ @@@ COMPILER @@@ ERROR @@@
|
| 51 |
+
#endif /* __storage_auto__device__ */
|
| 52 |
+
|
| 53 |
+
#if !defined(__storage_static__device__)
|
| 54 |
+
#define __storage_static__device__ static __var_used__
|
| 55 |
+
#endif /* __storage_static__device__ */
|
| 56 |
+
|
| 57 |
+
#if !defined(__storage___constant__)
|
| 58 |
+
#define __storage___constant__ static __var_used__
|
| 59 |
+
#endif /* __storage___constant__ */
|
| 60 |
+
|
| 61 |
+
#if !defined(__storage_extern__constant__)
|
| 62 |
+
#define __storage_extern__constant__ static __var_used__
|
| 63 |
+
#endif /* __storage_extern__constant__ */
|
| 64 |
+
|
| 65 |
+
#if !defined(__storage_auto__constant__)
|
| 66 |
+
#define __storage_auto__constant__ @@@ COMPILER @@@ ERROR @@@
|
| 67 |
+
#endif /* __storage_auto__constant__ */
|
| 68 |
+
|
| 69 |
+
#if !defined(__storage_static__constant__)
|
| 70 |
+
#define __storage_static__constant__ static __var_used__
|
| 71 |
+
#endif /* __storage_static__constant__ */
|
| 72 |
+
|
| 73 |
+
#if !defined(__storage___shared__)
|
| 74 |
+
#define __storage___shared__ static __var_used__
|
| 75 |
+
#endif /* __storage___shared__ */
|
| 76 |
+
|
| 77 |
+
#if !defined(__storage_extern__shared__)
|
| 78 |
+
#define __storage_extern__shared__ static __var_used__
|
| 79 |
+
#endif /* __storage_extern__shared__ */
|
| 80 |
+
|
| 81 |
+
#if !defined(__storage_auto__shared__)
|
| 82 |
+
#define __storage_auto__shared__ static
|
| 83 |
+
#endif /* __storage_auto__shared__ */
|
| 84 |
+
|
| 85 |
+
#if !defined(__storage_static__shared__)
|
| 86 |
+
#define __storage_static__shared__ static __var_used__
|
| 87 |
+
#endif /* __storage_static__shared__ */
|
| 88 |
+
|
| 89 |
+
#if !defined(__storage__unsized__shared__)
|
| 90 |
+
#define __storage__unsized__shared__ @@@ COMPILER @@@ ERROR @@@
|
| 91 |
+
#endif /* __storage__unsized__shared__ */
|
| 92 |
+
|
| 93 |
+
#if !defined(__storage_extern_unsized__shared__)
|
| 94 |
+
#define __storage_extern_unsized__shared__ static __var_used__
|
| 95 |
+
#endif /* __storage_extern_unsized__shared__ */
|
| 96 |
+
|
| 97 |
+
#if !defined(__storage_auto_unsized__shared__)
|
| 98 |
+
#define __storage_auto_unsized__shared__ @@@ COMPILER @@@ ERROR @@@
|
| 99 |
+
#endif /* __storage_auto_unsized__shared__ */
|
| 100 |
+
|
| 101 |
+
#if !defined(__storage_static_unsized__shared__)
|
| 102 |
+
#define __storage_static_unsized__shared__ @@@ COMPILER @@@ ERROR @@@
|
| 103 |
+
#endif /* __storage_static_unsized__shared__ */
|
| 104 |
+
|
| 105 |
+
#if !defined(__storage___text__)
|
| 106 |
+
#define __storage___text__ static __var_used__
|
| 107 |
+
#endif /* __storage___text__ */
|
| 108 |
+
|
| 109 |
+
#if !defined(__storage_extern__text__)
|
| 110 |
+
#define __storage_extern__text__ static __var_used__
|
| 111 |
+
#endif /* __storage_extern__text__ */
|
| 112 |
+
|
| 113 |
+
#if !defined(__storage_auto__text__)
|
| 114 |
+
#define __storage_auto__text__ @@@ COMPILER @@@ ERROR @@@
|
| 115 |
+
#endif /* __storage_auto__text__ */
|
| 116 |
+
|
| 117 |
+
#if !defined(__storage_static__text__)
|
| 118 |
+
#define __storage_static__text__ static __var_used__
|
| 119 |
+
#endif /* __storage_static__text__ */
|
| 120 |
+
|
| 121 |
+
#if !defined(__storage___surf__)
|
| 122 |
+
#define __storage___surf__ static __var_used__
|
| 123 |
+
#endif /* __storage___surf__ */
|
| 124 |
+
|
| 125 |
+
#if !defined(__storage_extern__surf__)
|
| 126 |
+
#define __storage_extern__surf__ static __var_used__
|
| 127 |
+
#endif /* __storage_extern__surf__ */
|
| 128 |
+
|
| 129 |
+
#if !defined(__storage_auto__surf__)
|
| 130 |
+
#define __storage_auto__surf__ @@@ COMPILER @@@ ERROR @@@
|
| 131 |
+
#endif /* __storage_auto__surf__ */
|
| 132 |
+
|
| 133 |
+
#if !defined(__storage_static__surf__)
|
| 134 |
+
#define __storage_static__surf__ static __var_used__
|
| 135 |
+
#endif /* __storage_static__surf__ */
|
| 136 |
+
|
| 137 |
+
#endif /* !__STORAGE_CLASS_H__ */
|
| 138 |
+
|
| 139 |
+
#if defined(__UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_STORAGE_CLASS_H__)
|
| 140 |
+
#undef __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
|
| 141 |
+
#undef __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_STORAGE_CLASS_H__
|
| 142 |
+
#endif
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/__init__.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .compiler import CompiledKernel, ASTSource, IRSource, compile, make_backend, LazyDict, get_cache_key
|
| 2 |
+
from .errors import CompilationError
|
| 3 |
+
|
| 4 |
+
__all__ = [
|
| 5 |
+
"compile", "make_backend", "ASTSource", "IRSource", "CompiledKernel", "CompilationError", "LazyDict",
|
| 6 |
+
"get_cache_key"
|
| 7 |
+
]
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/code_generator.py
ADDED
|
@@ -0,0 +1,1639 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ast
|
| 2 |
+
import builtins
|
| 3 |
+
import contextlib
|
| 4 |
+
import copy
|
| 5 |
+
import inspect
|
| 6 |
+
import re
|
| 7 |
+
import warnings
|
| 8 |
+
import textwrap
|
| 9 |
+
from dataclasses import dataclass
|
| 10 |
+
from types import ModuleType
|
| 11 |
+
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union, Iterable, List
|
| 12 |
+
|
| 13 |
+
from .. import knobs, language
|
| 14 |
+
from .._C.libtriton import ir, gluon_ir
|
| 15 |
+
from ..language import constexpr, str_to_ty, tensor, tuple as tl_tuple
|
| 16 |
+
from ..language.core import _unwrap_if_constexpr, base_value, base_type
|
| 17 |
+
# ideally we wouldn't need any runtime component
|
| 18 |
+
from ..runtime.jit import get_jit_fn_file_line, get_full_name, JITCallable, BoundConstexprFunction, ConstexprFunction, JITFunction
|
| 19 |
+
from .._utils import find_paths_if, get_iterable_path, set_iterable_path, is_namedtuple
|
| 20 |
+
|
| 21 |
+
from .errors import (CompilationError, CompileTimeAssertionFailure, UnsupportedLanguageConstruct)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def check_identifier_legality(name, type):
|
| 25 |
+
pattern = r'^[a-zA-Z_][a-zA-Z0-9_]*$'
|
| 26 |
+
if not re.match(pattern, name):
|
| 27 |
+
raise CompilationError(f"invalid {type} identifier: {name}", name)
|
| 28 |
+
return name
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
def mangle_fn(name, arg_tys, constants, caller_context):
|
| 32 |
+
# doesn't mangle ret type, which must be a function of arg tys
|
| 33 |
+
mangled_arg_names = '_'.join([ty.mangle() for ty in arg_tys])
|
| 34 |
+
mangled_constants = '_'.join([f'{i}c{repr(constants[i])}' for i in sorted(constants)])
|
| 35 |
+
mangled_constants = mangled_constants.replace('.', '_d_')
|
| 36 |
+
mangled_constants = mangled_constants.replace("'", '_sq_')
|
| 37 |
+
# [ and ] are not allowed in LLVM identifiers
|
| 38 |
+
mangled_constants = mangled_constants.replace('[', '_').replace(']', '_')
|
| 39 |
+
ret = f'{name}__{mangled_arg_names}__{mangled_constants}'
|
| 40 |
+
if caller_context is not None:
|
| 41 |
+
ret += caller_context.mangle()
|
| 42 |
+
return ret
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
def _is_triton_value(o: Any) -> bool:
|
| 46 |
+
return isinstance(o, base_value)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def _is_triton_tensor(o: Any) -> bool:
|
| 50 |
+
return isinstance(o, tensor)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def _is_constexpr(o: Any) -> bool:
|
| 54 |
+
return o is None or isinstance(o, (constexpr, language.core.dtype, JITCallable))
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
def _is_non_scalar_tensor(o: Any) -> bool:
|
| 58 |
+
return _is_triton_tensor(o) and (o.type.is_block() and o.type.numel != 1)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def _is_list_like(o: Any) -> bool:
|
| 62 |
+
return isinstance(o, (list, tuple))
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def _check_fn_args(node, fn, args):
|
| 66 |
+
if fn.noinline:
|
| 67 |
+
for idx, arg in enumerate(args):
|
| 68 |
+
if not _is_constexpr(arg) and _is_non_scalar_tensor(arg):
|
| 69 |
+
raise UnsupportedLanguageConstruct(
|
| 70 |
+
fn.src, node,
|
| 71 |
+
f'Function {fn.__name__} is marked noinline, but was called with non-scalar argument {fn.arg_names[idx]}:{arg}'
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def _apply_to_tuple_values(value, fn):
|
| 76 |
+
if is_namedtuple(type(value)):
|
| 77 |
+
fields = value._fields
|
| 78 |
+
elif isinstance(value, language.tuple):
|
| 79 |
+
fields = value.type.fields
|
| 80 |
+
else:
|
| 81 |
+
assert False, f"Unsupported type {type(value)}"
|
| 82 |
+
|
| 83 |
+
vals = [fn(v) for v in value]
|
| 84 |
+
vals = [constexpr(v) if v is None else v for v in vals]
|
| 85 |
+
types = [v.type for v in vals]
|
| 86 |
+
return language.tuple(vals, language.tuple_type(types, fields))
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
def flatten_values_to_ir(values: Iterable[base_value]):
|
| 90 |
+
handles = []
|
| 91 |
+
for v in values:
|
| 92 |
+
v._flatten_ir(handles)
|
| 93 |
+
return handles
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def unflatten_ir_values(handles: List[ir.value], types: List[base_type]):
|
| 97 |
+
cursor = 0
|
| 98 |
+
for ty in types:
|
| 99 |
+
value, cursor = ty._unflatten_ir(handles, cursor)
|
| 100 |
+
yield value
|
| 101 |
+
assert cursor == len(handles)
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
_condition_types = {bool, int, type(None)} # Python types accepted for conditionals inside kernels
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
def _clone_triton_value(val):
|
| 108 |
+
handles = []
|
| 109 |
+
val._flatten_ir(handles)
|
| 110 |
+
clone, _ = val.type._unflatten_ir(handles, 0)
|
| 111 |
+
return clone
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
def _clone_scope(scope):
|
| 115 |
+
return {name: _clone_triton_value(val) if _is_triton_value(val) else val for name, val in scope.items()}
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
class enter_sub_region:
|
| 119 |
+
|
| 120 |
+
def __init__(self, generator):
|
| 121 |
+
self.generator = generator
|
| 122 |
+
|
| 123 |
+
def __enter__(self):
|
| 124 |
+
# record lscope & local_defs in the parent scope
|
| 125 |
+
self.liveins = _clone_scope(self.generator.lscope)
|
| 126 |
+
self.prev_defs = _clone_scope(self.generator.local_defs)
|
| 127 |
+
self.generator.local_defs = {}
|
| 128 |
+
self.insert_block = self.generator.builder.get_insertion_block()
|
| 129 |
+
self.insert_point = self.generator.builder.get_insertion_point()
|
| 130 |
+
return self.liveins, self.insert_block
|
| 131 |
+
|
| 132 |
+
def __exit__(self, *args, **kwargs):
|
| 133 |
+
self.generator.builder.restore_insertion_point(self.insert_point)
|
| 134 |
+
self.generator.lscope = self.liveins
|
| 135 |
+
self.generator.local_defs = self.prev_defs
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
# Check if the given syntax node has an "early" return
|
| 139 |
+
class ContainsReturnChecker(ast.NodeVisitor):
|
| 140 |
+
|
| 141 |
+
def __init__(self, gscope):
|
| 142 |
+
self.gscope = gscope
|
| 143 |
+
|
| 144 |
+
def _visit_stmts(self, body) -> bool:
|
| 145 |
+
return any(self.visit(s) for s in body)
|
| 146 |
+
|
| 147 |
+
def _visit_function(self, fn) -> bool:
|
| 148 |
+
# No need to check within the function as it won't cause an early return.
|
| 149 |
+
# If the function itself has unstructured control flow we may not be able to inline it causing poor performance,
|
| 150 |
+
# we should check for this and emit a warning.
|
| 151 |
+
return False
|
| 152 |
+
|
| 153 |
+
def generic_visit(self, node) -> bool:
|
| 154 |
+
ret = False
|
| 155 |
+
for _, value in ast.iter_fields(node):
|
| 156 |
+
if isinstance(value, list):
|
| 157 |
+
for item in value:
|
| 158 |
+
if isinstance(item, ast.AST):
|
| 159 |
+
ret = ret or self.visit(item)
|
| 160 |
+
elif isinstance(value, ast.AST):
|
| 161 |
+
ret = ret or self.visit(value)
|
| 162 |
+
return ret
|
| 163 |
+
|
| 164 |
+
def visit_Attribute(self, node: ast.Attribute) -> bool:
|
| 165 |
+
# If the left part is a name, it's possible that
|
| 166 |
+
# we call triton native function or a jit function from another module.
|
| 167 |
+
# If the left part is not a name, it must return a tensor or a constexpr
|
| 168 |
+
# whose methods do not contain return statements
|
| 169 |
+
# e.g., (tl.load(x)).to(y)
|
| 170 |
+
# So we only check if the expressions within value have return or not
|
| 171 |
+
if isinstance(node.value, ast.Name):
|
| 172 |
+
if node.value.id in self.gscope:
|
| 173 |
+
value = self.gscope[node.value.id]
|
| 174 |
+
fn = getattr(value, node.attr)
|
| 175 |
+
return self._visit_function(fn)
|
| 176 |
+
return False
|
| 177 |
+
return self.visit(node.value)
|
| 178 |
+
|
| 179 |
+
def visit_Name(self, node: ast.Name) -> bool:
|
| 180 |
+
if type(node.ctx) is ast.Store:
|
| 181 |
+
return False
|
| 182 |
+
if node.id in self.gscope:
|
| 183 |
+
fn = self.gscope[node.id]
|
| 184 |
+
return self._visit_function(fn)
|
| 185 |
+
return False
|
| 186 |
+
|
| 187 |
+
def visit_Return(self, node: ast.Return) -> bool:
|
| 188 |
+
return True
|
| 189 |
+
|
| 190 |
+
def visit_Assign(self, node: ast.Assign) -> bool:
|
| 191 |
+
# There couldn't be an early return
|
| 192 |
+
# x = ...
|
| 193 |
+
return False
|
| 194 |
+
|
| 195 |
+
def visit_AugAssign(self, node: ast.AugAssign) -> bool:
|
| 196 |
+
# There couldn't be an early return
|
| 197 |
+
# x += ...
|
| 198 |
+
return False
|
| 199 |
+
|
| 200 |
+
def visit_Module(self, node: ast.Module) -> bool:
|
| 201 |
+
return self._visit_stmts(node.body)
|
| 202 |
+
|
| 203 |
+
def visit_FunctionDef(self, node: ast.FunctionDef) -> bool:
|
| 204 |
+
return self._visit_stmts(node.body)
|
| 205 |
+
|
| 206 |
+
def visit_If(self, node: ast.If) -> bool:
|
| 207 |
+
# TODO: optimize the following case in which we actually don't have
|
| 208 |
+
# a return when static_cond is false:
|
| 209 |
+
# if dynamic_cond
|
| 210 |
+
# if static_cond
|
| 211 |
+
# func_with_return
|
| 212 |
+
# else
|
| 213 |
+
# func_without_return
|
| 214 |
+
ret = self._visit_stmts(node.body)
|
| 215 |
+
if node.orelse:
|
| 216 |
+
ret = ret or self._visit_stmts(node.orelse)
|
| 217 |
+
return ret
|
| 218 |
+
|
| 219 |
+
def visit_IfExp(self, node: ast.IfExp) -> bool:
|
| 220 |
+
return self.visit(node.body) or self.visit(node.orelse)
|
| 221 |
+
|
| 222 |
+
def visit_Call(self, node: ast.Call) -> bool:
|
| 223 |
+
return self.visit(node.func)
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
class ASTFunction:
|
| 227 |
+
|
| 228 |
+
def __init__(self, ret_types, arg_types, constants, attrs):
|
| 229 |
+
self.ret_types = ret_types
|
| 230 |
+
self.arg_types = arg_types
|
| 231 |
+
self.constants = constants
|
| 232 |
+
self.attrs = attrs
|
| 233 |
+
|
| 234 |
+
def flatten_ir_types(self, builder: ir.builder, types: List[base_type]) -> List[ir.type]:
|
| 235 |
+
ir_types = []
|
| 236 |
+
for ty in types:
|
| 237 |
+
if ty is None:
|
| 238 |
+
continue
|
| 239 |
+
ty._flatten_ir_types(builder, ir_types)
|
| 240 |
+
return ir_types
|
| 241 |
+
|
| 242 |
+
def return_types_ir(self, builder: ir.builder) -> List[ir.type]:
|
| 243 |
+
return self.flatten_ir_types(builder, self.ret_types)
|
| 244 |
+
|
| 245 |
+
def serialize(self, builder: ir.builder):
|
| 246 |
+
# fill up IR values in template
|
| 247 |
+
# > build function
|
| 248 |
+
is_val = lambda path, _: path not in self.constants and _ is not None
|
| 249 |
+
val_paths = list(find_paths_if(self.arg_types, is_val))
|
| 250 |
+
arg_types = [get_iterable_path(self.arg_types, path) for path in val_paths]
|
| 251 |
+
arg_types_ir = self.flatten_ir_types(builder, arg_types)
|
| 252 |
+
ret_types_ir = self.return_types_ir(builder)
|
| 253 |
+
return builder.get_function_ty(arg_types_ir, ret_types_ir)
|
| 254 |
+
|
| 255 |
+
def deserialize(self, fn):
|
| 256 |
+
# create "template"
|
| 257 |
+
def make_template(ty):
|
| 258 |
+
if isinstance(ty, (list, tuple, language.tuple_type)):
|
| 259 |
+
return language.tuple([make_template(x) for x in ty], ty)
|
| 260 |
+
return language.constexpr(None)
|
| 261 |
+
|
| 262 |
+
vals = make_template(self.arg_types)
|
| 263 |
+
is_val = lambda path, _: path not in self.constants and _ is not None
|
| 264 |
+
val_paths = list(find_paths_if(self.arg_types, is_val))
|
| 265 |
+
# > add IR values to the template
|
| 266 |
+
cursor = 0
|
| 267 |
+
handles = [fn.args(i) for i in range(fn.get_num_args())]
|
| 268 |
+
for path in val_paths:
|
| 269 |
+
ty = get_iterable_path(self.arg_types, path)
|
| 270 |
+
# > set attributes
|
| 271 |
+
attr_specs = self.attrs.get(path, [])
|
| 272 |
+
for attr_name, attr_val in attr_specs:
|
| 273 |
+
fn.set_arg_attr(cursor, attr_name, attr_val)
|
| 274 |
+
# > build frontend value
|
| 275 |
+
val, cursor = ty._unflatten_ir(handles, cursor)
|
| 276 |
+
set_iterable_path(vals, path, val)
|
| 277 |
+
# > add constexpr values to the template
|
| 278 |
+
constants = self.constants
|
| 279 |
+
for path, val in constants.items():
|
| 280 |
+
set_iterable_path(vals, path, language.constexpr(val))
|
| 281 |
+
return vals
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
@dataclass(frozen=True)
|
| 285 |
+
class BoundJITMethod:
|
| 286 |
+
__self__: base_value
|
| 287 |
+
__func__: JITFunction
|
| 288 |
+
|
| 289 |
+
|
| 290 |
+
class CodeGenerator(ast.NodeVisitor):
|
| 291 |
+
|
| 292 |
+
def __init__(self, context, prototype, gscope, function_name, jit_fn: JITFunction, *, options, codegen_fns,
|
| 293 |
+
module_map, is_gluon, module=None, is_kernel=False, function_types: Optional[Dict] = None,
|
| 294 |
+
noinline=False, caller_context=None, file_name: Optional[str] = None, begin_line=0):
|
| 295 |
+
self.context = context
|
| 296 |
+
self.is_gluon = is_gluon
|
| 297 |
+
if is_gluon:
|
| 298 |
+
from triton.experimental.gluon.language._semantic import GluonSemantic
|
| 299 |
+
self.builder = gluon_ir.GluonOpBuilder(context)
|
| 300 |
+
self.semantic = GluonSemantic(self.builder)
|
| 301 |
+
else:
|
| 302 |
+
from triton.language.semantic import TritonSemantic
|
| 303 |
+
self.builder = ir.builder(context)
|
| 304 |
+
self.semantic = TritonSemantic(self.builder)
|
| 305 |
+
|
| 306 |
+
self.name_loc_as_prefix = None
|
| 307 |
+
self.file_name = file_name
|
| 308 |
+
# node.lineno starts from 1, so we need to subtract 1
|
| 309 |
+
self.begin_line = begin_line - 1
|
| 310 |
+
self.builder.set_loc(file_name, begin_line, 0)
|
| 311 |
+
self.builder.options = options
|
| 312 |
+
# dict of functions provided by the backend. Below are the list of possible functions:
|
| 313 |
+
# Convert custom types not natively supported on HW.
|
| 314 |
+
# convert_custom_types(input_tensor, dtype, fp_downcast_rounding=None, _builder=None)
|
| 315 |
+
self.builder.codegen_fns = codegen_fns
|
| 316 |
+
self.builder.module_map = {} if module_map is None else module_map
|
| 317 |
+
self.module = self.builder.create_module() if module is None else module
|
| 318 |
+
self.function_ret_types = {} if function_types is None else function_types
|
| 319 |
+
self.prototype = prototype
|
| 320 |
+
|
| 321 |
+
self.gscope = {}
|
| 322 |
+
for k, v in gscope.items():
|
| 323 |
+
if isinstance(v, ModuleType):
|
| 324 |
+
self.gscope[k] = module_map.get(v.__name__, v)
|
| 325 |
+
continue
|
| 326 |
+
|
| 327 |
+
module_name = getattr(v, "__module__", "")
|
| 328 |
+
if module_name in module_map:
|
| 329 |
+
self.gscope[k] = getattr(module_map[module_name], v.__name__)
|
| 330 |
+
else:
|
| 331 |
+
self.gscope[k] = v
|
| 332 |
+
|
| 333 |
+
self.lscope = {}
|
| 334 |
+
self.jit_fn = jit_fn
|
| 335 |
+
# TODO: we currently generate illegal names for non-kernel functions involving constexprs!
|
| 336 |
+
if is_kernel:
|
| 337 |
+
function_name = function_name[function_name.rfind('.') + 1:]
|
| 338 |
+
function_name = check_identifier_legality(function_name, "function")
|
| 339 |
+
self.function_name = function_name
|
| 340 |
+
self.is_kernel = is_kernel
|
| 341 |
+
self.cur_node = None
|
| 342 |
+
self.noinline = noinline
|
| 343 |
+
self.caller_context = caller_context
|
| 344 |
+
self.scf_stack = []
|
| 345 |
+
self.ret_type = None
|
| 346 |
+
# SSA-construction
|
| 347 |
+
# name => language.tensor
|
| 348 |
+
self.local_defs: Dict[str, tensor] = {}
|
| 349 |
+
self.dereference_name: Callable[[str], Any] = self._define_name_lookup()
|
| 350 |
+
self.fn = None
|
| 351 |
+
# Are we currently visiting an ast.arg's default value? These have some
|
| 352 |
+
# special handling.
|
| 353 |
+
self.visiting_arg_default_value = False
|
| 354 |
+
|
| 355 |
+
builtin_namespace: Dict[str, Any] = {
|
| 356 |
+
_.__name__: _
|
| 357 |
+
for _ in (len, list, range, float, int, isinstance, getattr, hasattr)
|
| 358 |
+
}
|
| 359 |
+
builtin_namespace.update((
|
| 360 |
+
('print', language.core.device_print),
|
| 361 |
+
('min', language.core.builtin_min),
|
| 362 |
+
('max', language.core.builtin_max),
|
| 363 |
+
))
|
| 364 |
+
|
| 365 |
+
def _unsupported(self, node, message):
|
| 366 |
+
return UnsupportedLanguageConstruct(self.jit_fn.src, node, message)
|
| 367 |
+
|
| 368 |
+
def _is_constexpr_global(self, name):
|
| 369 |
+
absent_marker = object()
|
| 370 |
+
val = self.gscope.get(name, absent_marker)
|
| 371 |
+
if val is absent_marker:
|
| 372 |
+
return False
|
| 373 |
+
|
| 374 |
+
if _is_constexpr(val):
|
| 375 |
+
return True
|
| 376 |
+
|
| 377 |
+
return False
|
| 378 |
+
|
| 379 |
+
def _define_name_lookup(self):
|
| 380 |
+
|
| 381 |
+
def local_lookup(name: str, absent):
|
| 382 |
+
# this needs to be re-fetched from `self` every time, because it gets switched occasionally
|
| 383 |
+
return self.lscope.get(name, absent)
|
| 384 |
+
|
| 385 |
+
def global_lookup(name: str, absent):
|
| 386 |
+
val = self.gscope.get(name, absent)
|
| 387 |
+
# The high-level rule is that only constexpr globals are allowed.
|
| 388 |
+
# But actually a bunch of other things, such as module imports, are
|
| 389 |
+
# technically Python globals. We have to allow these too!
|
| 390 |
+
if any([
|
| 391 |
+
val is absent,
|
| 392 |
+
name in self.builtin_namespace, #
|
| 393 |
+
type(val) is ModuleType, #
|
| 394 |
+
isinstance(val, JITCallable), #
|
| 395 |
+
getattr(val, "__triton_builtin__", False), #
|
| 396 |
+
getattr(val, "__triton_aggregate__", False), #
|
| 397 |
+
getattr(val, "__module__", "").startswith("triton.language"), #
|
| 398 |
+
getattr(val, "__module__", "").startswith("triton.experimental.gluon.language"), #
|
| 399 |
+
isinstance(val, language.dtype), #
|
| 400 |
+
is_namedtuple(val),
|
| 401 |
+
self._is_constexpr_global(name), #
|
| 402 |
+
# Allow accesses to globals while visiting an ast.arg
|
| 403 |
+
# because you should be able to do
|
| 404 |
+
# @triton.jit def fn(x: tl.constexpr = GLOBAL): ...
|
| 405 |
+
self.visiting_arg_default_value, #
|
| 406 |
+
knobs.compilation.allow_non_constexpr_globals,
|
| 407 |
+
]):
|
| 408 |
+
return val
|
| 409 |
+
raise NameError(
|
| 410 |
+
textwrap.dedent(f"""\
|
| 411 |
+
Cannot access global variable {name} from within @jit'ed
|
| 412 |
+
function. Triton kernels can only access global variables that
|
| 413 |
+
are instanstiated as constexpr (`x = triton.language.constexpr(42)`). Note that this is different from
|
| 414 |
+
annotating a variable as constexpr (`x: triton.language.constexpr = 42`), which is not supported. Alternatively, set the
|
| 415 |
+
envvar TRITON_ALLOW_NON_CONSTEXPR_GLOBALS=1, but we do not
|
| 416 |
+
promise to support this forever.""").replace("\n", " "))
|
| 417 |
+
|
| 418 |
+
absent_marker = object()
|
| 419 |
+
|
| 420 |
+
def name_lookup(name: str) -> Any:
|
| 421 |
+
absent = absent_marker
|
| 422 |
+
for lookup_function in local_lookup, global_lookup, self.builtin_namespace.get:
|
| 423 |
+
value = lookup_function(name, absent)
|
| 424 |
+
if value is not absent:
|
| 425 |
+
return value
|
| 426 |
+
raise NameError(f'{name} is not defined')
|
| 427 |
+
|
| 428 |
+
return name_lookup
|
| 429 |
+
|
| 430 |
+
@contextlib.contextmanager
|
| 431 |
+
def _name_loc_prefix(self, prefix):
|
| 432 |
+
self.name_loc_as_prefix = prefix
|
| 433 |
+
yield
|
| 434 |
+
self.name_loc_as_prefix = None
|
| 435 |
+
|
| 436 |
+
def _maybe_set_loc_to_name(self, val, name):
|
| 437 |
+
if isinstance(val, (ir.value, ir.block_argument)):
|
| 438 |
+
val.set_loc(self.builder.create_name_loc(name, val.get_loc()))
|
| 439 |
+
elif _is_triton_value(val):
|
| 440 |
+
handles = []
|
| 441 |
+
val._flatten_ir(handles)
|
| 442 |
+
for handle in handles:
|
| 443 |
+
handle.set_loc(self.builder.create_name_loc(name, handle.get_loc()))
|
| 444 |
+
|
| 445 |
+
def set_value(self, name: str, value: Union[base_value, constexpr]) -> None:
|
| 446 |
+
''' This function:
|
| 447 |
+
called by visit_Assign() & visit_FunctionDef() to store left value (lvalue)
|
| 448 |
+
1. record local defined name (FIXME: should consider control flow)
|
| 449 |
+
2. store tensor in self.lvalue
|
| 450 |
+
'''
|
| 451 |
+
self.lscope[name] = value
|
| 452 |
+
self.local_defs[name] = value
|
| 453 |
+
|
| 454 |
+
def _get_insertion_point_and_loc(self):
|
| 455 |
+
# XXX: this is a hack to get the location of the insertion point.
|
| 456 |
+
# The insertion point's location could be invalid sometimes,
|
| 457 |
+
# so we need to explicitly set the location
|
| 458 |
+
loc = self.builder.get_loc()
|
| 459 |
+
ip = self.builder.get_insertion_point()
|
| 460 |
+
return ip, loc
|
| 461 |
+
|
| 462 |
+
def _set_insertion_point_and_loc(self, ip, loc):
|
| 463 |
+
self.builder.restore_insertion_point(ip)
|
| 464 |
+
self.builder.set_loc(loc)
|
| 465 |
+
|
| 466 |
+
def _find_carries(self, node, liveins, ignore: set[str] = set()):
|
| 467 |
+
# create loop body block
|
| 468 |
+
block = self.builder.create_block()
|
| 469 |
+
self.builder.set_insertion_point_to_start(block)
|
| 470 |
+
# dry visit loop body
|
| 471 |
+
self.scf_stack.append(node)
|
| 472 |
+
self.visit_compound_statement(node.body)
|
| 473 |
+
self.scf_stack.pop()
|
| 474 |
+
block.erase()
|
| 475 |
+
|
| 476 |
+
# If a variable (name) has changed value within the loop, then it's
|
| 477 |
+
# a loop-carried variable. (The new and old value must be of the
|
| 478 |
+
# same type)
|
| 479 |
+
init_tys = []
|
| 480 |
+
init_handles = []
|
| 481 |
+
names = []
|
| 482 |
+
|
| 483 |
+
for name, live_val in liveins.items():
|
| 484 |
+
if name in ignore:
|
| 485 |
+
continue
|
| 486 |
+
|
| 487 |
+
if _is_triton_value(live_val):
|
| 488 |
+
loop_val = self.lscope[name]
|
| 489 |
+
self._verify_loop_carried_variable(name, loop_val, live_val)
|
| 490 |
+
|
| 491 |
+
live_handles = flatten_values_to_ir([live_val])
|
| 492 |
+
loop_handles = flatten_values_to_ir([loop_val])
|
| 493 |
+
if live_handles != loop_handles:
|
| 494 |
+
names.append(name)
|
| 495 |
+
init_tys.append(live_val.type)
|
| 496 |
+
init_handles.extend(live_handles)
|
| 497 |
+
else:
|
| 498 |
+
assert name not in self.local_defs, f'Loop carried variable {name} is not a triton value'
|
| 499 |
+
|
| 500 |
+
# reset local scope to not pick up local defs from the dry run.
|
| 501 |
+
self.lscope = liveins.copy()
|
| 502 |
+
self.local_defs = {}
|
| 503 |
+
|
| 504 |
+
return names, init_handles, init_tys
|
| 505 |
+
|
| 506 |
+
#
|
| 507 |
+
# AST visitor
|
| 508 |
+
#
|
| 509 |
+
def visit_compound_statement(self, stmts):
|
| 510 |
+
# Ensure that stmts is iterable
|
| 511 |
+
if not _is_list_like(stmts):
|
| 512 |
+
stmts = [stmts]
|
| 513 |
+
for stmt in stmts:
|
| 514 |
+
self.visit(stmt)
|
| 515 |
+
# Stop parsing as soon as we hit a `return` statement; everything
|
| 516 |
+
# after this is dead code.
|
| 517 |
+
if isinstance(stmt, ast.Return):
|
| 518 |
+
break
|
| 519 |
+
|
| 520 |
+
def visit_Module(self, node):
|
| 521 |
+
ast.NodeVisitor.generic_visit(self, node)
|
| 522 |
+
|
| 523 |
+
def visit_List(self, node):
|
| 524 |
+
ctx = self.visit(node.ctx)
|
| 525 |
+
assert ctx is None
|
| 526 |
+
elts = language.tuple([self.visit(elt) for elt in node.elts])
|
| 527 |
+
return elts
|
| 528 |
+
|
| 529 |
+
def visit_ListComp(self, node: ast.ListComp):
|
| 530 |
+
if len(node.generators) != 1:
|
| 531 |
+
raise ValueError("nested comprehensions are not supported")
|
| 532 |
+
|
| 533 |
+
comp = node.generators[0]
|
| 534 |
+
iter = self.visit(comp.iter)
|
| 535 |
+
if not isinstance(iter, tl_tuple):
|
| 536 |
+
raise NotImplementedError("only tuple comprehensions are supported")
|
| 537 |
+
|
| 538 |
+
results = []
|
| 539 |
+
for item in iter:
|
| 540 |
+
self.set_value(comp.target.id, item)
|
| 541 |
+
results.append(self.visit(node.elt))
|
| 542 |
+
return tl_tuple(results)
|
| 543 |
+
|
| 544 |
+
# By design, only non-kernel functions can return
|
| 545 |
+
def visit_Return(self, node):
|
| 546 |
+
ret_value = self.visit(node.value)
|
| 547 |
+
handles = []
|
| 548 |
+
|
| 549 |
+
def decay(value):
|
| 550 |
+
if isinstance(value, language.tuple):
|
| 551 |
+
return _apply_to_tuple_values(value, decay)
|
| 552 |
+
elif isinstance(value, (language.constexpr, int, float)):
|
| 553 |
+
return self.semantic.to_tensor(value)
|
| 554 |
+
return value
|
| 555 |
+
|
| 556 |
+
ret_value = decay(ret_value)
|
| 557 |
+
|
| 558 |
+
if ret_value is None:
|
| 559 |
+
ret_ty = language.void
|
| 560 |
+
else:
|
| 561 |
+
assert isinstance(ret_value, language.core.base_value)
|
| 562 |
+
ret_value._flatten_ir(handles)
|
| 563 |
+
ret_ty = ret_value.type
|
| 564 |
+
self.builder.ret(handles)
|
| 565 |
+
if self.ret_type is None:
|
| 566 |
+
self.ret_type = ret_ty
|
| 567 |
+
elif self.ret_type != ret_ty:
|
| 568 |
+
raise TypeError(f'Inconsistent return types: {self.ret_type} and {ret_ty}')
|
| 569 |
+
|
| 570 |
+
# A return op must always terminate the basic block, so we create a dead
|
| 571 |
+
# basic block in case there are any ops after the return.
|
| 572 |
+
post_ret_block = self.builder.create_block()
|
| 573 |
+
self.builder.set_insertion_point_to_end(post_ret_block)
|
| 574 |
+
|
| 575 |
+
def visit_FunctionDef(self, node):
|
| 576 |
+
arg_names, kwarg_names = self.visit(node.args)
|
| 577 |
+
if self.fn:
|
| 578 |
+
raise self._unsupported(node, "nested function definition is not supported.")
|
| 579 |
+
# initialize defaults
|
| 580 |
+
for i, default_value in enumerate(node.args.defaults[::-1]):
|
| 581 |
+
arg_node = node.args.args[-i - 1]
|
| 582 |
+
annotation = arg_node.annotation
|
| 583 |
+
name = arg_node.arg
|
| 584 |
+
st_target = ast.Name(id=name, ctx=ast.Store())
|
| 585 |
+
if annotation is None:
|
| 586 |
+
init_node = ast.Assign(targets=[st_target], value=default_value)
|
| 587 |
+
else:
|
| 588 |
+
init_node = ast.AnnAssign(target=st_target, value=default_value, annotation=annotation)
|
| 589 |
+
try:
|
| 590 |
+
assert not self.visiting_arg_default_value
|
| 591 |
+
self.visiting_arg_default_value = True
|
| 592 |
+
self.visit(init_node)
|
| 593 |
+
finally:
|
| 594 |
+
self.visiting_arg_default_value = False
|
| 595 |
+
|
| 596 |
+
# initialize function
|
| 597 |
+
visibility = "public" if self.is_kernel else "private"
|
| 598 |
+
fn_ty = self.prototype.serialize(self.builder)
|
| 599 |
+
self.fn = self.builder.get_or_insert_function(self.module, self.function_name, fn_ty, visibility, self.noinline)
|
| 600 |
+
self.module.push_back(self.fn)
|
| 601 |
+
entry = self.fn.add_entry_block()
|
| 602 |
+
arg_values = self.prototype.deserialize(self.fn)
|
| 603 |
+
if self.caller_context is not None:
|
| 604 |
+
self.caller_context.initialize_callee(self.fn, self.builder)
|
| 605 |
+
# bind arguments to symbols
|
| 606 |
+
for arg_name, arg_value in zip(arg_names, arg_values):
|
| 607 |
+
self._maybe_set_loc_to_name(arg_value, arg_name)
|
| 608 |
+
self.set_value(arg_name, arg_value)
|
| 609 |
+
insert_pt = self.builder.get_insertion_block()
|
| 610 |
+
self.builder.set_insertion_point_to_start(entry)
|
| 611 |
+
# visit function body
|
| 612 |
+
self.visit_compound_statement(node.body)
|
| 613 |
+
|
| 614 |
+
# finalize function
|
| 615 |
+
assert not self.builder.get_insertion_block().has_terminator()
|
| 616 |
+
if self.ret_type is None or self.ret_type == language.void:
|
| 617 |
+
self.ret_type = language.void
|
| 618 |
+
self.builder.ret([])
|
| 619 |
+
else:
|
| 620 |
+
if isinstance(self.ret_type, language.tuple_type):
|
| 621 |
+
self.prototype.ret_types = self.ret_type.types
|
| 622 |
+
else:
|
| 623 |
+
self.prototype.ret_types = [self.ret_type]
|
| 624 |
+
self.fn.reset_type(self.prototype.serialize(self.builder))
|
| 625 |
+
self.builder.ret([self.builder.create_poison(ty) for ty in self.prototype.return_types_ir(self.builder)])
|
| 626 |
+
self.fn.finalize()
|
| 627 |
+
|
| 628 |
+
if insert_pt:
|
| 629 |
+
self.builder.set_insertion_point_to_end(insert_pt)
|
| 630 |
+
|
| 631 |
+
def visit_arguments(self, node):
|
| 632 |
+
arg_names = []
|
| 633 |
+
for arg in node.args:
|
| 634 |
+
arg_names += [self.visit(arg)]
|
| 635 |
+
kwarg_names = self.visit(node.kwarg)
|
| 636 |
+
return arg_names, kwarg_names
|
| 637 |
+
|
| 638 |
+
def visit_arg(self, node):
|
| 639 |
+
ast.NodeVisitor.generic_visit(self, node)
|
| 640 |
+
param = next(p for p in self.jit_fn.params if p.name == node.arg)
|
| 641 |
+
if param.is_constexpr and (param.do_not_specialize or param.do_not_specialize_on_alignment):
|
| 642 |
+
raise CompilationError(
|
| 643 |
+
self.jit_fn.src, node,
|
| 644 |
+
f"{node.arg} marked as constexpr and listed in do_not_specialize/do_not_specialize_on_alignment. "
|
| 645 |
+
"Remove constexpr designation to skip specialization.")
|
| 646 |
+
return node.arg
|
| 647 |
+
|
| 648 |
+
def visit_AnnAssign(self, node):
|
| 649 |
+
# extract attributes
|
| 650 |
+
annotation = self.visit(node.annotation)
|
| 651 |
+
target = self.visit(node.target)
|
| 652 |
+
value = self.visit(node.value)
|
| 653 |
+
# constexpr
|
| 654 |
+
if annotation == constexpr:
|
| 655 |
+
if target in self.lscope:
|
| 656 |
+
raise ValueError(f'{target} is already defined.'
|
| 657 |
+
f' constexpr cannot be reassigned.')
|
| 658 |
+
value = constexpr(value)
|
| 659 |
+
self.lscope[target] = value
|
| 660 |
+
return self.lscope[target]
|
| 661 |
+
# default: call visit_Assign
|
| 662 |
+
return self.visit_Assign(node)
|
| 663 |
+
|
| 664 |
+
def assignTarget(self, target, value):
|
| 665 |
+
assert isinstance(target.ctx, ast.Store)
|
| 666 |
+
if isinstance(target, ast.Subscript):
|
| 667 |
+
return self.visit_Subscript_Store(target, value)
|
| 668 |
+
if isinstance(target, ast.Tuple):
|
| 669 |
+
for i, target in enumerate(target.elts):
|
| 670 |
+
self.assignTarget(target, value.values[i])
|
| 671 |
+
return
|
| 672 |
+
if isinstance(target, ast.Attribute):
|
| 673 |
+
raise NotImplementedError("Attribute assignment is not supported in triton")
|
| 674 |
+
assert isinstance(target, ast.Name)
|
| 675 |
+
self.set_value(self.visit(target), value)
|
| 676 |
+
|
| 677 |
+
def visit_Assign(self, node):
|
| 678 |
+
# construct values to assign
|
| 679 |
+
def _sanitize_value(value):
|
| 680 |
+
if isinstance(value, language.tuple):
|
| 681 |
+
return _apply_to_tuple_values(value, _sanitize_value)
|
| 682 |
+
native_nontensor_types = (language.dtype, language.tuple)
|
| 683 |
+
value = _unwrap_if_constexpr(value)
|
| 684 |
+
if value is not None and \
|
| 685 |
+
not _is_triton_value(value) and \
|
| 686 |
+
not isinstance(value, native_nontensor_types):
|
| 687 |
+
value = self.semantic.to_tensor(value)
|
| 688 |
+
return value
|
| 689 |
+
|
| 690 |
+
targets = [node.target] if isinstance(node, ast.AnnAssign) else node.targets
|
| 691 |
+
assert len(targets) == 1
|
| 692 |
+
target = targets[0]
|
| 693 |
+
if isinstance(target, ast.Name):
|
| 694 |
+
with self._name_loc_prefix(target.id):
|
| 695 |
+
values = _sanitize_value(self.visit(node.value))
|
| 696 |
+
else:
|
| 697 |
+
values = _sanitize_value(self.visit(node.value))
|
| 698 |
+
self.assignTarget(target, values)
|
| 699 |
+
|
| 700 |
+
def visit_AugAssign(self, node):
|
| 701 |
+
lhs = copy.deepcopy(node.target)
|
| 702 |
+
lhs.ctx = ast.Load()
|
| 703 |
+
rhs = ast.BinOp(lhs, node.op, node.value)
|
| 704 |
+
assign = ast.Assign(targets=[node.target], value=rhs)
|
| 705 |
+
for x in ['lineno', 'col_offset', 'end_lineno', 'end_col_offset']:
|
| 706 |
+
if hasattr(node, x):
|
| 707 |
+
y = getattr(node, x)
|
| 708 |
+
setattr(rhs, x, y)
|
| 709 |
+
setattr(assign, x, y)
|
| 710 |
+
self.visit(assign)
|
| 711 |
+
return self.visit(lhs)
|
| 712 |
+
|
| 713 |
+
def visit_Name(self, node):
|
| 714 |
+
if type(node.ctx) is ast.Store:
|
| 715 |
+
return node.id
|
| 716 |
+
return self.dereference_name(node.id)
|
| 717 |
+
|
| 718 |
+
def visit_Store(self, node):
|
| 719 |
+
ast.NodeVisitor.generic_visit(self, node)
|
| 720 |
+
|
| 721 |
+
def visit_Load(self, node):
|
| 722 |
+
ast.NodeVisitor.generic_visit(self, node)
|
| 723 |
+
|
| 724 |
+
def visit_Tuple(self, node):
|
| 725 |
+
args = [self.visit(x) for x in node.elts]
|
| 726 |
+
return language.tuple(args)
|
| 727 |
+
|
| 728 |
+
def _apply_binary_method(self, node, method_name, lhs, rhs):
|
| 729 |
+
# TODO: raise something meaningful if getattr fails below, esp for reverse method
|
| 730 |
+
if _is_triton_tensor(lhs):
|
| 731 |
+
return getattr(lhs, method_name)(rhs, _semantic=self.semantic)
|
| 732 |
+
if _is_triton_tensor(rhs):
|
| 733 |
+
reverse_method_name = re.sub(r"__(.*)__", r"__r\1__", method_name)
|
| 734 |
+
return getattr(rhs, reverse_method_name)(lhs, _semantic=self.semantic)
|
| 735 |
+
if not isinstance(lhs, (constexpr, language.tuple)) and isinstance(rhs, constexpr):
|
| 736 |
+
lhs = constexpr(lhs)
|
| 737 |
+
if isinstance(lhs, constexpr):
|
| 738 |
+
fn = getattr(lhs, method_name)
|
| 739 |
+
else:
|
| 740 |
+
fn = self.get_Attribute(lhs, method_name)
|
| 741 |
+
return self.call_Function(node, fn, [rhs], {})
|
| 742 |
+
|
| 743 |
+
def visit_BinOp(self, node):
|
| 744 |
+
lhs = self.visit(node.left)
|
| 745 |
+
rhs = self.visit(node.right)
|
| 746 |
+
method_name = self._method_name_for_bin_op.get(type(node.op))
|
| 747 |
+
if method_name is None:
|
| 748 |
+
raise self._unsupported(node,
|
| 749 |
+
"AST binary operator '{}' is not (currently) implemented.".format(node.op.__name__))
|
| 750 |
+
return self._apply_binary_method(node, method_name, lhs, rhs)
|
| 751 |
+
|
| 752 |
+
_method_name_for_bin_op: Dict[Type[ast.operator], str] = {
|
| 753 |
+
ast.Add: '__add__',
|
| 754 |
+
ast.Sub: '__sub__',
|
| 755 |
+
ast.Mult: '__mul__',
|
| 756 |
+
ast.Div: '__truediv__',
|
| 757 |
+
ast.FloorDiv: '__floordiv__',
|
| 758 |
+
ast.Mod: '__mod__',
|
| 759 |
+
ast.Pow: '__pow__',
|
| 760 |
+
ast.LShift: '__lshift__',
|
| 761 |
+
ast.RShift: '__rshift__',
|
| 762 |
+
ast.BitAnd: '__and__',
|
| 763 |
+
ast.BitOr: '__or__',
|
| 764 |
+
ast.BitXor: '__xor__',
|
| 765 |
+
}
|
| 766 |
+
|
| 767 |
+
def visit_then_else_blocks(self, node, liveins, then_block, else_block):
|
| 768 |
+
# then block
|
| 769 |
+
self.builder.set_insertion_point_to_start(then_block)
|
| 770 |
+
self.visit_compound_statement(node.body)
|
| 771 |
+
then_block = self.builder.get_insertion_block()
|
| 772 |
+
then_defs = self.local_defs.copy()
|
| 773 |
+
then_vals = self.lscope.copy()
|
| 774 |
+
# else block
|
| 775 |
+
else_defs = {}
|
| 776 |
+
else_vals = liveins.copy()
|
| 777 |
+
if node.orelse:
|
| 778 |
+
self.builder.set_insertion_point_to_start(else_block)
|
| 779 |
+
self.lscope = liveins.copy()
|
| 780 |
+
self.local_defs = {}
|
| 781 |
+
self.visit_compound_statement(node.orelse)
|
| 782 |
+
else_defs = self.local_defs.copy()
|
| 783 |
+
else_block = self.builder.get_insertion_block()
|
| 784 |
+
else_vals = self.lscope.copy()
|
| 785 |
+
|
| 786 |
+
# update block arguments
|
| 787 |
+
names = []
|
| 788 |
+
# variables in livein whose value is updated in `if`
|
| 789 |
+
for name, value in liveins.items():
|
| 790 |
+
# livein variable changed value in either then or else
|
| 791 |
+
if not _is_triton_value(value):
|
| 792 |
+
continue
|
| 793 |
+
then_handles = flatten_values_to_ir([then_vals[name]])
|
| 794 |
+
else_handles = flatten_values_to_ir([else_vals[name]])
|
| 795 |
+
if then_handles == else_handles:
|
| 796 |
+
continue
|
| 797 |
+
names.append(name)
|
| 798 |
+
then_defs[name] = then_vals[name]
|
| 799 |
+
else_defs[name] = else_vals[name]
|
| 800 |
+
# check type
|
| 801 |
+
for defs, block_name in [(then_defs, 'then'), (else_defs, 'else')]:
|
| 802 |
+
type_equal = type(defs[name]) == type(value) # noqa: E721
|
| 803 |
+
assert type_equal and defs[name].type == value.type, \
|
| 804 |
+
f'initial value for `{name}` is of type {value}, '\
|
| 805 |
+
f'but the {block_name} block redefines it as {defs[name]}'
|
| 806 |
+
|
| 807 |
+
# variables that are both in then and else but not in liveins
|
| 808 |
+
# TODO: could probably be cleaned up
|
| 809 |
+
for name in sorted(then_defs.keys() & else_defs.keys()):
|
| 810 |
+
if name in names:
|
| 811 |
+
continue
|
| 812 |
+
then_val = then_defs[name]
|
| 813 |
+
then_ty = then_val.type
|
| 814 |
+
else_val = else_defs[name]
|
| 815 |
+
else_ty = else_val.type
|
| 816 |
+
type_equal = type(then_val) == type(else_val) # noqa: E721
|
| 817 |
+
assert type_equal and then_ty == else_ty, \
|
| 818 |
+
f'Mismatched type for {name} between then block ({then_ty}) '\
|
| 819 |
+
f'and else block ({else_ty})'
|
| 820 |
+
names.append(name)
|
| 821 |
+
|
| 822 |
+
return then_defs, else_defs, then_block, else_block, names
|
| 823 |
+
|
| 824 |
+
def visit_if_top_level(self, cond, node):
|
| 825 |
+
with enter_sub_region(self) as sr:
|
| 826 |
+
liveins, ip_block = sr
|
| 827 |
+
then_block = self.builder.create_block()
|
| 828 |
+
else_block = self.builder.create_block()
|
| 829 |
+
# create branch
|
| 830 |
+
self.builder.set_insertion_point_to_end(ip_block)
|
| 831 |
+
self.builder.create_cond_branch(cond.handle, then_block, else_block)
|
| 832 |
+
# visit then and else blocks
|
| 833 |
+
then_defs, else_defs, then_block, else_block, names = \
|
| 834 |
+
self.visit_then_else_blocks(node, liveins, then_block, else_block)
|
| 835 |
+
# create basic-block after conditional
|
| 836 |
+
endif_block = self.builder.create_block()
|
| 837 |
+
# then terminator
|
| 838 |
+
self.builder.set_insertion_point_to_end(then_block)
|
| 839 |
+
assert not then_block.has_terminator(), f"{then_block}"
|
| 840 |
+
then_handles = flatten_values_to_ir(then_defs[name] for name in names)
|
| 841 |
+
self.builder.create_branch(endif_block, then_handles)
|
| 842 |
+
# else terminator
|
| 843 |
+
self.builder.set_insertion_point_to_end(else_block)
|
| 844 |
+
assert not else_block.has_terminator(), f"{else_block}"
|
| 845 |
+
else_handles = flatten_values_to_ir(else_defs[name] for name in names)
|
| 846 |
+
self.builder.create_branch(endif_block, else_handles)
|
| 847 |
+
assert len(then_handles) == len(else_handles)
|
| 848 |
+
for then_h, else_h in zip(then_handles, else_handles):
|
| 849 |
+
ty = then_h.get_type()
|
| 850 |
+
assert ty == else_h.get_type()
|
| 851 |
+
endif_block.add_argument(ty)
|
| 852 |
+
|
| 853 |
+
# change block
|
| 854 |
+
self.builder.set_insertion_point_to_start(endif_block)
|
| 855 |
+
# update value
|
| 856 |
+
res_handles = [endif_block.arg(i) for i in range(len(then_handles))]
|
| 857 |
+
types = [then_defs[name].type for name in names]
|
| 858 |
+
new_values = unflatten_ir_values(res_handles, types)
|
| 859 |
+
for name, new_value in zip(names, new_values):
|
| 860 |
+
self.set_value(name, new_value)
|
| 861 |
+
|
| 862 |
+
# TODO: refactor
|
| 863 |
+
def visit_if_scf(self, cond, node):
|
| 864 |
+
with enter_sub_region(self) as sr:
|
| 865 |
+
liveins, _ = sr
|
| 866 |
+
ip, last_loc = self._get_insertion_point_and_loc()
|
| 867 |
+
then_block = self.builder.create_block()
|
| 868 |
+
else_block = self.builder.create_block() if node.orelse else None
|
| 869 |
+
then_defs, else_defs, then_block, else_block, names = \
|
| 870 |
+
self.visit_then_else_blocks(node, liveins, then_block, else_block)
|
| 871 |
+
# create if op
|
| 872 |
+
then_handles = flatten_values_to_ir(then_defs[name] for name in names)
|
| 873 |
+
for name, val in zip(names, then_handles):
|
| 874 |
+
self._maybe_set_loc_to_name(val, name)
|
| 875 |
+
self._set_insertion_point_and_loc(ip, last_loc)
|
| 876 |
+
if_op = self.builder.create_if_op([h.get_type() for h in then_handles], cond.handle, True)
|
| 877 |
+
then_block.merge_block_before(if_op.get_then_block())
|
| 878 |
+
self.builder.set_insertion_point_to_end(if_op.get_then_block())
|
| 879 |
+
if len(names) > 0:
|
| 880 |
+
self.builder.create_yield_op(then_handles)
|
| 881 |
+
if not node.orelse:
|
| 882 |
+
else_block = if_op.get_else_block()
|
| 883 |
+
else:
|
| 884 |
+
else_block.merge_block_before(if_op.get_else_block())
|
| 885 |
+
self.builder.set_insertion_point_to_end(if_op.get_else_block())
|
| 886 |
+
if len(names) > 0:
|
| 887 |
+
else_handles = flatten_values_to_ir(else_defs[name] for name in names)
|
| 888 |
+
for name, val in zip(names, else_handles):
|
| 889 |
+
self._maybe_set_loc_to_name(val, name)
|
| 890 |
+
self.builder.create_yield_op(else_handles)
|
| 891 |
+
# update values
|
| 892 |
+
res_handles = [if_op.get_result(i) for i in range(len(then_handles))]
|
| 893 |
+
types = [then_defs[name].type for name in names]
|
| 894 |
+
new_values = unflatten_ir_values(res_handles, types)
|
| 895 |
+
for name, new_value in zip(names, new_values):
|
| 896 |
+
self.set_value(name, new_value)
|
| 897 |
+
|
| 898 |
+
def visit_If(self, node):
|
| 899 |
+
cond = self.visit(node.test)
|
| 900 |
+
|
| 901 |
+
if _is_triton_tensor(cond):
|
| 902 |
+
if _is_non_scalar_tensor(cond):
|
| 903 |
+
raise self._unsupported(node, "Boolean value of Tensor with more than one value is ambiguous")
|
| 904 |
+
if cond.type.is_block():
|
| 905 |
+
warnings.warn(
|
| 906 |
+
"If conditional called with multidimensional Tensor instead of scalar; please use \"if (%s).item()\" instead"
|
| 907 |
+
% ast.unparse(node.test))
|
| 908 |
+
cond = language.core._unsplat(cond, _semantic=self.semantic, _generator=self)
|
| 909 |
+
cond = cond.to(language.int1, _semantic=self.semantic)
|
| 910 |
+
if ContainsReturnChecker(self.gscope).visit(node):
|
| 911 |
+
if self.scf_stack:
|
| 912 |
+
raise self._unsupported(
|
| 913 |
+
node, "Cannot have `return` statements inside `while` or `for` statements in triton.")
|
| 914 |
+
self.visit_if_top_level(cond, node)
|
| 915 |
+
else:
|
| 916 |
+
self.visit_if_scf(cond, node)
|
| 917 |
+
else:
|
| 918 |
+
cond = _unwrap_if_constexpr(cond)
|
| 919 |
+
# not isinstance - we insist the real thing, no subclasses and no ducks
|
| 920 |
+
if type(cond) not in _condition_types:
|
| 921 |
+
raise self._unsupported(
|
| 922 |
+
node, "`if` conditionals can only accept values of type {{{}}}, not objects of type {}".format(
|
| 923 |
+
', '.join(_.__name__ for _ in _condition_types),
|
| 924 |
+
type(cond).__name__))
|
| 925 |
+
|
| 926 |
+
active_block = node.body if cond else node.orelse
|
| 927 |
+
self.visit_compound_statement(active_block)
|
| 928 |
+
|
| 929 |
+
def visit_IfExp(self, node):
|
| 930 |
+
cond = self.visit(node.test)
|
| 931 |
+
if _is_triton_tensor(cond):
|
| 932 |
+
cond = cond.to(language.int1, _semantic=self.semantic)
|
| 933 |
+
# TODO: Deal w/ more complicated return types (e.g tuple)
|
| 934 |
+
with enter_sub_region(self):
|
| 935 |
+
ip, last_loc = self._get_insertion_point_and_loc()
|
| 936 |
+
|
| 937 |
+
then_block = self.builder.create_block()
|
| 938 |
+
self.builder.set_insertion_point_to_start(then_block)
|
| 939 |
+
then_val = self.semantic.to_tensor(self.visit(node.body))
|
| 940 |
+
then_block = self.builder.get_insertion_block()
|
| 941 |
+
|
| 942 |
+
else_block = self.builder.create_block()
|
| 943 |
+
self.builder.set_insertion_point_to_start(else_block)
|
| 944 |
+
# do not need to reset lscope since
|
| 945 |
+
# ternary expressions cannot define new variables
|
| 946 |
+
else_val = self.semantic.to_tensor(self.visit(node.orelse))
|
| 947 |
+
else_block = self.builder.get_insertion_block()
|
| 948 |
+
|
| 949 |
+
self._set_insertion_point_and_loc(ip, last_loc)
|
| 950 |
+
|
| 951 |
+
assert then_val.type == else_val.type, \
|
| 952 |
+
f'Ternary expression with dynamic condition has inconsistent types {then_val.type} and {else_val.type}'
|
| 953 |
+
ret_type = then_val.type
|
| 954 |
+
|
| 955 |
+
ret_type_ir = [ret_type.to_ir(self.builder)] if ret_type != language.void else []
|
| 956 |
+
if_op = self.builder.create_if_op(ret_type_ir, cond.handle, True)
|
| 957 |
+
then_block.merge_block_before(if_op.get_then_block())
|
| 958 |
+
if ret_type_ir:
|
| 959 |
+
self.builder.set_insertion_point_to_end(if_op.get_then_block())
|
| 960 |
+
self.builder.create_yield_op([then_val.handle])
|
| 961 |
+
|
| 962 |
+
self.builder.set_insertion_point_to_end(if_op.get_then_block())
|
| 963 |
+
else_block.merge_block_before(if_op.get_else_block())
|
| 964 |
+
if ret_type_ir:
|
| 965 |
+
self.builder.set_insertion_point_to_end(if_op.get_else_block())
|
| 966 |
+
self.builder.create_yield_op([else_val.handle])
|
| 967 |
+
return language.core.tensor(if_op.get_result(0), ret_type) if ret_type_ir else None
|
| 968 |
+
else:
|
| 969 |
+
cond = _unwrap_if_constexpr(cond)
|
| 970 |
+
|
| 971 |
+
# not isinstance - we insist the real thing, no subclasses and no ducks
|
| 972 |
+
if type(cond) not in _condition_types:
|
| 973 |
+
raise self._unsupported(
|
| 974 |
+
node, "`if` conditionals can only accept values of type {{{}}}, not objects of type {}".format(
|
| 975 |
+
', '.join(_.__name__ for _ in _condition_types),
|
| 976 |
+
type(cond).__name__))
|
| 977 |
+
if cond:
|
| 978 |
+
return self.visit(node.body)
|
| 979 |
+
else:
|
| 980 |
+
return self.visit(node.orelse)
|
| 981 |
+
|
| 982 |
+
def visit_With(self, node):
|
| 983 |
+
# Lower `with` statements by constructing context managers and calling their enter/exit hooks
|
| 984 |
+
# Instantiate each context manager with builder injection
|
| 985 |
+
cm_list = []
|
| 986 |
+
for item in node.items:
|
| 987 |
+
call = item.context_expr
|
| 988 |
+
fn = self.visit(call.func)
|
| 989 |
+
args = [self.visit(arg) for arg in call.args]
|
| 990 |
+
kws = dict(self.visit(kw) for kw in call.keywords)
|
| 991 |
+
cm = fn(*args, _semantic=self.semantic, **kws)
|
| 992 |
+
cm_list.append(cm)
|
| 993 |
+
for cm, item in zip(cm_list, node.items):
|
| 994 |
+
res = cm.__enter__()
|
| 995 |
+
if item.optional_vars is not None:
|
| 996 |
+
var_name = self.visit(item.optional_vars)
|
| 997 |
+
self.set_value(var_name, res)
|
| 998 |
+
if ContainsReturnChecker(self.gscope).visit(node):
|
| 999 |
+
raise self._unsupported(node, "Cannot have `return` statements inside `with` statements in triton ")
|
| 1000 |
+
self.visit_compound_statement(node.body)
|
| 1001 |
+
for cm in reversed(cm_list):
|
| 1002 |
+
cm.__exit__(None, None, None)
|
| 1003 |
+
|
| 1004 |
+
def visit_Pass(self, node):
|
| 1005 |
+
pass
|
| 1006 |
+
|
| 1007 |
+
def visit_Compare(self, node):
|
| 1008 |
+
if not (len(node.comparators) == 1 and len(node.ops) == 1):
|
| 1009 |
+
raise self._unsupported(node, "simultaneous multiple comparison is not supported")
|
| 1010 |
+
lhs = self.visit(node.left)
|
| 1011 |
+
rhs = self.visit(node.comparators[0])
|
| 1012 |
+
lhs_value = _unwrap_if_constexpr(lhs)
|
| 1013 |
+
rhs_value = _unwrap_if_constexpr(rhs)
|
| 1014 |
+
if type(node.ops[0]) is ast.Is:
|
| 1015 |
+
return constexpr(lhs_value is rhs_value)
|
| 1016 |
+
if type(node.ops[0]) is ast.IsNot:
|
| 1017 |
+
return constexpr(lhs_value is not rhs_value)
|
| 1018 |
+
method_name = self._method_name_for_comp_op.get(type(node.ops[0]))
|
| 1019 |
+
if method_name is None:
|
| 1020 |
+
raise self._unsupported(
|
| 1021 |
+
node, "AST comparison operator '{}' is not (currently) implemented.".format(node.ops[0].__name__))
|
| 1022 |
+
return self._apply_binary_method(node, method_name, lhs, rhs)
|
| 1023 |
+
|
| 1024 |
+
_method_name_for_comp_op: Dict[Type[ast.cmpop], str] = {
|
| 1025 |
+
ast.Eq: '__eq__', ast.NotEq: '__ne__', ast.Lt: '__lt__', ast.LtE: '__le__', ast.Gt: '__gt__', ast.GtE: '__ge__'
|
| 1026 |
+
}
|
| 1027 |
+
|
| 1028 |
+
def visit_UnaryOp(self, node):
|
| 1029 |
+
operand = self.visit(node.operand)
|
| 1030 |
+
fn = self._method_name_for_unary_op.get(type(node.op))
|
| 1031 |
+
if fn is None:
|
| 1032 |
+
raise self._unsupported(node, f"AST unary operator '{node.op.__name__}' is not (currently) implemented.")
|
| 1033 |
+
if _is_triton_tensor(operand):
|
| 1034 |
+
return getattr(operand, fn)(_semantic=self.semantic)
|
| 1035 |
+
try:
|
| 1036 |
+
return getattr(operand, fn)()
|
| 1037 |
+
except AttributeError:
|
| 1038 |
+
if fn == "__not__":
|
| 1039 |
+
return constexpr(not operand)
|
| 1040 |
+
raise self._unsupported(
|
| 1041 |
+
node, f"AST unary operator '{fn}' is not (currently) implemented on type {type(operand).__name__}")
|
| 1042 |
+
|
| 1043 |
+
_method_name_for_unary_op: Dict[Type[ast.unaryop], str] = {
|
| 1044 |
+
ast.USub: '__neg__', ast.UAdd: '__pos__', ast.Not: '__not__', ast.Invert: '__invert__'
|
| 1045 |
+
}
|
| 1046 |
+
|
| 1047 |
+
def _verify_loop_carried_variable(self, name, loop_val, live_val):
|
| 1048 |
+
assert _is_triton_value(loop_val), f'cannot reassign constexpr {name} in the loop'
|
| 1049 |
+
assert _is_triton_value(live_val), f'cannot reassign constexpr {name} in the loop'
|
| 1050 |
+
assert type(loop_val) is type(live_val), (
|
| 1051 |
+
f'Loop carried variable {name} changed type, was {type(loop_val)} but is now {type(live_val)}')
|
| 1052 |
+
assert not _is_triton_tensor(loop_val) or loop_val.type == live_val.type, \
|
| 1053 |
+
f'Loop-carried variable {name} has initial type {live_val.type} '\
|
| 1054 |
+
f'but is re-assigned to {loop_val.type} in loop! '\
|
| 1055 |
+
f'Please make sure that the type stays consistent.'
|
| 1056 |
+
|
| 1057 |
+
def visit_While(self, node):
|
| 1058 |
+
with enter_sub_region(self) as sr:
|
| 1059 |
+
liveins, insert_block = sr
|
| 1060 |
+
ip, last_loc = self._get_insertion_point_and_loc()
|
| 1061 |
+
|
| 1062 |
+
names, init_handles, init_fe_tys = self._find_carries(node, liveins)
|
| 1063 |
+
|
| 1064 |
+
init_tys = [h.get_type() for h in init_handles]
|
| 1065 |
+
self._set_insertion_point_and_loc(ip, last_loc)
|
| 1066 |
+
while_op = self.builder.create_while_op(init_tys, init_handles)
|
| 1067 |
+
# merge the condition region
|
| 1068 |
+
before_block = self.builder.create_block_with_parent(while_op.get_before(), init_tys)
|
| 1069 |
+
self.builder.set_insertion_point_to_start(before_block)
|
| 1070 |
+
block_args = [before_block.arg(i) for i in range(len(init_handles))]
|
| 1071 |
+
condition_args = unflatten_ir_values(block_args, init_fe_tys)
|
| 1072 |
+
for name, val in zip(names, condition_args):
|
| 1073 |
+
self.lscope[name] = val
|
| 1074 |
+
self.local_defs[name] = val
|
| 1075 |
+
self._maybe_set_loc_to_name(val, name)
|
| 1076 |
+
cond = self.visit(node.test)
|
| 1077 |
+
if isinstance(cond, language.condition):
|
| 1078 |
+
if cond.disable_licm:
|
| 1079 |
+
while_op.set_attr("llvm.loop_annotation", self.builder.get_disable_loop_licm_attr())
|
| 1080 |
+
cond = cond.condition
|
| 1081 |
+
self.builder.set_insertion_point_to_end(before_block)
|
| 1082 |
+
# create ConditionOp: e.g., scf.condition(%cond) %arg0, %arg1, ...
|
| 1083 |
+
self.builder.create_condition_op(cond.handle, block_args)
|
| 1084 |
+
# merge the loop body
|
| 1085 |
+
after_block = self.builder.create_block_with_parent(while_op.get_after(), init_tys)
|
| 1086 |
+
|
| 1087 |
+
# generate loop body
|
| 1088 |
+
self.builder.set_insertion_point_to_start(after_block)
|
| 1089 |
+
body_handles = [after_block.arg(i) for i in range(len(init_handles))]
|
| 1090 |
+
body_args = unflatten_ir_values(body_handles, init_fe_tys)
|
| 1091 |
+
for name, val in zip(names, body_args):
|
| 1092 |
+
self.lscope[name] = val
|
| 1093 |
+
self.local_defs[name] = val
|
| 1094 |
+
self._maybe_set_loc_to_name(val, name)
|
| 1095 |
+
self.scf_stack.append(node)
|
| 1096 |
+
self.visit_compound_statement(node.body)
|
| 1097 |
+
self.scf_stack.pop()
|
| 1098 |
+
|
| 1099 |
+
yield_handles = flatten_values_to_ir(self.lscope[name] for name in names)
|
| 1100 |
+
self.builder.create_yield_op(yield_handles)
|
| 1101 |
+
|
| 1102 |
+
# WhileOp defines new values, update the symbol table (lscope, local_defs)
|
| 1103 |
+
result_handles = [while_op.get_result(i) for i in range(len(init_handles))]
|
| 1104 |
+
result_vals = unflatten_ir_values(result_handles, init_fe_tys)
|
| 1105 |
+
for name, new_def in zip(names, result_vals):
|
| 1106 |
+
self.lscope[name] = new_def
|
| 1107 |
+
self.local_defs[name] = new_def
|
| 1108 |
+
self._maybe_set_loc_to_name(new_def, name)
|
| 1109 |
+
|
| 1110 |
+
for stmt in node.orelse:
|
| 1111 |
+
assert False, "Not implemented"
|
| 1112 |
+
ast.NodeVisitor.generic_visit(self, stmt)
|
| 1113 |
+
|
| 1114 |
+
def visit_Subscript_Load(self, node):
|
| 1115 |
+
assert isinstance(node.ctx, ast.Load)
|
| 1116 |
+
lhs = self.visit(node.value)
|
| 1117 |
+
slices = self.visit(node.slice)
|
| 1118 |
+
if _is_triton_value(lhs):
|
| 1119 |
+
return self.call_Method(node, lhs.__getitem__, lhs, [slices], {})
|
| 1120 |
+
return lhs[slices]
|
| 1121 |
+
|
| 1122 |
+
def visit_Subscript_Store(self, node, value):
|
| 1123 |
+
raise NotImplementedError("__setitem__ is not supported in triton")
|
| 1124 |
+
|
| 1125 |
+
def visit_Subscript(self, node):
|
| 1126 |
+
return self.visit_Subscript_Load(node)
|
| 1127 |
+
|
| 1128 |
+
def visit_ExtSlice(self, node):
|
| 1129 |
+
return [self.visit(dim) for dim in node.dims]
|
| 1130 |
+
|
| 1131 |
+
def visit_For(self, node):
|
| 1132 |
+
IteratorClass = self.visit(node.iter.func)
|
| 1133 |
+
iter_args = [self.visit(arg) for arg in node.iter.args]
|
| 1134 |
+
iter_kwargs = dict(self.visit(keyword) for keyword in node.iter.keywords)
|
| 1135 |
+
if IteratorClass == language.static_range:
|
| 1136 |
+
iterator = IteratorClass(*iter_args, **iter_kwargs)
|
| 1137 |
+
static_range = range(iterator.start.value, iterator.end.value, iterator.step.value)
|
| 1138 |
+
for i in static_range:
|
| 1139 |
+
self.lscope[node.target.id] = constexpr(i)
|
| 1140 |
+
self.visit_compound_statement(node.body)
|
| 1141 |
+
for stmt in node.orelse:
|
| 1142 |
+
ast.NodeVisitor.generic_visit(self, stmt)
|
| 1143 |
+
return
|
| 1144 |
+
num_stages = None
|
| 1145 |
+
loop_unroll_factor = None
|
| 1146 |
+
disallow_acc_multi_buffer = False
|
| 1147 |
+
flatten = False
|
| 1148 |
+
warp_specialize = False
|
| 1149 |
+
disable_licm = False
|
| 1150 |
+
if IteratorClass is language.range:
|
| 1151 |
+
iterator = IteratorClass(*iter_args, **iter_kwargs)
|
| 1152 |
+
# visit iterator arguments
|
| 1153 |
+
# note: only `range` iterator is supported now
|
| 1154 |
+
# collect lower bound (lb), upper bound (ub), and step
|
| 1155 |
+
lb = iterator.start
|
| 1156 |
+
ub = iterator.end
|
| 1157 |
+
step = iterator.step
|
| 1158 |
+
num_stages = iterator.num_stages
|
| 1159 |
+
loop_unroll_factor = iterator.loop_unroll_factor
|
| 1160 |
+
disallow_acc_multi_buffer = iterator.disallow_acc_multi_buffer
|
| 1161 |
+
flatten = iterator.flatten
|
| 1162 |
+
warp_specialize = iterator.warp_specialize
|
| 1163 |
+
disable_licm = iterator.disable_licm
|
| 1164 |
+
elif IteratorClass is range:
|
| 1165 |
+
# visit iterator arguments
|
| 1166 |
+
# note: only `range` iterator is supported now
|
| 1167 |
+
# collect lower bound (lb), upper bound (ub), and step
|
| 1168 |
+
lb = iter_args[0] if len(iter_args) > 1 else self.visit(ast.Constant(0))
|
| 1169 |
+
ub = iter_args[1] if len(iter_args) > 1 else self.visit(node.iter.args[0])
|
| 1170 |
+
step = iter_args[2] if len(iter_args) > 2 else self.visit(ast.Constant(1))
|
| 1171 |
+
else:
|
| 1172 |
+
raise RuntimeError('Only `range` and `static_range` iterators are currently supported')
|
| 1173 |
+
# handle negative constant step (not supported by scf.for in MLIR)
|
| 1174 |
+
negative_step = False
|
| 1175 |
+
if _is_constexpr(step) and step.value < 0:
|
| 1176 |
+
step = constexpr(-step.value)
|
| 1177 |
+
negative_step = True
|
| 1178 |
+
lb, ub = ub, lb
|
| 1179 |
+
lb = self.semantic.to_tensor(lb)
|
| 1180 |
+
ub = self.semantic.to_tensor(ub)
|
| 1181 |
+
step = self.semantic.to_tensor(step)
|
| 1182 |
+
# induction variable type
|
| 1183 |
+
if not lb.dtype.is_int() or not ub.dtype.is_int() or not step.dtype.is_int():
|
| 1184 |
+
raise TypeError(f"For loop bounds and step must all be ints, are ({lb.dtype}, {ub.dtype}, {step.dtype})")
|
| 1185 |
+
if _is_non_scalar_tensor(lb):
|
| 1186 |
+
raise TypeError(f"For lower bound must be a scalar, got {lb.type}")
|
| 1187 |
+
if _is_non_scalar_tensor(ub):
|
| 1188 |
+
raise TypeError(f"For upper bound must be a scalar, got {ub.type}")
|
| 1189 |
+
if _is_non_scalar_tensor(step):
|
| 1190 |
+
raise TypeError(f"For step must be a scalar, got {step.type}")
|
| 1191 |
+
iv_type = self.semantic.integer_promote_impl(lb.dtype, ub.dtype)
|
| 1192 |
+
iv_type = self.semantic.integer_promote_impl(iv_type, step.dtype)
|
| 1193 |
+
iv_ir_type = iv_type.to_ir(self.builder)
|
| 1194 |
+
iv_is_signed = iv_type.int_signedness == language.core.dtype.SIGNEDNESS.SIGNED
|
| 1195 |
+
# lb/ub/step might be constexpr, we need to cast them to tensor
|
| 1196 |
+
lb = lb.handle
|
| 1197 |
+
ub = ub.handle
|
| 1198 |
+
step = step.handle
|
| 1199 |
+
# ForOp can only accept IndexType as lb/ub/step. Cast integer to Index
|
| 1200 |
+
lb = self.builder.create_int_cast(lb, iv_ir_type, iv_is_signed)
|
| 1201 |
+
ub = self.builder.create_int_cast(ub, iv_ir_type, iv_is_signed)
|
| 1202 |
+
step = self.builder.create_int_cast(step, iv_ir_type, iv_is_signed)
|
| 1203 |
+
# Create placeholder for the loop induction variable
|
| 1204 |
+
iv_placeholder = self.builder.create_poison(iv_ir_type)
|
| 1205 |
+
self.set_value(node.target.id, language.core.tensor(iv_placeholder, iv_type))
|
| 1206 |
+
|
| 1207 |
+
with enter_sub_region(self) as sr:
|
| 1208 |
+
liveins, insert_block = sr
|
| 1209 |
+
ip, last_loc = self._get_insertion_point_and_loc()
|
| 1210 |
+
|
| 1211 |
+
names, init_handles, init_tys = self._find_carries(node, liveins, ignore={node.target.id})
|
| 1212 |
+
|
| 1213 |
+
# create ForOp
|
| 1214 |
+
self._set_insertion_point_and_loc(ip, last_loc)
|
| 1215 |
+
for_op = self.builder.create_for_op(lb, ub, step, init_handles)
|
| 1216 |
+
if _unwrap_if_constexpr(num_stages) is not None:
|
| 1217 |
+
for_op.set_attr("tt.num_stages", self.builder.get_int32_attr(num_stages))
|
| 1218 |
+
if _unwrap_if_constexpr(loop_unroll_factor) is not None:
|
| 1219 |
+
for_op.set_attr("tt.loop_unroll_factor", self.builder.get_int32_attr(loop_unroll_factor))
|
| 1220 |
+
if disallow_acc_multi_buffer:
|
| 1221 |
+
for_op.set_attr("tt.disallow_acc_multi_buffer", self.builder.get_unit_attr())
|
| 1222 |
+
if flatten:
|
| 1223 |
+
for_op.set_attr("tt.flatten", self.builder.get_unit_attr())
|
| 1224 |
+
if warp_specialize:
|
| 1225 |
+
for_op.set_attr("tt.warp_specialize", self.builder.get_unit_attr())
|
| 1226 |
+
if disable_licm:
|
| 1227 |
+
for_op.set_attr("llvm.loop_annotation", self.builder.get_disable_loop_licm_attr())
|
| 1228 |
+
|
| 1229 |
+
self.scf_stack.append(node)
|
| 1230 |
+
for_op_body = for_op.get_body(0)
|
| 1231 |
+
self.builder.set_insertion_point_to_start(for_op_body)
|
| 1232 |
+
block_handles = [for_op_body.arg(i + 1) for i in range(len(init_handles))]
|
| 1233 |
+
block_args = unflatten_ir_values(block_handles, init_tys)
|
| 1234 |
+
for name, val in zip(names, block_args):
|
| 1235 |
+
self._maybe_set_loc_to_name(val, name)
|
| 1236 |
+
self.set_value(name, val)
|
| 1237 |
+
self.visit_compound_statement(node.body)
|
| 1238 |
+
self.scf_stack.pop()
|
| 1239 |
+
yield_handles = flatten_values_to_ir(self.lscope[name] for name in names)
|
| 1240 |
+
|
| 1241 |
+
# create YieldOp
|
| 1242 |
+
if len(yield_handles) > 0:
|
| 1243 |
+
self.builder.create_yield_op(yield_handles)
|
| 1244 |
+
for_op_region = for_op_body.get_parent()
|
| 1245 |
+
assert for_op_region.size() == 1, "We use SCF, so the loop body should only have one block"
|
| 1246 |
+
|
| 1247 |
+
# update induction variable with actual value, and replace all uses
|
| 1248 |
+
self.builder.set_insertion_point_to_start(for_op_body)
|
| 1249 |
+
iv = for_op.get_induction_var()
|
| 1250 |
+
if negative_step:
|
| 1251 |
+
iv = self.builder.create_sub(ub, iv)
|
| 1252 |
+
iv = self.builder.create_add(iv, lb)
|
| 1253 |
+
iv_placeholder.replace_all_uses_with(iv)
|
| 1254 |
+
self.set_value(node.target.id, language.core.tensor(iv, iv_type))
|
| 1255 |
+
self._maybe_set_loc_to_name(iv, node.target.id)
|
| 1256 |
+
|
| 1257 |
+
# update lscope & local_defs (ForOp defines new values)
|
| 1258 |
+
result_handles = [for_op.get_result(i) for i in range(len(init_handles))]
|
| 1259 |
+
result_values = unflatten_ir_values(result_handles, init_tys)
|
| 1260 |
+
for name, val in zip(names, result_values):
|
| 1261 |
+
self.set_value(name, val)
|
| 1262 |
+
self._maybe_set_loc_to_name(val, name)
|
| 1263 |
+
|
| 1264 |
+
for stmt in node.orelse:
|
| 1265 |
+
assert False, "Don't know what to do with else after for"
|
| 1266 |
+
ast.NodeVisitor.generic_visit(self, stmt)
|
| 1267 |
+
|
| 1268 |
+
def visit_Slice(self, node):
|
| 1269 |
+
lower = self.visit(node.lower)
|
| 1270 |
+
upper = self.visit(node.upper)
|
| 1271 |
+
step = self.visit(node.step)
|
| 1272 |
+
return language.slice(lower, upper, step)
|
| 1273 |
+
|
| 1274 |
+
def visit_Index(self, node):
|
| 1275 |
+
return self.visit(node.value)
|
| 1276 |
+
|
| 1277 |
+
def visit_keyword(self, node) -> Tuple[str, Any]:
|
| 1278 |
+
return node.arg, self.visit(node.value)
|
| 1279 |
+
|
| 1280 |
+
def visit_Assert(self, node) -> Any:
|
| 1281 |
+
test = self.visit(node.test)
|
| 1282 |
+
msg = self.visit(node.msg) if node.msg is not None else ""
|
| 1283 |
+
return language.core.device_assert(test, msg, _semantic=self.semantic)
|
| 1284 |
+
|
| 1285 |
+
def call_JitFunction(self, fn: JITFunction, args, kwargs, caller_context=None):
|
| 1286 |
+
args = inspect.getcallargs(fn.fn, *args, **kwargs)
|
| 1287 |
+
args = [args[name] for name in fn.arg_names]
|
| 1288 |
+
for i, arg in enumerate(args):
|
| 1289 |
+
if isinstance(arg, (language.dtype, float, int, bool, JITFunction)):
|
| 1290 |
+
args[i] = language.core.constexpr(arg)
|
| 1291 |
+
args_cst = find_paths_if(args, lambda _, x: _is_constexpr(x))
|
| 1292 |
+
args_cst = {path: get_iterable_path(args, path) for path in args_cst}
|
| 1293 |
+
args_path = find_paths_if(args, lambda _, x: not _is_constexpr(x))
|
| 1294 |
+
args_val = [get_iterable_path(args, path) for path in args_path]
|
| 1295 |
+
# mangle
|
| 1296 |
+
caller_context = caller_context or self.caller_context
|
| 1297 |
+
fn_name = mangle_fn(get_full_name(fn), [arg.type for arg in args_val], args_cst, caller_context)
|
| 1298 |
+
# generate function def if necessary
|
| 1299 |
+
if not self.module.has_function(fn_name):
|
| 1300 |
+
# If the callee is not set, we use the same debug setting as the caller
|
| 1301 |
+
file_name, begin_line = get_jit_fn_file_line(fn)
|
| 1302 |
+
arg_types = [
|
| 1303 |
+
language.core.constexpr if arg is None or isinstance(arg,
|
| 1304 |
+
(bool, int, language.core.dtype)) else arg.type
|
| 1305 |
+
for arg in args
|
| 1306 |
+
]
|
| 1307 |
+
prototype = ASTFunction([], arg_types, args_cst, dict())
|
| 1308 |
+
generator = CodeGenerator(self.context, prototype, fn.get_capture_scope(), module=self.module, jit_fn=fn,
|
| 1309 |
+
function_name=fn_name, function_types=self.function_ret_types,
|
| 1310 |
+
noinline=fn.noinline, file_name=file_name, begin_line=begin_line,
|
| 1311 |
+
options=self.builder.options, codegen_fns=self.builder.codegen_fns,
|
| 1312 |
+
module_map=self.builder.module_map, caller_context=caller_context,
|
| 1313 |
+
is_gluon=self.is_gluon)
|
| 1314 |
+
try:
|
| 1315 |
+
generator.visit(fn.parse())
|
| 1316 |
+
except Exception as e:
|
| 1317 |
+
# Wrap the error in the callee with the location of the call.
|
| 1318 |
+
if knobs.compilation.front_end_debugging:
|
| 1319 |
+
raise
|
| 1320 |
+
raise CompilationError(self.jit_fn.src, self.cur_node, None) from e
|
| 1321 |
+
|
| 1322 |
+
callee_ret_type = generator.ret_type
|
| 1323 |
+
self.function_ret_types[fn_name] = callee_ret_type
|
| 1324 |
+
else:
|
| 1325 |
+
callee_ret_type = self.function_ret_types[fn_name]
|
| 1326 |
+
symbol = self.module.get_function(fn_name)
|
| 1327 |
+
args_val = flatten_values_to_ir(args_val)
|
| 1328 |
+
call_op = self.builder.call(symbol, args_val)
|
| 1329 |
+
if callee_ret_type == language.void:
|
| 1330 |
+
return None
|
| 1331 |
+
handles = [call_op.get_result(i) for i in range(call_op.get_num_results())]
|
| 1332 |
+
return next(unflatten_ir_values(handles, [callee_ret_type]))
|
| 1333 |
+
|
| 1334 |
+
def call_Function(self, node, fn, args, kws):
|
| 1335 |
+
if isinstance(fn, (BoundJITMethod, BoundConstexprFunction)):
|
| 1336 |
+
args.insert(0, fn.__self__)
|
| 1337 |
+
fn = fn.__func__
|
| 1338 |
+
if isinstance(fn, JITFunction):
|
| 1339 |
+
_check_fn_args(node, fn, args)
|
| 1340 |
+
return self.call_JitFunction(fn, args, kws)
|
| 1341 |
+
if (hasattr(fn, '__self__') and _is_triton_value(fn.__self__)) or language.core.is_builtin(fn) or isinstance(
|
| 1342 |
+
fn, ConstexprFunction):
|
| 1343 |
+
extra_kwargs = dict()
|
| 1344 |
+
|
| 1345 |
+
if isinstance(fn, ConstexprFunction):
|
| 1346 |
+
sig = inspect.signature(fn.__call__)
|
| 1347 |
+
else:
|
| 1348 |
+
sig = inspect.signature(fn)
|
| 1349 |
+
if '_semantic' in sig.parameters:
|
| 1350 |
+
extra_kwargs["_semantic"] = self.semantic
|
| 1351 |
+
if '_generator' in sig.parameters:
|
| 1352 |
+
extra_kwargs['_generator'] = self
|
| 1353 |
+
try:
|
| 1354 |
+
ret = fn(*args, **extra_kwargs, **kws)
|
| 1355 |
+
# builtin functions return plain tuples for readability
|
| 1356 |
+
if isinstance(ret, tuple):
|
| 1357 |
+
ret = language.tuple(ret)
|
| 1358 |
+
return ret
|
| 1359 |
+
except Exception as e:
|
| 1360 |
+
if knobs.compilation.front_end_debugging:
|
| 1361 |
+
raise
|
| 1362 |
+
# Normally when we raise a CompilationError, we raise it as
|
| 1363 |
+
# `from None`, because the original fileline from the exception
|
| 1364 |
+
# is not relevant (and often points into code_generator.py
|
| 1365 |
+
# itself). But when calling a function, we raise as `from e` to
|
| 1366 |
+
# preserve the traceback of the original error, which may e.g.
|
| 1367 |
+
# be in core.py.
|
| 1368 |
+
raise CompilationError(self.jit_fn.src, node, str(e)) from e
|
| 1369 |
+
|
| 1370 |
+
if fn in self.builtin_namespace.values() or (hasattr(fn, '__self__') and not _is_triton_value(fn.__self__)):
|
| 1371 |
+
args = map(_unwrap_if_constexpr, args)
|
| 1372 |
+
ret = fn(*args, **kws)
|
| 1373 |
+
|
| 1374 |
+
def wrap_constexpr(x):
|
| 1375 |
+
if _is_triton_value(x):
|
| 1376 |
+
return x
|
| 1377 |
+
return constexpr(x)
|
| 1378 |
+
|
| 1379 |
+
if isinstance(ret, (builtins.tuple, language.tuple)):
|
| 1380 |
+
return _apply_to_tuple_values(ret, wrap_constexpr)
|
| 1381 |
+
return wrap_constexpr(ret)
|
| 1382 |
+
|
| 1383 |
+
def call_Method(self, node, fn, fn_self, args, kws):
|
| 1384 |
+
if isinstance(fn, JITFunction):
|
| 1385 |
+
args.insert(0, fn_self)
|
| 1386 |
+
return self.call_Function(node, fn, args, kws)
|
| 1387 |
+
|
| 1388 |
+
def visit_Call(self, node):
|
| 1389 |
+
fn = _unwrap_if_constexpr(self.visit(node.func))
|
| 1390 |
+
if not isinstance(fn, BoundJITMethod):
|
| 1391 |
+
static_implementation = self.statically_implemented_functions.get(fn)
|
| 1392 |
+
if static_implementation is not None:
|
| 1393 |
+
return static_implementation(self, node)
|
| 1394 |
+
|
| 1395 |
+
mur = getattr(fn, '_must_use_result', False)
|
| 1396 |
+
if mur and getattr(node, '_is_unused', False):
|
| 1397 |
+
error_message = ["The result of %s is not being used." % ast.unparse(node.func)]
|
| 1398 |
+
if isinstance(mur, str):
|
| 1399 |
+
error_message.append(mur)
|
| 1400 |
+
raise CompilationError(self.jit_fn.src, node, " ".join(error_message))
|
| 1401 |
+
|
| 1402 |
+
kws = dict(self.visit(keyword) for keyword in node.keywords)
|
| 1403 |
+
args = []
|
| 1404 |
+
for arg in node.args:
|
| 1405 |
+
if isinstance(arg, ast.Starred):
|
| 1406 |
+
arg = self.visit(arg.value)
|
| 1407 |
+
assert isinstance(arg, language.core.tuple)
|
| 1408 |
+
args.extend(arg.values)
|
| 1409 |
+
else:
|
| 1410 |
+
args.append(self.visit(arg))
|
| 1411 |
+
|
| 1412 |
+
return self.call_Function(node, fn, args, kws)
|
| 1413 |
+
|
| 1414 |
+
def visit_Constant(self, node):
|
| 1415 |
+
return constexpr(node.value)
|
| 1416 |
+
|
| 1417 |
+
def visit_BoolOp(self, node: ast.BoolOp):
|
| 1418 |
+
method_name = self._method_name_for_bool_op.get(type(node.op))
|
| 1419 |
+
if method_name is None:
|
| 1420 |
+
raise self._unsupported(
|
| 1421 |
+
node, "AST boolean operator '{}' is not (currently) implemented.".format(node.op.__name__))
|
| 1422 |
+
|
| 1423 |
+
nontrivial_values = []
|
| 1424 |
+
|
| 1425 |
+
for subnode in node.values:
|
| 1426 |
+
# we visit the values in order, executing their side-effects
|
| 1427 |
+
# and possibly early-exiting:
|
| 1428 |
+
value = self.visit(subnode)
|
| 1429 |
+
if not _is_triton_tensor(value):
|
| 1430 |
+
# this is a constexpr, so we might be able to short-circuit:
|
| 1431 |
+
bv = bool(value)
|
| 1432 |
+
if (bv is False) and (method_name == "logical_and"):
|
| 1433 |
+
# value is falsey so return that:
|
| 1434 |
+
return value
|
| 1435 |
+
if (bv is True) and (method_name == "logical_or"):
|
| 1436 |
+
# value is truthy so return that:
|
| 1437 |
+
return value
|
| 1438 |
+
# otherwise, our constexpr has no effect on the output of the
|
| 1439 |
+
# expression so we do not append it to nontrivial_values.
|
| 1440 |
+
else:
|
| 1441 |
+
if value.type.is_block():
|
| 1442 |
+
lineno = getattr(node, "lineno", None)
|
| 1443 |
+
if lineno is not None:
|
| 1444 |
+
lineno += self.begin_line
|
| 1445 |
+
warnings.warn_explicit(
|
| 1446 |
+
"Logical operators 'and' and 'or' are deprecated for non-scalar tensors; please use '&' or '|' instead",
|
| 1447 |
+
category=UserWarning,
|
| 1448 |
+
filename=self.file_name,
|
| 1449 |
+
lineno=lineno,
|
| 1450 |
+
source=ast.unparse(node),
|
| 1451 |
+
)
|
| 1452 |
+
# not a constexpr so we must append it:
|
| 1453 |
+
nontrivial_values.append(value)
|
| 1454 |
+
|
| 1455 |
+
if len(nontrivial_values) == 0:
|
| 1456 |
+
# the semantics of a disjunction of falsey values or conjunction
|
| 1457 |
+
# of truthy values is to return the final value:
|
| 1458 |
+
nontrivial_values.append(value)
|
| 1459 |
+
|
| 1460 |
+
while len(nontrivial_values) >= 2:
|
| 1461 |
+
rhs = nontrivial_values.pop()
|
| 1462 |
+
lhs = nontrivial_values.pop()
|
| 1463 |
+
res = self._apply_binary_method(node, method_name, lhs, rhs)
|
| 1464 |
+
nontrivial_values.append(res)
|
| 1465 |
+
|
| 1466 |
+
assert len(nontrivial_values) == 1
|
| 1467 |
+
return nontrivial_values[0]
|
| 1468 |
+
|
| 1469 |
+
_method_name_for_bool_op: Dict[Type[ast.boolop], str] = {ast.And: 'logical_and', ast.Or: 'logical_or'}
|
| 1470 |
+
|
| 1471 |
+
def get_Attribute(self, lhs, attr):
|
| 1472 |
+
if _is_triton_tensor(lhs) and attr == "T":
|
| 1473 |
+
return self.semantic.permute(lhs, (1, 0))
|
| 1474 |
+
# NOTE: special case ".value" for BC
|
| 1475 |
+
if isinstance(lhs, constexpr) and attr not in ("value", "type"):
|
| 1476 |
+
lhs = lhs.value
|
| 1477 |
+
attr = getattr(lhs, attr)
|
| 1478 |
+
if _is_triton_value(lhs) and isinstance(attr, JITFunction):
|
| 1479 |
+
return BoundJITMethod(lhs, attr)
|
| 1480 |
+
return attr
|
| 1481 |
+
|
| 1482 |
+
def visit_Attribute(self, node):
|
| 1483 |
+
lhs = self.visit(node.value)
|
| 1484 |
+
if isinstance(lhs, ModuleType):
|
| 1485 |
+
# follow module_map until reaching fixed-point:
|
| 1486 |
+
while (name := lhs.__name__) in self.builder.module_map:
|
| 1487 |
+
lhs = self.builder.module_map[name]
|
| 1488 |
+
if lhs.__name__ == name:
|
| 1489 |
+
break
|
| 1490 |
+
return self.get_Attribute(lhs, node.attr)
|
| 1491 |
+
|
| 1492 |
+
def visit_Expr(self, node):
|
| 1493 |
+
node.value._is_unused = True
|
| 1494 |
+
ast.NodeVisitor.generic_visit(self, node)
|
| 1495 |
+
|
| 1496 |
+
def visit_NoneType(self, node):
|
| 1497 |
+
return None
|
| 1498 |
+
|
| 1499 |
+
def visit_JoinedStr(self, node):
|
| 1500 |
+
values = list(node.values)
|
| 1501 |
+
for i, value in enumerate(values):
|
| 1502 |
+
if isinstance(value, ast.Constant):
|
| 1503 |
+
values[i] = str(value.value)
|
| 1504 |
+
elif isinstance(value, ast.FormattedValue):
|
| 1505 |
+
conversion_code = value.conversion
|
| 1506 |
+
evaluated = self.visit(value.value)
|
| 1507 |
+
if not _is_constexpr(evaluated):
|
| 1508 |
+
raise self._unsupported(
|
| 1509 |
+
node,
|
| 1510 |
+
"Cannot evaluate f-string containing non-constexpr conversion values, found conversion of type "
|
| 1511 |
+
+ str(type(evaluated)))
|
| 1512 |
+
values[i] = ("{}" if conversion_code < 0 else "{!" + chr(conversion_code) + "}").format(evaluated.value)
|
| 1513 |
+
else:
|
| 1514 |
+
raise AssertionError("encountered unexpected node of type {} in a JoinedStr node".format(type(value)))
|
| 1515 |
+
return ''.join(values)
|
| 1516 |
+
|
| 1517 |
+
def visit(self, node):
|
| 1518 |
+
if node is None:
|
| 1519 |
+
return
|
| 1520 |
+
with warnings.catch_warnings():
|
| 1521 |
+
# The ast library added visit_Constant and deprecated some other
|
| 1522 |
+
# methods but we can't move to that without breaking Python 3.6 and 3.7.
|
| 1523 |
+
warnings.simplefilter("ignore", DeprecationWarning) # python 3.9
|
| 1524 |
+
warnings.simplefilter("ignore", PendingDeprecationWarning) # python 3.8
|
| 1525 |
+
last_node = self.cur_node
|
| 1526 |
+
last_loc = self.builder.get_loc()
|
| 1527 |
+
self.cur_node = node
|
| 1528 |
+
if hasattr(node, 'lineno') and hasattr(node, 'col_offset'):
|
| 1529 |
+
here_loc = self.builder.create_loc(self.file_name, self.begin_line + node.lineno, node.col_offset)
|
| 1530 |
+
if self.name_loc_as_prefix is not None:
|
| 1531 |
+
self.builder.set_loc(self.builder.create_name_loc(self.name_loc_as_prefix, here_loc))
|
| 1532 |
+
else:
|
| 1533 |
+
self.builder.set_loc(here_loc)
|
| 1534 |
+
last_loc = self.builder.get_loc()
|
| 1535 |
+
try:
|
| 1536 |
+
ret = super().visit(node)
|
| 1537 |
+
except CompilationError:
|
| 1538 |
+
raise
|
| 1539 |
+
except Exception as e:
|
| 1540 |
+
if knobs.compilation.front_end_debugging:
|
| 1541 |
+
raise
|
| 1542 |
+
# Wrap the error in a CompilationError which contains the source
|
| 1543 |
+
# of the @jit function.
|
| 1544 |
+
raise CompilationError(self.jit_fn.src, self.cur_node, repr(e)) from None
|
| 1545 |
+
|
| 1546 |
+
# Reset the location to the last one before the visit
|
| 1547 |
+
if last_loc:
|
| 1548 |
+
self.cur_node = last_node
|
| 1549 |
+
self.builder.set_loc(last_loc)
|
| 1550 |
+
return ret
|
| 1551 |
+
|
| 1552 |
+
def generic_visit(self, node):
|
| 1553 |
+
raise self._unsupported(node, "unsupported AST node type: {}".format(type(node).__name__))
|
| 1554 |
+
|
| 1555 |
+
def execute_static_assert(self, node: ast.Call) -> None:
|
| 1556 |
+
arg_count = len(node.args)
|
| 1557 |
+
if not (0 < arg_count <= 2) or len(node.keywords):
|
| 1558 |
+
raise TypeError("`static_assert` requires one or two positional arguments only")
|
| 1559 |
+
|
| 1560 |
+
passed = _unwrap_if_constexpr(self.visit(node.args[0]))
|
| 1561 |
+
if not isinstance(passed, bool):
|
| 1562 |
+
raise NotImplementedError(
|
| 1563 |
+
"Assertion condition could not be determined at compile-time. Make sure that it depends only on `constexpr` values"
|
| 1564 |
+
)
|
| 1565 |
+
if not passed:
|
| 1566 |
+
if arg_count == 1:
|
| 1567 |
+
message = ""
|
| 1568 |
+
else:
|
| 1569 |
+
try:
|
| 1570 |
+
message = self.visit(node.args[1])
|
| 1571 |
+
except Exception as e:
|
| 1572 |
+
message = "<failed to evaluate assertion message: " + repr(e) + ">"
|
| 1573 |
+
|
| 1574 |
+
raise CompileTimeAssertionFailure(self.jit_fn.src, node, _unwrap_if_constexpr(message))
|
| 1575 |
+
return None
|
| 1576 |
+
|
| 1577 |
+
def static_executor(python_fn):
|
| 1578 |
+
|
| 1579 |
+
def ret(self, node: ast.Call):
|
| 1580 |
+
kws = {
|
| 1581 |
+
name: _unwrap_if_constexpr(value)
|
| 1582 |
+
for name, value in (self.visit(keyword) for keyword in node.keywords)
|
| 1583 |
+
}
|
| 1584 |
+
args = [_unwrap_if_constexpr(self.visit(arg)) for arg in node.args]
|
| 1585 |
+
return constexpr(python_fn(*args, **kws))
|
| 1586 |
+
|
| 1587 |
+
return ret
|
| 1588 |
+
|
| 1589 |
+
from ..experimental.gluon import language as ttgl
|
| 1590 |
+
statically_implemented_functions: Dict[object, Callable[[ast.Call], Any]] = {
|
| 1591 |
+
language.core.static_assert: execute_static_assert,
|
| 1592 |
+
language.core.static_print: static_executor(print),
|
| 1593 |
+
ttgl.static_assert: execute_static_assert,
|
| 1594 |
+
ttgl.static_print: static_executor(print),
|
| 1595 |
+
int: static_executor(int),
|
| 1596 |
+
len: static_executor(len),
|
| 1597 |
+
}
|
| 1598 |
+
|
| 1599 |
+
|
| 1600 |
+
def ast_to_ttir(fn, src, context, options, codegen_fns, module_map, module=None):
|
| 1601 |
+
arg_types = [None] * len(fn.arg_names)
|
| 1602 |
+
|
| 1603 |
+
for k, v in src.signature.items():
|
| 1604 |
+
idx = fn.arg_names.index(k)
|
| 1605 |
+
arg_types[idx] = str_to_ty(v, None)
|
| 1606 |
+
|
| 1607 |
+
def apply_constexpr_types(argument, indices, value):
|
| 1608 |
+
index = indices.pop()
|
| 1609 |
+
if len(indices) == 0:
|
| 1610 |
+
if isinstance(argument, list):
|
| 1611 |
+
argument[index] = constexpr(value).type
|
| 1612 |
+
else:
|
| 1613 |
+
argument.types[index] = constexpr(value).type
|
| 1614 |
+
else:
|
| 1615 |
+
apply_constexpr_types(argument[index], indices, value)
|
| 1616 |
+
|
| 1617 |
+
for path, value in src.constants.items():
|
| 1618 |
+
apply_constexpr_types(arg_types, list(path)[::-1], value)
|
| 1619 |
+
|
| 1620 |
+
prototype = ASTFunction([], arg_types, src.constants, src.attrs)
|
| 1621 |
+
file_name, begin_line = get_jit_fn_file_line(fn)
|
| 1622 |
+
# query function representation
|
| 1623 |
+
from collections import namedtuple
|
| 1624 |
+
leaves = filter(lambda v: len(v) == 1, src.constants)
|
| 1625 |
+
constants = {fn.arg_names[i[0]]: src.constants[i] for i in leaves}
|
| 1626 |
+
signature = src.signature
|
| 1627 |
+
proxy = namedtuple("SpecializationProxy", ["constants", "signature"])(constants, signature)
|
| 1628 |
+
generator = CodeGenerator(context, prototype, gscope=fn.get_capture_scope(), function_name=fn.repr(proxy),
|
| 1629 |
+
jit_fn=fn, is_kernel=True, file_name=file_name, begin_line=begin_line, options=options,
|
| 1630 |
+
codegen_fns=codegen_fns, module_map=module_map, module=module, is_gluon=fn.is_gluon())
|
| 1631 |
+
generator.visit(fn.parse())
|
| 1632 |
+
module = generator.module
|
| 1633 |
+
# module takes ownership of the context
|
| 1634 |
+
module.context = context
|
| 1635 |
+
if not module.verify():
|
| 1636 |
+
if not fn.is_gluon():
|
| 1637 |
+
print(module)
|
| 1638 |
+
raise RuntimeError("error encountered during parsing")
|
| 1639 |
+
return module
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/compiler.py
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
import hashlib
|
| 3 |
+
import json
|
| 4 |
+
from .._C.libtriton import get_cache_invalidating_env_vars, ir
|
| 5 |
+
from ..backends import backends
|
| 6 |
+
from ..backends.compiler import Language
|
| 7 |
+
from ..backends.compiler import BaseBackend, GPUTarget
|
| 8 |
+
from .. import __version__, knobs
|
| 9 |
+
from ..runtime.autotuner import OutOfResources
|
| 10 |
+
from ..runtime.cache import get_cache_manager, get_dump_manager, get_override_manager, get_cache_key
|
| 11 |
+
from ..runtime.driver import driver
|
| 12 |
+
from ..tools.disasm import get_sass
|
| 13 |
+
from pathlib import Path
|
| 14 |
+
import re
|
| 15 |
+
import functools
|
| 16 |
+
import os
|
| 17 |
+
import time
|
| 18 |
+
import copy
|
| 19 |
+
|
| 20 |
+
# - ^\s*tt\.func\s+ : match the start of the string, any leading whitespace, the keyword func,
|
| 21 |
+
# and any following whitespace
|
| 22 |
+
# - (public\s+)? : optionally match the keyword public and any following whitespace
|
| 23 |
+
# - (@\w+) : match an @ symbol followed by one or more word characters
|
| 24 |
+
# (letters, digits, or underscores), and capture it as group 1 (the function name)
|
| 25 |
+
# - (\((?:%\w+: \S+(?: \{\S+ = \S+ : \S+\})?(?:, )?)*\)) : match a pair of parentheses enclosing
|
| 26 |
+
# zero or more arguments separated by commas, and capture it as group 2 (the argument list)
|
| 27 |
+
# - (attributes \{[\S\s]+\})? : optionally match attributes enclosed in braces and capture it as group 3
|
| 28 |
+
ptx_prototype_pattern = r"\.(?:visible|extern)\s+\.(?:entry|func)\s+(\w+)\s*\(([^)]*)\)"
|
| 29 |
+
prototype_pattern = {
|
| 30 |
+
"ptx": ptx_prototype_pattern,
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
ptx_arg_type_pattern = r"\.param\s+\.(\w+)"
|
| 34 |
+
arg_type_pattern = {
|
| 35 |
+
"ptx": ptx_arg_type_pattern,
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def convert_type_repr(x):
|
| 40 |
+
# Currently we only capture the pointer type and assume the pointer is on global memory.
|
| 41 |
+
# TODO: Capture and support shared memory space
|
| 42 |
+
match = re.search(r'!tt\.ptr<([^,]+)', x)
|
| 43 |
+
tma = re.search(r'tt.nv_tma_desc = 1', x)
|
| 44 |
+
if tma is not None:
|
| 45 |
+
return 'nvTmaDesc'
|
| 46 |
+
x = re.sub(r' {[^}]+}', '', x)
|
| 47 |
+
if match is not None:
|
| 48 |
+
return '*' + convert_type_repr(match.group(1))
|
| 49 |
+
return x
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
class ASTSource:
|
| 53 |
+
|
| 54 |
+
def __init__(self, fn, signature, constexprs=None, attrs=None) -> None:
|
| 55 |
+
self.fn = fn
|
| 56 |
+
self.language = Language.TRITON
|
| 57 |
+
self.ext = "ttir"
|
| 58 |
+
self.name = fn.__name__
|
| 59 |
+
self.signature = signature
|
| 60 |
+
self.constants = dict()
|
| 61 |
+
if constexprs is not None:
|
| 62 |
+
for k, v in constexprs.items():
|
| 63 |
+
k = (fn.arg_names.index(k), ) if isinstance(k, str) else k
|
| 64 |
+
assert isinstance(k, tuple)
|
| 65 |
+
self.constants[k] = v
|
| 66 |
+
self.attrs = attrs or dict()
|
| 67 |
+
for k in self.signature.keys():
|
| 68 |
+
if not isinstance(k, str):
|
| 69 |
+
raise TypeError("Signature keys must be string")
|
| 70 |
+
|
| 71 |
+
def hash(self):
|
| 72 |
+
sorted_sig = [v for k, v in sorted(self.signature.items())]
|
| 73 |
+
get_key = lambda x: x.cache_key if hasattr(x, 'cache_key') else str(x)
|
| 74 |
+
constants_key = '-'.join([get_key(v) for k, v in sorted(self.constants.items())])
|
| 75 |
+
key = f"{self.fn.cache_key}-{str(self.attrs)}-{sorted_sig}-{constants_key}"
|
| 76 |
+
return hashlib.sha256(key.encode("utf-8")).hexdigest()
|
| 77 |
+
|
| 78 |
+
def make_ir(self, target: GPUTarget, options, codegen_fns, module_map, context):
|
| 79 |
+
from .code_generator import ast_to_ttir
|
| 80 |
+
return ast_to_ttir(self.fn, self, context=context, options=options, codegen_fns=codegen_fns,
|
| 81 |
+
module_map=module_map)
|
| 82 |
+
|
| 83 |
+
def parse_options(self):
|
| 84 |
+
return dict()
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class IRSource:
|
| 88 |
+
|
| 89 |
+
def __init__(self, path, context, backend):
|
| 90 |
+
self.path = path
|
| 91 |
+
path = Path(path)
|
| 92 |
+
self.ext = path.suffix[1:]
|
| 93 |
+
self.language = Language.TRITON
|
| 94 |
+
self.src = path.read_text()
|
| 95 |
+
ir.load_dialects(context)
|
| 96 |
+
backend.load_dialects(context)
|
| 97 |
+
|
| 98 |
+
# We don't have a easy-to-use PTX parser that we can use, so keep that regex for now.
|
| 99 |
+
# TODO - replace with a proper parser
|
| 100 |
+
if self.ext == "ptx":
|
| 101 |
+
match = re.search(prototype_pattern[self.ext], self.src, re.MULTILINE)
|
| 102 |
+
self.name = match.group(1)
|
| 103 |
+
signature = match.group(2)
|
| 104 |
+
types = re.findall(arg_type_pattern[self.ext], signature)
|
| 105 |
+
self.signature = {k: convert_type_repr(ty) for k, ty in enumerate(types)}
|
| 106 |
+
else:
|
| 107 |
+
self.module = ir.parse_mlir_module(self.path, context)
|
| 108 |
+
fn_name = self.module.get_entry_func_name()
|
| 109 |
+
self.name = "@" + fn_name
|
| 110 |
+
funcOp = self.module.get_function(fn_name)
|
| 111 |
+
func_ty = self.module.get_function_signature(funcOp)
|
| 112 |
+
self.signature = {k: ty for k, ty in enumerate(func_ty)}
|
| 113 |
+
|
| 114 |
+
def hash(self):
|
| 115 |
+
return hashlib.sha256(self.src.encode("utf-8")).hexdigest()
|
| 116 |
+
|
| 117 |
+
def make_ir(self, target: GPUTarget, options, codegen_fns, module_map, context):
|
| 118 |
+
self.module.context = context
|
| 119 |
+
return self.module
|
| 120 |
+
|
| 121 |
+
def parse_options(self):
|
| 122 |
+
if self.ext == "ttgir":
|
| 123 |
+
num_warps = self.module.get_int_attr("ttg.num-warps")
|
| 124 |
+
assert num_warps is not None, "Unable to parse ttg.num-warps attribute"
|
| 125 |
+
options = {'num_warps': num_warps}
|
| 126 |
+
num_ctas = self.module.get_int_attr("ttg.num-ctas")
|
| 127 |
+
if num_ctas is not None:
|
| 128 |
+
options['num_ctas'] = num_ctas
|
| 129 |
+
return options
|
| 130 |
+
return dict()
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
@functools.lru_cache()
|
| 134 |
+
def max_shared_mem(device):
|
| 135 |
+
return driver.active.utils.get_device_properties(device)["max_shared_mem"]
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
def parse(full_name, ext, context):
|
| 139 |
+
if ext == "ttir" or ext == "ttgir":
|
| 140 |
+
module = ir.parse_mlir_module(full_name, context)
|
| 141 |
+
module.context = context
|
| 142 |
+
return module
|
| 143 |
+
if ext == "llir" or ext == "ptx" or ext == "amdgcn":
|
| 144 |
+
return Path(full_name).read_text()
|
| 145 |
+
if ext == "cubin" or ext == "hsaco":
|
| 146 |
+
return Path(full_name).read_bytes()
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def filter_traceback(e: BaseException):
|
| 150 |
+
"""
|
| 151 |
+
Removes code_generator.py and related files from tracebacks.
|
| 152 |
+
|
| 153 |
+
These are uninteresting to the user -- "just show me *my* code!"
|
| 154 |
+
"""
|
| 155 |
+
if knobs.compilation.front_end_debugging:
|
| 156 |
+
return
|
| 157 |
+
|
| 158 |
+
if e.__cause__ is not None:
|
| 159 |
+
filter_traceback(e.__cause__)
|
| 160 |
+
if e.__context__ is not None:
|
| 161 |
+
filter_traceback(e.__context__)
|
| 162 |
+
|
| 163 |
+
# If a user has a file that matches one of these, they're out of luck.
|
| 164 |
+
BAD_FILES = [
|
| 165 |
+
"/triton/compiler/code_generator.py",
|
| 166 |
+
"/ast.py",
|
| 167 |
+
]
|
| 168 |
+
BAD_FILES = [bad_file.replace("/", os.sep) for bad_file in BAD_FILES]
|
| 169 |
+
|
| 170 |
+
tb = e.__traceback__
|
| 171 |
+
frames = []
|
| 172 |
+
while tb is not None:
|
| 173 |
+
if not any(f for f in BAD_FILES if tb.tb_frame.f_code.co_filename.endswith(f)):
|
| 174 |
+
frames.append(tb)
|
| 175 |
+
tb = tb.tb_next
|
| 176 |
+
|
| 177 |
+
for (cur_frame, next_frame) in zip(frames, frames[1:]):
|
| 178 |
+
cur_frame.tb_next = next_frame
|
| 179 |
+
|
| 180 |
+
if not frames:
|
| 181 |
+
e.__traceback__ = None
|
| 182 |
+
else:
|
| 183 |
+
frames[-1].tb_next = None
|
| 184 |
+
e.__traceback__ = frames[0]
|
| 185 |
+
|
| 186 |
+
|
| 187 |
+
class CompileTimer:
|
| 188 |
+
|
| 189 |
+
def __init__(self) -> None:
|
| 190 |
+
self.start: float = time.time()
|
| 191 |
+
self.ir_initialization_end: float | None = None
|
| 192 |
+
self.lowering_stage_ends: list[tuple[str, float]] = []
|
| 193 |
+
self.store_results_end: float | None = None
|
| 194 |
+
|
| 195 |
+
def finished_ir_initialization(self) -> None:
|
| 196 |
+
self.ir_initialization_end = time.time()
|
| 197 |
+
|
| 198 |
+
def stage_finished(self, stage_name: str) -> None:
|
| 199 |
+
self.lowering_stage_ends.append((stage_name, time.time()))
|
| 200 |
+
|
| 201 |
+
def end(self) -> knobs.CompileTimes:
|
| 202 |
+
timestamp = time.time()
|
| 203 |
+
if self.ir_initialization_end is None:
|
| 204 |
+
self.ir_initialization_end = timestamp
|
| 205 |
+
else:
|
| 206 |
+
self.store_results_end = timestamp
|
| 207 |
+
|
| 208 |
+
def delta(start: float, end: float | None) -> int:
|
| 209 |
+
if end is None:
|
| 210 |
+
return 0
|
| 211 |
+
return int((end - start) * 1000000)
|
| 212 |
+
|
| 213 |
+
lowering_stage_durations = []
|
| 214 |
+
stage_start = self.ir_initialization_end
|
| 215 |
+
for stage_name, stage_end in self.lowering_stage_ends:
|
| 216 |
+
lowering_stage_durations.append((stage_name, delta(stage_start, stage_end)))
|
| 217 |
+
stage_start = stage_end
|
| 218 |
+
|
| 219 |
+
return knobs.CompileTimes(
|
| 220 |
+
ir_initialization=delta(self.start, self.ir_initialization_end),
|
| 221 |
+
lowering_stages=lowering_stage_durations,
|
| 222 |
+
store_results=delta(stage_start, self.store_results_end),
|
| 223 |
+
)
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
def compile(src, target=None, options=None, _env_vars=None):
|
| 227 |
+
compilation_listener = knobs.compilation.listener
|
| 228 |
+
if compilation_listener:
|
| 229 |
+
timer = CompileTimer()
|
| 230 |
+
|
| 231 |
+
if target is None:
|
| 232 |
+
target = driver.active.get_current_target()
|
| 233 |
+
assert isinstance(target, GPUTarget), "target must be of GPUTarget type"
|
| 234 |
+
backend = make_backend(target)
|
| 235 |
+
ir_source = not isinstance(src, ASTSource)
|
| 236 |
+
# create backend
|
| 237 |
+
if ir_source:
|
| 238 |
+
assert isinstance(src, str), "source must be either AST or a filepath"
|
| 239 |
+
context = ir.context()
|
| 240 |
+
src = IRSource(src, context, backend)
|
| 241 |
+
|
| 242 |
+
extra_options = src.parse_options()
|
| 243 |
+
options = backend.parse_options(dict(options or dict(), **extra_options))
|
| 244 |
+
# create cache manager
|
| 245 |
+
env_vars = get_cache_invalidating_env_vars() if _env_vars is None else _env_vars
|
| 246 |
+
key = get_cache_key(src, backend, options, env_vars=env_vars)
|
| 247 |
+
hash = hashlib.sha256(key.encode("utf-8")).hexdigest()
|
| 248 |
+
fn_cache_manager = get_cache_manager(hash)
|
| 249 |
+
# For dumping/overriding only hash the source as we want it to be independent of triton
|
| 250 |
+
# core changes to make it easier to track kernels by hash.
|
| 251 |
+
enable_override = knobs.compilation.override
|
| 252 |
+
enable_ir_dump = knobs.compilation.dump_ir
|
| 253 |
+
store_only_binary = knobs.compilation.store_binary_only
|
| 254 |
+
fn_override_manager = get_override_manager(src.hash()) if enable_override else None
|
| 255 |
+
fn_dump_manager = get_dump_manager(src.hash()) if enable_ir_dump else None
|
| 256 |
+
# Pre-truncate the file name here to avoid hitting the 255 character limit on common platforms.
|
| 257 |
+
# The final file name in the cache will have a format of f"{filename}.{ext}.tmp.pid_{pid}_{uuid}".
|
| 258 |
+
# A PID string can be 5-character long. A UUID string has typically 36 characters. Let's truncate
|
| 259 |
+
# the file name to 150 characters to be safe.
|
| 260 |
+
file_name = src.name[:150]
|
| 261 |
+
metadata_filename = f"{file_name}.json"
|
| 262 |
+
metadata_group = fn_cache_manager.get_group(metadata_filename) or {}
|
| 263 |
+
metadata_path = metadata_group.get(metadata_filename)
|
| 264 |
+
always_compile = knobs.compilation.always_compile
|
| 265 |
+
if not always_compile and metadata_path is not None:
|
| 266 |
+
# cache hit!
|
| 267 |
+
res = CompiledKernel(src, metadata_group, hash)
|
| 268 |
+
if compilation_listener:
|
| 269 |
+
compilation_listener(
|
| 270 |
+
src=src,
|
| 271 |
+
metadata=res.metadata._asdict(),
|
| 272 |
+
metadata_group=metadata_group,
|
| 273 |
+
times=timer.end(),
|
| 274 |
+
cache_hit=True,
|
| 275 |
+
)
|
| 276 |
+
return res
|
| 277 |
+
|
| 278 |
+
# initialize metadata
|
| 279 |
+
metadata = {
|
| 280 |
+
"hash": hash,
|
| 281 |
+
"target": target,
|
| 282 |
+
**options.__dict__,
|
| 283 |
+
**env_vars,
|
| 284 |
+
}
|
| 285 |
+
metadata["triton_version"] = __version__
|
| 286 |
+
# run compilation pipeline and populate metadata
|
| 287 |
+
stages = dict()
|
| 288 |
+
backend.add_stages(stages, options, src.language)
|
| 289 |
+
first_stage = list(stages.keys()).index(src.ext)
|
| 290 |
+
# when the source is an IR file, don't apply the passes related to this stage. This makes it easier to write IR level tests.
|
| 291 |
+
if ir_source:
|
| 292 |
+
first_stage += 1
|
| 293 |
+
|
| 294 |
+
# For IRSource, we have already grabbed the context + called both
|
| 295 |
+
# ir.load_dialects and backend.load_dialects.
|
| 296 |
+
if not isinstance(src, IRSource):
|
| 297 |
+
context = ir.context()
|
| 298 |
+
ir.load_dialects(context)
|
| 299 |
+
backend.load_dialects(context)
|
| 300 |
+
|
| 301 |
+
codegen_fns = backend.get_codegen_implementation(options)
|
| 302 |
+
module_map = backend.get_module_map()
|
| 303 |
+
try:
|
| 304 |
+
module = src.make_ir(target, options, codegen_fns, module_map, context)
|
| 305 |
+
except Exception as e:
|
| 306 |
+
filter_traceback(e)
|
| 307 |
+
raise
|
| 308 |
+
|
| 309 |
+
if ir_source:
|
| 310 |
+
ir_filename = f"{file_name}.{src.ext}"
|
| 311 |
+
metadata_group[ir_filename] = fn_cache_manager.put(module, ir_filename)
|
| 312 |
+
else:
|
| 313 |
+
ir_filename = f"{file_name}.source"
|
| 314 |
+
metadata_group[ir_filename] = fn_cache_manager.put(module, ir_filename)
|
| 315 |
+
|
| 316 |
+
use_ir_loc = knobs.compilation.use_ir_loc
|
| 317 |
+
if ir_source and use_ir_loc:
|
| 318 |
+
module.create_location_snapshot(src.path)
|
| 319 |
+
print(f"Creating new locations for {src.path}")
|
| 320 |
+
|
| 321 |
+
if compilation_listener:
|
| 322 |
+
timer.finished_ir_initialization()
|
| 323 |
+
for ext, compile_ir in list(stages.items())[first_stage:]:
|
| 324 |
+
next_module = compile_ir(module, metadata)
|
| 325 |
+
ir_filename = f"{file_name}.{ext}"
|
| 326 |
+
if fn_override_manager is None:
|
| 327 |
+
# Users can override kernels at scale by setting `ir_override` in autotune config
|
| 328 |
+
# without TRITON_KERNEL_OVERRIDE
|
| 329 |
+
if (ir_override := metadata.get("ir_override", None)) and ir_override.endswith(f".{ext}"):
|
| 330 |
+
next_module = parse(ir_override, ext, context)
|
| 331 |
+
elif full_name := fn_override_manager.get_file(ir_filename):
|
| 332 |
+
print(f"\nOverriding kernel with file {full_name}")
|
| 333 |
+
next_module = parse(full_name, ext, context)
|
| 334 |
+
# If TRITON_STORE_BINARY_ONLY is 1, only store cubin/hsaco/json
|
| 335 |
+
if (not store_only_binary) or (ext in ("cubin", "hsaco", "json")):
|
| 336 |
+
metadata_group[ir_filename] = fn_cache_manager.put(next_module, ir_filename)
|
| 337 |
+
if fn_dump_manager is not None:
|
| 338 |
+
fn_dump_manager.put(next_module, ir_filename)
|
| 339 |
+
if ext == "cubin":
|
| 340 |
+
sass = get_sass(next_module)
|
| 341 |
+
fn_dump_manager.put(sass, file_name + ".sass")
|
| 342 |
+
# use an env variable to parse ir from file
|
| 343 |
+
if use_ir_loc == ext:
|
| 344 |
+
ir_full_name = fn_cache_manager.get_file(ir_filename)
|
| 345 |
+
next_module.create_location_snapshot(ir_full_name)
|
| 346 |
+
print(f"Creating new locations for {ir_full_name}")
|
| 347 |
+
module = next_module
|
| 348 |
+
if compilation_listener:
|
| 349 |
+
timer.stage_finished(ext)
|
| 350 |
+
# write-back metadata
|
| 351 |
+
metadata_group[metadata_filename] = fn_cache_manager.put(json.dumps(metadata, default=vars), metadata_filename,
|
| 352 |
+
binary=False)
|
| 353 |
+
fn_cache_manager.put_group(metadata_filename, metadata_group)
|
| 354 |
+
|
| 355 |
+
# notify any listener
|
| 356 |
+
if compilation_listener:
|
| 357 |
+
compilation_listener(src=src, metadata=metadata, metadata_group=metadata_group, times=timer.end(),
|
| 358 |
+
cache_hit=False)
|
| 359 |
+
# return handle to compiled kernel
|
| 360 |
+
return CompiledKernel(src, metadata_group, hash)
|
| 361 |
+
|
| 362 |
+
|
| 363 |
+
def make_backend(target: GPUTarget) -> BaseBackend:
|
| 364 |
+
actives = [x.compiler for x in backends.values() if x.compiler.supports_target(target)]
|
| 365 |
+
if len(actives) != 1:
|
| 366 |
+
raise RuntimeError(
|
| 367 |
+
f"{len(actives)} compatible backends for target ({target.backend}) ({actives}). There should only be one.")
|
| 368 |
+
return actives[0](target)
|
| 369 |
+
|
| 370 |
+
|
| 371 |
+
class LazyDict:
|
| 372 |
+
|
| 373 |
+
def __init__(self, data):
|
| 374 |
+
self.data = data
|
| 375 |
+
self.extras = []
|
| 376 |
+
|
| 377 |
+
def get(self):
|
| 378 |
+
for func, args in self.extras:
|
| 379 |
+
self.data = self.data | func(*args)
|
| 380 |
+
self.extras.clear()
|
| 381 |
+
return self.data
|
| 382 |
+
|
| 383 |
+
def add(self, func, args):
|
| 384 |
+
self.extras.append((func, args))
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
class AsmDict(dict):
|
| 388 |
+
|
| 389 |
+
def __missing__(self, key):
|
| 390 |
+
|
| 391 |
+
if key == "sass":
|
| 392 |
+
value = get_sass(self["cubin"])
|
| 393 |
+
else:
|
| 394 |
+
raise KeyError("Unknown key: '%s'" % key)
|
| 395 |
+
|
| 396 |
+
self[key] = value
|
| 397 |
+
return value
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
def _raise_error(err, *args, **kwargs):
|
| 401 |
+
raise copy.deepcopy(err)
|
| 402 |
+
|
| 403 |
+
|
| 404 |
+
class CompiledKernel:
|
| 405 |
+
|
| 406 |
+
def __init__(self, src, metadata_group, hash):
|
| 407 |
+
from collections import namedtuple
|
| 408 |
+
metadata_path = next((Path(p) for c, p in metadata_group.items() if c.endswith(".json")))
|
| 409 |
+
metadata = json.loads(metadata_path.read_text())
|
| 410 |
+
# JSON serialization dumps the target as a dict. Restore it to a GPUTarget.
|
| 411 |
+
target = metadata['target']
|
| 412 |
+
metadata['target'] = GPUTarget(target['backend'], target['arch'], target['warp_size'])
|
| 413 |
+
KernelMetadata = namedtuple('KernelMetadata', sorted(list(metadata.keys())))
|
| 414 |
+
self.metadata = KernelMetadata(**metadata)
|
| 415 |
+
backend = make_backend(self.metadata.target)
|
| 416 |
+
self.packed_metadata = backend.pack_metadata(self.metadata)
|
| 417 |
+
self.src = src
|
| 418 |
+
self.hash = hash
|
| 419 |
+
self.name = self.metadata.name
|
| 420 |
+
# stores the text of each level of IR that was generated during compilation
|
| 421 |
+
asm_files = [Path(p) for c, p in metadata_group.items() if not c.endswith(".json")]
|
| 422 |
+
binary_ext = backend.binary_ext
|
| 423 |
+
self.asm = AsmDict({
|
| 424 |
+
file.suffix[1:]: file.read_bytes() if file.suffix[1:] == binary_ext else file.read_text()
|
| 425 |
+
for file in asm_files
|
| 426 |
+
})
|
| 427 |
+
self.metadata_group = metadata_group
|
| 428 |
+
self.kernel = self.asm[binary_ext]
|
| 429 |
+
# binaries are lazily initialized
|
| 430 |
+
# because it involves doing runtime things
|
| 431 |
+
# (e.g., checking amount of shared memory on current device)
|
| 432 |
+
self.module = None
|
| 433 |
+
self.function = None
|
| 434 |
+
self._run = None
|
| 435 |
+
|
| 436 |
+
def _init_handles(self):
|
| 437 |
+
if self.module is not None:
|
| 438 |
+
return
|
| 439 |
+
|
| 440 |
+
def raise_(err):
|
| 441 |
+
# clone the exception object so that the one saved in the closure
|
| 442 |
+
# of the partial function below doesn't get assigned a stack trace
|
| 443 |
+
# after the subsequent raise. otherwise, the CompiledKernel instance
|
| 444 |
+
# saved in the (global) kernel cache will keep references to all the
|
| 445 |
+
# locals in the traceback via the exception instance in the closure.
|
| 446 |
+
cloned_err = copy.deepcopy(err)
|
| 447 |
+
self._run = functools.partial(_raise_error, cloned_err)
|
| 448 |
+
raise err
|
| 449 |
+
|
| 450 |
+
device = driver.active.get_current_device()
|
| 451 |
+
# create launcher
|
| 452 |
+
self._run = driver.active.launcher_cls(self.src, self.metadata)
|
| 453 |
+
# not enough shared memory to run the kernel
|
| 454 |
+
max_shared = max_shared_mem(device)
|
| 455 |
+
if self.metadata.shared > max_shared:
|
| 456 |
+
raise_(OutOfResources(self.metadata.shared, max_shared, "shared memory"))
|
| 457 |
+
if hasattr(self.metadata, "tmem_size") and self.metadata.tmem_size is not None:
|
| 458 |
+
# Use blackwell max tmem size for now, this should be moved in device properties
|
| 459 |
+
max_tmem_size = 512 # tmem size in number of columns
|
| 460 |
+
if self.metadata.tmem_size > max_tmem_size:
|
| 461 |
+
raise_(OutOfResources(self.metadata.tmem_size, max_tmem_size, "tensor memory"))
|
| 462 |
+
if knobs.runtime.kernel_load_start_hook is not None:
|
| 463 |
+
knobs.runtime.kernel_load_start_hook(self.module, self.function, self.name, self.metadata_group, self.hash)
|
| 464 |
+
# TODO: n_regs, n_spills should be metadata generated when calling `ptxas`
|
| 465 |
+
self.module, self.function, self.n_regs, self.n_spills, self.n_max_threads = driver.active.utils.load_binary(
|
| 466 |
+
self.name, self.kernel, self.metadata.shared, device)
|
| 467 |
+
warp_size = driver.active.get_current_target().warp_size
|
| 468 |
+
if self.metadata.num_warps * warp_size > self.n_max_threads:
|
| 469 |
+
raise_(OutOfResources(self.metadata.num_warps * warp_size, self.n_max_threads, "threads"))
|
| 470 |
+
if knobs.runtime.kernel_load_end_hook is not None:
|
| 471 |
+
knobs.runtime.kernel_load_end_hook(self.module, self.function, self.name, self.metadata_group, self.hash)
|
| 472 |
+
|
| 473 |
+
@property
|
| 474 |
+
def run(self):
|
| 475 |
+
if self._run is None:
|
| 476 |
+
self._init_handles()
|
| 477 |
+
return self._run
|
| 478 |
+
|
| 479 |
+
def launch_metadata(self, grid, stream, *args):
|
| 480 |
+
if knobs.runtime.launch_enter_hook is None:
|
| 481 |
+
return None
|
| 482 |
+
self._init_handles()
|
| 483 |
+
ret = LazyDict({"name": self.name, "function": self.function, "stream": stream})
|
| 484 |
+
if not isinstance(self.src, ASTSource) or self.src.fn.launch_metadata is None:
|
| 485 |
+
return ret
|
| 486 |
+
arg_dict = {name: arg for name, arg in zip(self.src.fn.arg_names, args)}
|
| 487 |
+
ret.add(self.src.fn.launch_metadata, (grid, self.metadata, arg_dict))
|
| 488 |
+
return ret
|
| 489 |
+
|
| 490 |
+
def __getitem__(self, grid):
|
| 491 |
+
self._init_handles()
|
| 492 |
+
|
| 493 |
+
def runner(*args, stream=None):
|
| 494 |
+
if stream is None:
|
| 495 |
+
device = driver.active.get_current_device()
|
| 496 |
+
stream = driver.active.get_current_stream(device)
|
| 497 |
+
launch_metadata = self.launch_metadata(grid, stream, *args)
|
| 498 |
+
self.run(grid[0], grid[1], grid[2], stream, self.function, self.packed_metadata, launch_metadata,
|
| 499 |
+
knobs.runtime.launch_enter_hook, knobs.runtime.launch_exit_hook, *args)
|
| 500 |
+
|
| 501 |
+
return runner
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/errors.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import ast
|
| 2 |
+
from typing import Optional
|
| 3 |
+
from ..errors import TritonError
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class CompilationError(TritonError):
|
| 7 |
+
"""Base class for all errors raised during compilation"""
|
| 8 |
+
source_line_count_max_in_message = 12
|
| 9 |
+
|
| 10 |
+
def _format_message(self) -> str:
|
| 11 |
+
node = self.node
|
| 12 |
+
if self.src is None:
|
| 13 |
+
source_excerpt = " <source unavailable>"
|
| 14 |
+
else:
|
| 15 |
+
if hasattr(node, 'lineno'):
|
| 16 |
+
source_excerpt = self.src.split('\n')[:node.lineno][-self.source_line_count_max_in_message:]
|
| 17 |
+
if source_excerpt:
|
| 18 |
+
source_excerpt.append(' ' * node.col_offset + '^')
|
| 19 |
+
source_excerpt = '\n'.join(source_excerpt)
|
| 20 |
+
else:
|
| 21 |
+
source_excerpt = " <source empty>"
|
| 22 |
+
else:
|
| 23 |
+
source_excerpt = self.src
|
| 24 |
+
|
| 25 |
+
message = "at {}:{}:\n{}".format(node.lineno, node.col_offset, source_excerpt) if hasattr(
|
| 26 |
+
node, 'lineno') else source_excerpt
|
| 27 |
+
if self.error_message:
|
| 28 |
+
message += '\n' + self.error_message
|
| 29 |
+
return message
|
| 30 |
+
|
| 31 |
+
def __init__(self, src: Optional[str], node: ast.AST, error_message: Optional[str] = None):
|
| 32 |
+
self.src = src
|
| 33 |
+
self.node = node
|
| 34 |
+
self.error_message = error_message
|
| 35 |
+
self.message = self._format_message()
|
| 36 |
+
|
| 37 |
+
def __str__(self):
|
| 38 |
+
return self.message
|
| 39 |
+
|
| 40 |
+
def __reduce__(self):
|
| 41 |
+
# this is necessary to make CompilationError picklable
|
| 42 |
+
return type(self), (self.src, self.node, self.error_message)
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class CompileTimeAssertionFailure(CompilationError):
|
| 46 |
+
"""Specific exception for failed tests in `static_assert` invocations"""
|
| 47 |
+
pass
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class UnsupportedLanguageConstruct(CompilationError):
|
| 51 |
+
pass
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/compiler/make_launcher.py
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/__init__.py
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . import nvidia
|
| 2 |
+
from . import amd
|
| 3 |
+
from ._runtime import constexpr_function, jit
|
| 4 |
+
from triton.language.core import must_use_result
|
| 5 |
+
|
| 6 |
+
__all__ = ["constexpr_function", "jit", "must_use_result", "nvidia", "amd"]
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/_compiler.py
ADDED
|
File without changes
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/_runtime.py
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
from triton.compiler.compiler import ASTSource
|
| 3 |
+
from triton.backends.compiler import Language
|
| 4 |
+
from triton.runtime.jit import JITFunction, constexpr_function
|
| 5 |
+
from typing import TypeVar, Optional, Callable, Iterable, Union
|
| 6 |
+
from triton._C.libtriton import ir
|
| 7 |
+
|
| 8 |
+
T = TypeVar("T")
|
| 9 |
+
|
| 10 |
+
__all__ = ["constexpr_function", "jit"]
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
class GluonASTSource(ASTSource):
|
| 14 |
+
|
| 15 |
+
def __init__(self, fn, signature, constexprs=None, attrs=None) -> None:
|
| 16 |
+
super().__init__(fn, signature, constexprs, attrs)
|
| 17 |
+
self.language = Language.GLUON
|
| 18 |
+
self.ext = "ttgir"
|
| 19 |
+
|
| 20 |
+
def make_ir(self, target, options, codegen_fns, module_map, context):
|
| 21 |
+
from triton.compiler.compiler import make_backend
|
| 22 |
+
from triton.compiler.code_generator import ast_to_ttir
|
| 23 |
+
|
| 24 |
+
builder = ir.builder(context)
|
| 25 |
+
module = builder.create_module()
|
| 26 |
+
|
| 27 |
+
# Assign module attributes eagerly, as they are needed to verify layouts
|
| 28 |
+
backend = make_backend(target)
|
| 29 |
+
target = backend.get_target_name(options)
|
| 30 |
+
|
| 31 |
+
module.set_attr("ttg.target", builder.get_string_attr(target))
|
| 32 |
+
module.set_attr("ttg.num-warps", builder.get_int32_attr(options.num_warps))
|
| 33 |
+
module.set_attr("ttg.num-ctas", builder.get_int32_attr(options.num_ctas))
|
| 34 |
+
module.set_attr("ttg.threads-per-warp", builder.get_int32_attr(options.warp_size))
|
| 35 |
+
|
| 36 |
+
is_cuda = options.backend_name == "cuda"
|
| 37 |
+
if is_cuda and options.maxnreg is not None:
|
| 38 |
+
module.set_attr("ttg.maxnreg", builder.get_int32_attr(options.maxnreg))
|
| 39 |
+
|
| 40 |
+
module = ast_to_ttir(self.fn, self, context=context, options=options, codegen_fns=codegen_fns,
|
| 41 |
+
module_map=module_map, module=module)
|
| 42 |
+
return module
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class GluonJITFunction(JITFunction[T]):
|
| 46 |
+
|
| 47 |
+
def create_binder(self):
|
| 48 |
+
result = super().create_binder()
|
| 49 |
+
self.ASTSource = GluonASTSource
|
| 50 |
+
return result
|
| 51 |
+
|
| 52 |
+
def is_gluon(self):
|
| 53 |
+
return True
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def jit(
|
| 57 |
+
fn: Optional[T] = None,
|
| 58 |
+
*,
|
| 59 |
+
version=None,
|
| 60 |
+
repr: Optional[Callable] = None,
|
| 61 |
+
launch_metadata: Optional[Callable] = None,
|
| 62 |
+
do_not_specialize: Optional[Iterable[int | str]] = None,
|
| 63 |
+
do_not_specialize_on_alignment: Optional[Iterable[int | str]] = None,
|
| 64 |
+
debug: Optional[bool] = None,
|
| 65 |
+
noinline: Optional[bool] = None,
|
| 66 |
+
) -> Union[GluonJITFunction[T], Callable[[T], JITFunction[T]]]:
|
| 67 |
+
"""
|
| 68 |
+
Decorator for JIT-compiling a function using the Triton compiler.
|
| 69 |
+
|
| 70 |
+
:note: When a jit'd function is called, arguments are
|
| 71 |
+
implicitly converted to pointers if they have a :code:`.data_ptr()` method
|
| 72 |
+
and a `.dtype` attribute.
|
| 73 |
+
|
| 74 |
+
:note: This function will be compiled and run on the GPU. It will only have access to:
|
| 75 |
+
|
| 76 |
+
* python primitives,
|
| 77 |
+
* builtins within the triton package,
|
| 78 |
+
* arguments to this function,
|
| 79 |
+
* other jit'd functions
|
| 80 |
+
|
| 81 |
+
:param fn: the function to be jit-compiled
|
| 82 |
+
:type fn: Callable
|
| 83 |
+
"""
|
| 84 |
+
|
| 85 |
+
def decorator(fn: T) -> JITFunction[T]:
|
| 86 |
+
assert callable(fn)
|
| 87 |
+
return GluonJITFunction(
|
| 88 |
+
fn,
|
| 89 |
+
version=version,
|
| 90 |
+
do_not_specialize=do_not_specialize,
|
| 91 |
+
do_not_specialize_on_alignment=do_not_specialize_on_alignment,
|
| 92 |
+
debug=debug,
|
| 93 |
+
noinline=noinline,
|
| 94 |
+
repr=repr,
|
| 95 |
+
launch_metadata=launch_metadata,
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
if fn is not None:
|
| 99 |
+
return decorator(fn)
|
| 100 |
+
|
| 101 |
+
else:
|
| 102 |
+
return decorator
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/amd/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from . import gfx1250
|
| 2 |
+
|
| 3 |
+
__all__ = ["gfx1250"]
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/amd/gfx1250.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dataclasses import dataclass
|
| 2 |
+
from typing import List, Any
|
| 3 |
+
from triton._utils import validate_block_shape
|
| 4 |
+
from triton.experimental.gluon.language._layouts import PaddedSharedLayout, SwizzledSharedLayout
|
| 5 |
+
|
| 6 |
+
__all__ = ["TensorDescriptor"]
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
@dataclass
|
| 10 |
+
class TensorDescriptor:
|
| 11 |
+
base: Any
|
| 12 |
+
shape: List[int]
|
| 13 |
+
strides: List[int]
|
| 14 |
+
block_shape: List[int]
|
| 15 |
+
layout: PaddedSharedLayout | SwizzledSharedLayout
|
| 16 |
+
padding: str = "zero"
|
| 17 |
+
|
| 18 |
+
def __post_init__(self):
|
| 19 |
+
ndim = len(self.shape)
|
| 20 |
+
# TODO: support 1D-5D tensor descriptors
|
| 21 |
+
assert ndim == 2, f"Expected 2 dimensions but got {ndim} dimensions"
|
| 22 |
+
assert len(self.strides) == ndim, f"Expected {ndim} strides but got {len(self.strides)}"
|
| 23 |
+
assert len(self.block_shape) == ndim, \
|
| 24 |
+
f"Expected block_shape to have {ndim} dimensions but got {len(self.strides)}"
|
| 25 |
+
validate_block_shape(self.block_shape)
|
| 26 |
+
assert self.strides[-1] == 1, "Last dimension must be contiguous"
|
| 27 |
+
assert isinstance(self.layout, (PaddedSharedLayout, SwizzledSharedLayout)), \
|
| 28 |
+
"Expected layout to be a PaddedSharedLayout or SwizzledSharedLayout"
|
| 29 |
+
if isinstance(self.layout, SwizzledSharedLayout):
|
| 30 |
+
assert self.layout.max_phase == 1, "Expected max_phase to be 1 for SwizzledSharedLayout"
|
| 31 |
+
assert self.padding == "zero", "Only 'zero' padding is supported"
|
| 32 |
+
|
| 33 |
+
@staticmethod
|
| 34 |
+
def from_tensor(tensor: Any, block_shape: List[int], layout: PaddedSharedLayout | SwizzledSharedLayout):
|
| 35 |
+
""" Create a TensorDescriptor object from a tensor.
|
| 36 |
+
|
| 37 |
+
Args:
|
| 38 |
+
tensor (torch.Tensor): The input tensor.
|
| 39 |
+
block_shape (List[int]): The block shape of the tensor.
|
| 40 |
+
layout (PaddedSharedLayout | SwizzledSharedLayout): The layout of the tensor in shared memory.
|
| 41 |
+
|
| 42 |
+
Returns:
|
| 43 |
+
tensor_descriptor: the created TensorDescriptor object
|
| 44 |
+
|
| 45 |
+
"""
|
| 46 |
+
return TensorDescriptor(tensor, tensor.shape, tensor.stride(), block_shape, layout)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/__init__.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ._core import (
|
| 2 |
+
base_value,
|
| 3 |
+
base_type,
|
| 4 |
+
block_type,
|
| 5 |
+
broadcast,
|
| 6 |
+
cast,
|
| 7 |
+
constexpr,
|
| 8 |
+
dtype,
|
| 9 |
+
void,
|
| 10 |
+
int1,
|
| 11 |
+
int8,
|
| 12 |
+
int16,
|
| 13 |
+
int32,
|
| 14 |
+
int64,
|
| 15 |
+
uint8,
|
| 16 |
+
uint16,
|
| 17 |
+
uint32,
|
| 18 |
+
uint64,
|
| 19 |
+
float8e5,
|
| 20 |
+
float8e5b16,
|
| 21 |
+
float8e4nv,
|
| 22 |
+
float8e4b8,
|
| 23 |
+
float8e4b15,
|
| 24 |
+
float16,
|
| 25 |
+
bfloat16,
|
| 26 |
+
float32,
|
| 27 |
+
float64,
|
| 28 |
+
pointer_type,
|
| 29 |
+
shared_memory_descriptor,
|
| 30 |
+
tensor,
|
| 31 |
+
tuple,
|
| 32 |
+
tuple_type,
|
| 33 |
+
_unwrap_if_constexpr,
|
| 34 |
+
# API Functions
|
| 35 |
+
add,
|
| 36 |
+
allocate_shared_memory,
|
| 37 |
+
arange,
|
| 38 |
+
associative_scan,
|
| 39 |
+
assume,
|
| 40 |
+
atomic_add,
|
| 41 |
+
atomic_and,
|
| 42 |
+
atomic_cas,
|
| 43 |
+
atomic_max,
|
| 44 |
+
atomic_min,
|
| 45 |
+
atomic_or,
|
| 46 |
+
atomic_xchg,
|
| 47 |
+
atomic_xor,
|
| 48 |
+
bank_conflicts,
|
| 49 |
+
convert_layout,
|
| 50 |
+
device_assert,
|
| 51 |
+
device_print,
|
| 52 |
+
dot_fma,
|
| 53 |
+
expand_dims,
|
| 54 |
+
full,
|
| 55 |
+
fp4_to_fp,
|
| 56 |
+
gather,
|
| 57 |
+
num_warps,
|
| 58 |
+
num_ctas,
|
| 59 |
+
histogram,
|
| 60 |
+
inline_asm_elementwise,
|
| 61 |
+
join,
|
| 62 |
+
load,
|
| 63 |
+
map_elementwise,
|
| 64 |
+
max_constancy,
|
| 65 |
+
max_contiguous,
|
| 66 |
+
maximum,
|
| 67 |
+
minimum,
|
| 68 |
+
mul,
|
| 69 |
+
multiple_of,
|
| 70 |
+
num_programs,
|
| 71 |
+
permute,
|
| 72 |
+
program_id,
|
| 73 |
+
reduce,
|
| 74 |
+
reshape,
|
| 75 |
+
distributed_type,
|
| 76 |
+
shared_memory_descriptor_type,
|
| 77 |
+
set_auto_layout,
|
| 78 |
+
split,
|
| 79 |
+
static_assert,
|
| 80 |
+
static_print,
|
| 81 |
+
static_range,
|
| 82 |
+
store,
|
| 83 |
+
sub,
|
| 84 |
+
thread_barrier,
|
| 85 |
+
to_linear_layout,
|
| 86 |
+
to_tensor,
|
| 87 |
+
warp_specialize,
|
| 88 |
+
where,
|
| 89 |
+
)
|
| 90 |
+
from ._layouts import (
|
| 91 |
+
AutoLayout,
|
| 92 |
+
BlockedLayout,
|
| 93 |
+
SliceLayout,
|
| 94 |
+
DistributedLinearLayout,
|
| 95 |
+
DotOperandLayout,
|
| 96 |
+
NVMMADistributedLayout,
|
| 97 |
+
NVMMASharedLayout,
|
| 98 |
+
SwizzledSharedLayout,
|
| 99 |
+
PaddedSharedLayout,
|
| 100 |
+
SharedLinearLayout,
|
| 101 |
+
CoalescedLayout,
|
| 102 |
+
)
|
| 103 |
+
from ._math import (
|
| 104 |
+
umulhi,
|
| 105 |
+
exp,
|
| 106 |
+
exp2,
|
| 107 |
+
fma,
|
| 108 |
+
log,
|
| 109 |
+
log2,
|
| 110 |
+
cos,
|
| 111 |
+
rsqrt,
|
| 112 |
+
sin,
|
| 113 |
+
sqrt,
|
| 114 |
+
sqrt_rn,
|
| 115 |
+
abs,
|
| 116 |
+
fdiv,
|
| 117 |
+
div_rn,
|
| 118 |
+
erf,
|
| 119 |
+
floor,
|
| 120 |
+
ceil,
|
| 121 |
+
)
|
| 122 |
+
from ._standard import (
|
| 123 |
+
cdiv,
|
| 124 |
+
full_like,
|
| 125 |
+
max,
|
| 126 |
+
min,
|
| 127 |
+
ravel,
|
| 128 |
+
reduce_or,
|
| 129 |
+
sum,
|
| 130 |
+
xor_sum,
|
| 131 |
+
zeros,
|
| 132 |
+
zeros_like,
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
from . import nvidia
|
| 136 |
+
from . import amd
|
| 137 |
+
from . import extra
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_core.py
ADDED
|
@@ -0,0 +1,592 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
import math
|
| 3 |
+
from typing import TypeVar, List, TYPE_CHECKING, Tuple
|
| 4 |
+
from functools import wraps
|
| 5 |
+
import warnings
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
from triton._C.libtriton.gluon_ir import GluonOpBuilder
|
| 9 |
+
from ._semantic import GluonSemantic
|
| 10 |
+
|
| 11 |
+
from ._layouts import SharedLayout, DistributedLayout, BlockedLayout, DotOperandLayout, AutoLayout, CoalescedLayout
|
| 12 |
+
from triton._C.libtriton import ir
|
| 13 |
+
import triton.language.core as tl_core
|
| 14 |
+
from triton.language.core import (
|
| 15 |
+
constexpr,
|
| 16 |
+
base_value,
|
| 17 |
+
base_type,
|
| 18 |
+
dtype,
|
| 19 |
+
block_type, # TODO: block type with layout info
|
| 20 |
+
pointer_type,
|
| 21 |
+
void,
|
| 22 |
+
int1,
|
| 23 |
+
int8,
|
| 24 |
+
int16,
|
| 25 |
+
int32,
|
| 26 |
+
int64,
|
| 27 |
+
uint8,
|
| 28 |
+
uint16,
|
| 29 |
+
uint32,
|
| 30 |
+
uint64,
|
| 31 |
+
float8e5,
|
| 32 |
+
float8e5b16,
|
| 33 |
+
float8e4nv,
|
| 34 |
+
float8e4b8,
|
| 35 |
+
float8e4b15,
|
| 36 |
+
float16,
|
| 37 |
+
bfloat16,
|
| 38 |
+
float32,
|
| 39 |
+
float64,
|
| 40 |
+
_unwrap_if_constexpr,
|
| 41 |
+
_unwrap_shape,
|
| 42 |
+
static_range,
|
| 43 |
+
tensor,
|
| 44 |
+
tuple,
|
| 45 |
+
tuple_type,
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
# We define __all__ only to appease the python linter, these are not used in
|
| 49 |
+
# this file but we want to import them anyway so they are importable from here.
|
| 50 |
+
__all__ = [
|
| 51 |
+
"constexpr",
|
| 52 |
+
"pointer_type",
|
| 53 |
+
"void",
|
| 54 |
+
"int1",
|
| 55 |
+
"int8",
|
| 56 |
+
"int16",
|
| 57 |
+
"int32",
|
| 58 |
+
"int64",
|
| 59 |
+
"uint8",
|
| 60 |
+
"uint16",
|
| 61 |
+
"uint32",
|
| 62 |
+
"uint64",
|
| 63 |
+
"float8e5",
|
| 64 |
+
"float8e5b16",
|
| 65 |
+
"float8e4nv",
|
| 66 |
+
"float8e4b8",
|
| 67 |
+
"float8e4b15",
|
| 68 |
+
"float16",
|
| 69 |
+
"bfloat16",
|
| 70 |
+
"float32",
|
| 71 |
+
"float64",
|
| 72 |
+
"distributed_type",
|
| 73 |
+
"shared_memory_descriptor_type",
|
| 74 |
+
"static_range",
|
| 75 |
+
"tuple",
|
| 76 |
+
"tuple_type",
|
| 77 |
+
"num_ctas",
|
| 78 |
+
]
|
| 79 |
+
|
| 80 |
+
T = TypeVar("T")
|
| 81 |
+
|
| 82 |
+
# TODO: split these
|
| 83 |
+
GLUON_BUILTIN = "__triton_builtin__"
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
def builtin(fn: T) -> T:
|
| 87 |
+
"""Mark a function as a builtin."""
|
| 88 |
+
assert callable(fn)
|
| 89 |
+
|
| 90 |
+
@wraps(fn)
|
| 91 |
+
def wrapper(*args, **kwargs):
|
| 92 |
+
if "_semantic" not in kwargs or kwargs["_semantic"] is None:
|
| 93 |
+
raise ValueError("Did you forget to add @triton.gluon.jit ? "
|
| 94 |
+
"(`_semantic` argument must be provided outside of JIT functions.)")
|
| 95 |
+
return fn(*args, **kwargs)
|
| 96 |
+
|
| 97 |
+
setattr(wrapper, GLUON_BUILTIN, True)
|
| 98 |
+
|
| 99 |
+
return wrapper
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
# Explicitly import forwarded Triton language symbols so mypy sees them.
|
| 103 |
+
add = builtin(tl_core.add)
|
| 104 |
+
associative_scan = builtin(tl_core.associative_scan)
|
| 105 |
+
assume = builtin(tl_core.assume)
|
| 106 |
+
atomic_add = builtin(tl_core.atomic_add)
|
| 107 |
+
atomic_and = builtin(tl_core.atomic_and)
|
| 108 |
+
atomic_cas = builtin(tl_core.atomic_cas)
|
| 109 |
+
atomic_max = builtin(tl_core.atomic_max)
|
| 110 |
+
atomic_min = builtin(tl_core.atomic_min)
|
| 111 |
+
atomic_or = builtin(tl_core.atomic_or)
|
| 112 |
+
atomic_xchg = builtin(tl_core.atomic_xchg)
|
| 113 |
+
atomic_xor = builtin(tl_core.atomic_xor)
|
| 114 |
+
broadcast = builtin(tl_core.broadcast)
|
| 115 |
+
cast = builtin(tl_core.cast)
|
| 116 |
+
device_assert = builtin(tl_core.device_assert)
|
| 117 |
+
device_print = builtin(tl_core.device_print)
|
| 118 |
+
expand_dims = builtin(tl_core.expand_dims)
|
| 119 |
+
gather = builtin(tl_core.gather)
|
| 120 |
+
inline_asm_elementwise = builtin(tl_core.inline_asm_elementwise)
|
| 121 |
+
join = builtin(tl_core.join)
|
| 122 |
+
load = builtin(tl_core.load)
|
| 123 |
+
map_elementwise = builtin(tl_core.map_elementwise)
|
| 124 |
+
max_constancy = builtin(tl_core.max_constancy)
|
| 125 |
+
max_contiguous = builtin(tl_core.max_contiguous)
|
| 126 |
+
maximum = builtin(tl_core.maximum)
|
| 127 |
+
minimum = builtin(tl_core.minimum)
|
| 128 |
+
mul = builtin(tl_core.mul)
|
| 129 |
+
multiple_of = builtin(tl_core.multiple_of)
|
| 130 |
+
num_programs = builtin(tl_core.num_programs)
|
| 131 |
+
permute = builtin(tl_core.permute)
|
| 132 |
+
program_id = builtin(tl_core.program_id)
|
| 133 |
+
reduce = builtin(tl_core.reduce)
|
| 134 |
+
reshape = builtin(tl_core.reshape)
|
| 135 |
+
split = builtin(tl_core.split)
|
| 136 |
+
static_assert = builtin(tl_core.static_assert)
|
| 137 |
+
static_print = builtin(tl_core.static_print)
|
| 138 |
+
store = builtin(tl_core.store)
|
| 139 |
+
sub = builtin(tl_core.sub)
|
| 140 |
+
to_tensor = builtin(tl_core.to_tensor)
|
| 141 |
+
where = builtin(tl_core.where)
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
class distributed_type(block_type):
|
| 145 |
+
|
| 146 |
+
def __init__(self, element_ty: dtype, shape: List[int], layout):
|
| 147 |
+
layout = _unwrap_if_constexpr(layout)
|
| 148 |
+
shape = _unwrap_if_constexpr(shape)
|
| 149 |
+
super().__init__(element_ty, shape)
|
| 150 |
+
self.layout = layout
|
| 151 |
+
self.name = f"<{self.shape}, {self.element_ty}, {self.layout}>"
|
| 152 |
+
assert isinstance(layout, DistributedLayout), "tensor layout must be a DistributedLayout"
|
| 153 |
+
if not isinstance(layout, (AutoLayout, CoalescedLayout)):
|
| 154 |
+
assert len(
|
| 155 |
+
shape
|
| 156 |
+
) == layout.rank, f"tensor shape and layout rank mismatch: shape={shape}, layout={layout}, shape rank={len(shape)}, layout rank={layout.rank}"
|
| 157 |
+
|
| 158 |
+
def to_ir(self, builder: ir.builder) -> ir.type:
|
| 159 |
+
elem_ty = self.element_ty.to_ir(builder)
|
| 160 |
+
layout = self.layout._to_ir(builder)
|
| 161 |
+
return builder.get_distributed_ty(elem_ty, self.shape, layout)
|
| 162 |
+
|
| 163 |
+
def mangle(self) -> str:
|
| 164 |
+
elt = self.scalar.mangle()
|
| 165 |
+
shape = "_".join(map(str, self.shape))
|
| 166 |
+
layout = self.layout.mangle()
|
| 167 |
+
return f"{elt}S{shape}SL{layout}L"
|
| 168 |
+
|
| 169 |
+
def with_element_ty(self, scalar_ty: dtype) -> block_type:
|
| 170 |
+
return distributed_type(scalar_ty, self.shape, self.layout)
|
| 171 |
+
|
| 172 |
+
def __eq__(self, other) -> bool:
|
| 173 |
+
if not isinstance(other, distributed_type):
|
| 174 |
+
return False
|
| 175 |
+
return super().__eq__(other) and self.layout == other.layout
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
class shared_memory_descriptor_type(base_type):
|
| 179 |
+
|
| 180 |
+
def __init__(self, element_ty, shape, layout, alloc_shape):
|
| 181 |
+
shape = _unwrap_if_constexpr(shape)
|
| 182 |
+
alloc_shape = _unwrap_if_constexpr(alloc_shape)
|
| 183 |
+
layout = _unwrap_if_constexpr(layout)
|
| 184 |
+
self.element_ty = element_ty
|
| 185 |
+
self.shape = shape
|
| 186 |
+
self.layout = layout
|
| 187 |
+
self.alloc_shape = alloc_shape
|
| 188 |
+
assert isinstance(layout, SharedLayout)
|
| 189 |
+
|
| 190 |
+
def to_ir(self, builder: GluonOpBuilder) -> None:
|
| 191 |
+
return builder.get_shared_mem_desc_ty(
|
| 192 |
+
self.element_ty.to_ir(builder),
|
| 193 |
+
self.shape,
|
| 194 |
+
self.layout._to_ir(builder),
|
| 195 |
+
self.alloc_shape,
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
def _unflatten_ir(self, handles: List[ir.Value], cursor: int) -> Tuple[shared_memory_descriptor, int]:
|
| 199 |
+
value = shared_memory_descriptor(handles[cursor], self.element_ty, self.shape, self.layout, self.alloc_shape)
|
| 200 |
+
return value, cursor + 1
|
| 201 |
+
|
| 202 |
+
def _flatten_ir_types(self, builder: GluonOpBuilder, out: List[ir.type]) -> None:
|
| 203 |
+
out.append(self.to_ir(builder))
|
| 204 |
+
|
| 205 |
+
def __str__(self) -> str:
|
| 206 |
+
return f"shared_memory_descriptor<{self.element_ty}, {self.shape}, {self.layout}, {self.alloc_shape}>"
|
| 207 |
+
|
| 208 |
+
def __eq__(self, other) -> bool:
|
| 209 |
+
return (type(self) is type(other) and self.shape == other.shape and self.layout == other.layout
|
| 210 |
+
and self.alloc_shape == other.alloc_shape)
|
| 211 |
+
|
| 212 |
+
def __neq__(self, other) -> bool:
|
| 213 |
+
return not (self == other)
|
| 214 |
+
|
| 215 |
+
def mangle(self) -> str:
|
| 216 |
+
shape_str = "_".join([str(s) for s in self.shape])
|
| 217 |
+
return f"MD{self.element_ty.mangle()}S{shape_str}SL{self.layout.mangle()}LAS{self.alloc_shape}ASMD"
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
class shared_memory_descriptor(base_value):
|
| 221 |
+
"""
|
| 222 |
+
Represents a handle to a shared memory allocation in Gluon IR.
|
| 223 |
+
"""
|
| 224 |
+
|
| 225 |
+
def __init__(self, handle, element_ty, shape, layout, alloc_shape):
|
| 226 |
+
self.handle = handle
|
| 227 |
+
self.type = shared_memory_descriptor_type(element_ty, shape, layout, alloc_shape)
|
| 228 |
+
|
| 229 |
+
def _flatten_ir(self, handles: List[ir.value]) -> None:
|
| 230 |
+
handles.append(self.handle)
|
| 231 |
+
|
| 232 |
+
@property
|
| 233 |
+
def dtype(self):
|
| 234 |
+
return self.type.element_ty
|
| 235 |
+
|
| 236 |
+
@property
|
| 237 |
+
def shape(self):
|
| 238 |
+
return self.type.shape
|
| 239 |
+
|
| 240 |
+
@property
|
| 241 |
+
def rank(self):
|
| 242 |
+
return len(self.shape)
|
| 243 |
+
|
| 244 |
+
@property
|
| 245 |
+
def numel(self) -> int:
|
| 246 |
+
return math.prod(self.shape)
|
| 247 |
+
|
| 248 |
+
@property
|
| 249 |
+
def layout(self):
|
| 250 |
+
return self.type.layout
|
| 251 |
+
|
| 252 |
+
def __str__(self) -> str:
|
| 253 |
+
return str(self.type)
|
| 254 |
+
|
| 255 |
+
@builtin
|
| 256 |
+
def load(self, layout, _semantic: GluonSemantic = None) -> tensor:
|
| 257 |
+
"""
|
| 258 |
+
Load a tensor from shared memory.
|
| 259 |
+
|
| 260 |
+
Args:
|
| 261 |
+
layout (DistributedLayout): The destination layout of the tensor.
|
| 262 |
+
|
| 263 |
+
Returns:
|
| 264 |
+
tensor: A Gluon tensor containing the loaded data.
|
| 265 |
+
"""
|
| 266 |
+
layout = _unwrap_if_constexpr(layout)
|
| 267 |
+
return _semantic.shared_load(self, layout)
|
| 268 |
+
|
| 269 |
+
@builtin
|
| 270 |
+
def store(self, value, _semantic: GluonSemantic = None) -> None:
|
| 271 |
+
"""
|
| 272 |
+
Store a tensor into shared memory.
|
| 273 |
+
|
| 274 |
+
Args:
|
| 275 |
+
value (tensor): The tensor whose contents to store.
|
| 276 |
+
"""
|
| 277 |
+
return _semantic.shared_store(self, value)
|
| 278 |
+
|
| 279 |
+
@builtin
|
| 280 |
+
def slice(self, start, length, dim=0, _semantic: GluonSemantic = None) -> shared_memory_descriptor:
|
| 281 |
+
"""
|
| 282 |
+
Create a subview of shared memory by slicing along a given dimension.
|
| 283 |
+
|
| 284 |
+
Args:
|
| 285 |
+
start (int): The starting index of the slice.
|
| 286 |
+
length (int): The length of the slice.
|
| 287 |
+
dim (int): The dimension to slice (default: 0).
|
| 288 |
+
|
| 289 |
+
Returns:
|
| 290 |
+
shared_memory_descriptor: Descriptor for the sliced subview.
|
| 291 |
+
"""
|
| 292 |
+
start = _unwrap_if_constexpr(start)
|
| 293 |
+
length = _unwrap_if_constexpr(length)
|
| 294 |
+
dim = _unwrap_if_constexpr(dim)
|
| 295 |
+
return _semantic.memdesc_slice(self, start, length, dim)
|
| 296 |
+
|
| 297 |
+
@builtin
|
| 298 |
+
def index(self, index, _semantic: GluonSemantic = None) -> shared_memory_descriptor:
|
| 299 |
+
"""
|
| 300 |
+
Create a subview of shared memory by indexing along the first dimension.
|
| 301 |
+
|
| 302 |
+
Args:
|
| 303 |
+
index (int): The index at which to take the subview.
|
| 304 |
+
|
| 305 |
+
Returns:
|
| 306 |
+
shared_memory_descriptor: Descriptor for the indexed subview.
|
| 307 |
+
"""
|
| 308 |
+
index = _unwrap_if_constexpr(index)
|
| 309 |
+
return _semantic.memdesc_index(self, index)
|
| 310 |
+
|
| 311 |
+
@builtin
|
| 312 |
+
def permute(self, order, _semantic: GluonSemantic = None) -> shared_memory_descriptor:
|
| 313 |
+
"""
|
| 314 |
+
Permute the dimensions of the shared memory descriptor.
|
| 315 |
+
|
| 316 |
+
Args:
|
| 317 |
+
order (List[int]): The new ordering of dimensions.
|
| 318 |
+
|
| 319 |
+
Returns:
|
| 320 |
+
shared_memory_descriptor: Descriptor with permuted dimensions.
|
| 321 |
+
"""
|
| 322 |
+
order = [_unwrap_if_constexpr(o) for o in order]
|
| 323 |
+
return _semantic.memdesc_trans(self, order)
|
| 324 |
+
|
| 325 |
+
@builtin
|
| 326 |
+
def reshape(self, shape, _semantic: GluonSemantic = None) -> shared_memory_descriptor:
|
| 327 |
+
"""
|
| 328 |
+
Reshape the shared memory descriptor to a new shape and layout.
|
| 329 |
+
|
| 330 |
+
Args:
|
| 331 |
+
shape (List[int]): The target shape.
|
| 332 |
+
|
| 333 |
+
Returns:
|
| 334 |
+
shared_memory_descriptor: Descriptor with the new shape and layout.
|
| 335 |
+
"""
|
| 336 |
+
shape = [_unwrap_if_constexpr(s) for s in shape]
|
| 337 |
+
|
| 338 |
+
return _semantic.memdesc_reshape(self, shape)
|
| 339 |
+
|
| 340 |
+
@builtin
|
| 341 |
+
def _reinterpret(self, dtype, shape, layout, _semantic: GluonSemantic = None) -> shared_memory_descriptor:
|
| 342 |
+
"""
|
| 343 |
+
Reinterpret the shared memory descriptor as a different dtype, shape, or layout.
|
| 344 |
+
|
| 345 |
+
Args:
|
| 346 |
+
dtype (dtype): The new data type.
|
| 347 |
+
shape (List[int]): The new shape.
|
| 348 |
+
layout (SharedLayout): The new layout.
|
| 349 |
+
|
| 350 |
+
Returns:
|
| 351 |
+
shared_memory_descriptor: Descriptor with updated type and layout.
|
| 352 |
+
"""
|
| 353 |
+
dtype = _unwrap_if_constexpr(dtype)
|
| 354 |
+
shape = [_unwrap_if_constexpr(s) for s in shape]
|
| 355 |
+
layout = _unwrap_if_constexpr(layout)
|
| 356 |
+
|
| 357 |
+
return _semantic.memdesc_reinterpret(self, dtype, shape, layout)
|
| 358 |
+
|
| 359 |
+
@builtin
|
| 360 |
+
def _keep_alive(self, _semantic: GluonSemantic = None) -> None:
|
| 361 |
+
"""
|
| 362 |
+
Dummy use to keep the shared memory descriptor alive.
|
| 363 |
+
"""
|
| 364 |
+
return _semantic.shared_dealloc(self)
|
| 365 |
+
|
| 366 |
+
|
| 367 |
+
@builtin
|
| 368 |
+
def arange(start, end, layout=None, _semantic=None):
|
| 369 |
+
"""
|
| 370 |
+
Generate a sequence tensor with values in [start, end) using a specified layout.
|
| 371 |
+
|
| 372 |
+
Args:
|
| 373 |
+
start (int): Inclusive start of the sequence.
|
| 374 |
+
end (int): Exclusive end of the sequence.
|
| 375 |
+
layout (DistributedLayout): The layout of the output tensor. Defaults to AutoLayout.
|
| 376 |
+
|
| 377 |
+
Returns:
|
| 378 |
+
tensor: A 1D tensor containing sequential values.
|
| 379 |
+
"""
|
| 380 |
+
start = _unwrap_if_constexpr(start)
|
| 381 |
+
end = _unwrap_if_constexpr(end)
|
| 382 |
+
layout = _unwrap_if_constexpr(layout)
|
| 383 |
+
return _semantic.arange(start, end, layout)
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
@builtin
|
| 387 |
+
def convert_layout(value, layout, assert_trivial=False, _semantic=None):
|
| 388 |
+
"""
|
| 389 |
+
Convert a tensor to a different distributed layout.
|
| 390 |
+
|
| 391 |
+
Args:
|
| 392 |
+
value (tensor): The input tensor.
|
| 393 |
+
layout (DistributedLayout): The target layout.
|
| 394 |
+
assert_trivial (bool): If True, asserts that the conversion is trivial (no data movement).
|
| 395 |
+
|
| 396 |
+
Returns:
|
| 397 |
+
tensor: The tensor with the new layout.
|
| 398 |
+
"""
|
| 399 |
+
layout = _unwrap_if_constexpr(layout)
|
| 400 |
+
return _semantic.convert_layout(value, layout, assert_trivial)
|
| 401 |
+
|
| 402 |
+
|
| 403 |
+
@builtin
|
| 404 |
+
def full(shape, value, dtype, layout=None, _semantic=None):
|
| 405 |
+
"""
|
| 406 |
+
Create a tensor filled with a scalar value, with specified shape, dtype, and layout.
|
| 407 |
+
|
| 408 |
+
Args:
|
| 409 |
+
shape (Sequence[int]): The shape of the tensor.
|
| 410 |
+
value (int or float): The fill value.
|
| 411 |
+
dtype (dtype): The data type for the tensor.
|
| 412 |
+
layout (Optional[DistributedLayout]): The layout of the output tensor, defaults to AutoLayout().
|
| 413 |
+
|
| 414 |
+
Returns:
|
| 415 |
+
tensor: A tensor where every element equals value.
|
| 416 |
+
"""
|
| 417 |
+
shape = _unwrap_shape(shape)
|
| 418 |
+
value = _unwrap_if_constexpr(value)
|
| 419 |
+
dtype = _unwrap_if_constexpr(dtype)
|
| 420 |
+
layout = _unwrap_if_constexpr(layout)
|
| 421 |
+
return _semantic.full(shape, value, dtype, layout)
|
| 422 |
+
|
| 423 |
+
|
| 424 |
+
@builtin
|
| 425 |
+
def histogram(input, num_bins, mask=None, layout=None, _semantic=None, _generator=None):
|
| 426 |
+
"""
|
| 427 |
+
Compute a histogram of a 1D integer tensor.
|
| 428 |
+
|
| 429 |
+
Args:
|
| 430 |
+
input (tensor): 1D tensor of integer values.
|
| 431 |
+
num_bins (int): Number of bins. Bins have width 1 and start at 0.
|
| 432 |
+
mask (Optional[tensor]): Boolean mask to exclude elements when False.
|
| 433 |
+
layout (DistributedLayout): Destination layout of the output histogram.
|
| 434 |
+
|
| 435 |
+
Returns:
|
| 436 |
+
tensor: 1D int32 tensor of length `num_bins` with the requested layout.
|
| 437 |
+
"""
|
| 438 |
+
num_bins = _unwrap_if_constexpr(num_bins)
|
| 439 |
+
layout = _unwrap_if_constexpr(layout)
|
| 440 |
+
if mask is not None:
|
| 441 |
+
mask = _semantic.to_tensor(mask)
|
| 442 |
+
return _semantic.histogram(input, num_bins, mask, layout)
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
@builtin
|
| 446 |
+
def allocate_shared_memory(element_ty, shape, layout, value=None, _semantic=None) -> shared_memory_descriptor:
|
| 447 |
+
"""
|
| 448 |
+
Allocate shared memory for a tensor with the given element type, shape, and layout.
|
| 449 |
+
|
| 450 |
+
Args:
|
| 451 |
+
element_ty (dtype): The element data type.
|
| 452 |
+
shape (Sequence[int]): The dimensions of the shared memory.
|
| 453 |
+
layout (SharedLayout): The shared memory layout.
|
| 454 |
+
value (tensor, optional): Initial value to copy into shared memory.
|
| 455 |
+
|
| 456 |
+
Returns:
|
| 457 |
+
shared_memory_descriptor: Descriptor for the allocated memory.
|
| 458 |
+
"""
|
| 459 |
+
element_ty = _unwrap_if_constexpr(element_ty)
|
| 460 |
+
shape = _unwrap_if_constexpr(shape)
|
| 461 |
+
shape = [_unwrap_if_constexpr(s) for s in shape]
|
| 462 |
+
layout = _unwrap_if_constexpr(layout)
|
| 463 |
+
return _semantic.allocate_shared(element_ty, shape, layout, value)
|
| 464 |
+
|
| 465 |
+
|
| 466 |
+
@builtin
|
| 467 |
+
def set_auto_layout(value, layout, _semantic=None):
|
| 468 |
+
"""
|
| 469 |
+
Set a tensor with AutoLayout to a concrete layout
|
| 470 |
+
|
| 471 |
+
Args:
|
| 472 |
+
value (tensor): The input tensor.
|
| 473 |
+
layout (DistribtedLayout): The target layout.
|
| 474 |
+
|
| 475 |
+
Returns:
|
| 476 |
+
tensor: The tensor with the new layout.
|
| 477 |
+
"""
|
| 478 |
+
layout = _unwrap_if_constexpr(layout)
|
| 479 |
+
return _semantic.set_auto_layout(value, layout)
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
@builtin
|
| 483 |
+
def fp4_to_fp(src, elem_type, axis, _semantic=None):
|
| 484 |
+
"""
|
| 485 |
+
Upcast a tensor from fp4 (e2m1) to another floating point type.
|
| 486 |
+
"""
|
| 487 |
+
axis = _unwrap_if_constexpr(axis)
|
| 488 |
+
elem_type = _unwrap_if_constexpr(elem_type)
|
| 489 |
+
return _semantic.fp4_to_fp(src, elem_type, axis)
|
| 490 |
+
|
| 491 |
+
|
| 492 |
+
@builtin
|
| 493 |
+
def warp_specialize(functions_and_args, worker_num_warps, worker_num_regs, _semantic=None, _generator=None):
|
| 494 |
+
"""
|
| 495 |
+
Create a warp-specialized execution region, partitioning work across warps.
|
| 496 |
+
|
| 497 |
+
This forks the current execution into a "default partition" and an arbitrary number of
|
| 498 |
+
"worker partitons". The default partition is executed in the same :code:`num_warps` warps as
|
| 499 |
+
the parent region, and may accept tensor arguments and return tensors. Worker partitions are
|
| 500 |
+
executed in additional warps, which sit idle while executing the parent region.
|
| 501 |
+
|
| 502 |
+
Note that calling warp_specialize recursively is not supported.
|
| 503 |
+
|
| 504 |
+
Args:
|
| 505 |
+
functions_and_args (List[Tuple[Callable, Any]]): List of functions and arguments for each partition. The first of which is the default partition.
|
| 506 |
+
worker_num_warps (List[int]): Number of warps used for each worker partition.
|
| 507 |
+
worker_num_regs (List[int]): Number of registers for each worker partition.
|
| 508 |
+
|
| 509 |
+
Returns:
|
| 510 |
+
Tuple[Any, ...]: Results from the default partition.
|
| 511 |
+
"""
|
| 512 |
+
worker_num_warps = [_unwrap_if_constexpr(w) for w in worker_num_warps]
|
| 513 |
+
worker_num_regs = [_unwrap_if_constexpr(r) for r in worker_num_regs]
|
| 514 |
+
return _semantic.warp_specialize(functions_and_args, worker_num_warps, worker_num_regs, _generator)
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
@builtin
|
| 518 |
+
def num_warps(_semantic=None, _generator=None):
|
| 519 |
+
"""
|
| 520 |
+
Returns the number of warps that execute the current context, including in warp-specialized regions.
|
| 521 |
+
"""
|
| 522 |
+
return _semantic.num_warps(_generator)
|
| 523 |
+
|
| 524 |
+
|
| 525 |
+
@builtin
|
| 526 |
+
def num_ctas(_semantic=None):
|
| 527 |
+
"""
|
| 528 |
+
Returns the number of CTAs in the current kernel
|
| 529 |
+
"""
|
| 530 |
+
return _semantic.num_ctas()
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
@builtin
|
| 534 |
+
def thread_barrier(_semantic=None):
|
| 535 |
+
"""
|
| 536 |
+
Insert a barrier to synchronize threads within a CTA.
|
| 537 |
+
"""
|
| 538 |
+
return _semantic.debug_barrier()
|
| 539 |
+
|
| 540 |
+
|
| 541 |
+
@builtin
|
| 542 |
+
def bank_conflicts(distr_ty, shared_ty, _semantic=None) -> int:
|
| 543 |
+
"""
|
| 544 |
+
Count the bank conflicts per wavefront of each instruction generated when
|
| 545 |
+
reading/writing the distributed tensor from/to the shared memory descriptor
|
| 546 |
+
using ld.shared/st.shared instructions.
|
| 547 |
+
|
| 548 |
+
We define a bank conflict of N to be the excess number of memory accesses that each
|
| 549 |
+
wavefront needs to access the shared memory descriptor. When one uses no ld/st
|
| 550 |
+
vectorization, this is equal to t he number of excess memory accesses per instruction.
|
| 551 |
+
|
| 552 |
+
Args:
|
| 553 |
+
distr_ty (distributed_type): The distributed tensor.
|
| 554 |
+
shared_ty (shared_memory_descriptor_type): The shared memory descriptor.
|
| 555 |
+
|
| 556 |
+
Returns:
|
| 557 |
+
int: The number of bank conflicts.
|
| 558 |
+
"""
|
| 559 |
+
distr_ty = _unwrap_if_constexpr(distr_ty)
|
| 560 |
+
shared_ty = _unwrap_if_constexpr(shared_ty)
|
| 561 |
+
return _semantic.bank_conflicts(distr_ty, shared_ty)
|
| 562 |
+
|
| 563 |
+
|
| 564 |
+
@builtin
|
| 565 |
+
def to_linear_layout(layout, shape, _semantic=None):
|
| 566 |
+
layout = _unwrap_if_constexpr(layout)
|
| 567 |
+
shape = _unwrap_shape(shape)
|
| 568 |
+
return _semantic.to_linear_layout(layout, shape)
|
| 569 |
+
|
| 570 |
+
|
| 571 |
+
@builtin
|
| 572 |
+
def dot_fma(a, b, acc, _semantic=None):
|
| 573 |
+
assert isinstance(a, tensor), "a must be a tensor"
|
| 574 |
+
assert isinstance(b, tensor), "b must be a tensor"
|
| 575 |
+
assert isinstance(acc, tensor), "acc must be a tensor"
|
| 576 |
+
|
| 577 |
+
mma_layout = acc.type.layout
|
| 578 |
+
assert isinstance(mma_layout, BlockedLayout), "acc must have a BlockedLayout"
|
| 579 |
+
assert isinstance(a.type.layout, DotOperandLayout), "a must have a DotOperandLayout"
|
| 580 |
+
assert isinstance(b.type.layout, DotOperandLayout), "b must have a DotOperandLayout"
|
| 581 |
+
assert a.type.layout.parent == mma_layout, "a's parent layout must be the same as acc's layout"
|
| 582 |
+
assert b.type.layout.parent == mma_layout, "b's parent layout must be the same as acc's layout"
|
| 583 |
+
assert a.type.layout.operand_index == 0, "a's operand index must be 0"
|
| 584 |
+
assert b.type.layout.operand_index == 1, "b's operand index must be 1"
|
| 585 |
+
|
| 586 |
+
M, N = acc.shape
|
| 587 |
+
K = a.shape[1]
|
| 588 |
+
if M * N * K > 2**19:
|
| 589 |
+
warnings.warn(f"Large dot FMA instruction size {M}x{N}x{K} may have slow compile times")
|
| 590 |
+
|
| 591 |
+
handle = _semantic.dot(a, b, acc, input_precision=None, max_num_imprecise_acc=None, out_dtype=acc.dtype).handle
|
| 592 |
+
return tensor(handle, acc.type)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_layouts.py
ADDED
|
@@ -0,0 +1,676 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from dataclasses import dataclass, field
|
| 2 |
+
from typing import List
|
| 3 |
+
|
| 4 |
+
from triton.language.core import _unwrap_if_constexpr, _unwrap_shape, constexpr_type
|
| 5 |
+
from triton.runtime.jit import constexpr_function
|
| 6 |
+
import math
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class DistributedLayout:
|
| 10 |
+
"""
|
| 11 |
+
Base class for distributed memory layouts in Gluon IR.
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
@property
|
| 15 |
+
def type(self):
|
| 16 |
+
return constexpr_type(self)
|
| 17 |
+
|
| 18 |
+
@property
|
| 19 |
+
def rank(self):
|
| 20 |
+
raise NotImplementedError("DistributedLayout subclasses must define rank")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
@dataclass(frozen=True)
|
| 24 |
+
class AutoLayout(DistributedLayout):
|
| 25 |
+
|
| 26 |
+
def _to_ir(self, builder):
|
| 27 |
+
return builder.get_auto_layout()
|
| 28 |
+
|
| 29 |
+
def mangle(self):
|
| 30 |
+
return "AL"
|
| 31 |
+
|
| 32 |
+
@property
|
| 33 |
+
def rank(self):
|
| 34 |
+
raise ValueError("AutoLayout has no rank")
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
@dataclass(frozen=True)
|
| 38 |
+
class CoalescedLayout(DistributedLayout):
|
| 39 |
+
|
| 40 |
+
def _to_ir(self, builder):
|
| 41 |
+
return builder.get_coalesced_layout()
|
| 42 |
+
|
| 43 |
+
def mangle(self):
|
| 44 |
+
return "CL"
|
| 45 |
+
|
| 46 |
+
@property
|
| 47 |
+
def rank(self):
|
| 48 |
+
raise ValueError("CoalescedLayout has no rank")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
@dataclass(frozen=True)
|
| 52 |
+
class BlockedLayout(DistributedLayout):
|
| 53 |
+
"""
|
| 54 |
+
Represents a blocked layout, partitioning a tensor across threads, warps, and CTAs.
|
| 55 |
+
|
| 56 |
+
Args:
|
| 57 |
+
size_per_thread (List[int]): Number of elements per thread per dimension.
|
| 58 |
+
threads_per_warp (List[int]): Number of threads per warp per dimension.
|
| 59 |
+
warps_per_cta (List[int]): Number of warps per CTA per dimension.
|
| 60 |
+
order (List[int]): The ordering of dimensions for partitioning.
|
| 61 |
+
cga_layout (Optional[List[List[int]]]): Bases describing how CTAs tile each dimension.
|
| 62 |
+
"""
|
| 63 |
+
size_per_thread: List[int]
|
| 64 |
+
threads_per_warp: List[int]
|
| 65 |
+
warps_per_cta: List[int]
|
| 66 |
+
order: List[int]
|
| 67 |
+
cga_layout: List[List[int]] = field(default_factory=list)
|
| 68 |
+
|
| 69 |
+
def __post_init__(self):
|
| 70 |
+
super().__setattr__("size_per_thread", _unwrap_if_constexpr(self.size_per_thread))
|
| 71 |
+
super().__setattr__("threads_per_warp", _unwrap_if_constexpr(self.threads_per_warp))
|
| 72 |
+
super().__setattr__("warps_per_cta", _unwrap_if_constexpr(self.warps_per_cta))
|
| 73 |
+
super().__setattr__("order", _unwrap_if_constexpr(self.order))
|
| 74 |
+
|
| 75 |
+
rank = len(self.size_per_thread)
|
| 76 |
+
object.__setattr__(self, "cga_layout", self.cga_layout)
|
| 77 |
+
assert len(self.threads_per_warp) == rank
|
| 78 |
+
assert len(self.warps_per_cta) == rank
|
| 79 |
+
assert len(self.order) == rank
|
| 80 |
+
|
| 81 |
+
def _to_ir(self, builder):
|
| 82 |
+
return builder.get_blocked_layout(
|
| 83 |
+
self.size_per_thread,
|
| 84 |
+
self.threads_per_warp,
|
| 85 |
+
self.warps_per_cta,
|
| 86 |
+
self.order,
|
| 87 |
+
self.cga_layout,
|
| 88 |
+
)
|
| 89 |
+
|
| 90 |
+
def mangle(self) -> str:
|
| 91 |
+
|
| 92 |
+
def stringify(x):
|
| 93 |
+
if x is None:
|
| 94 |
+
return ""
|
| 95 |
+
return "_".join(map(str, x))
|
| 96 |
+
|
| 97 |
+
size_per_thread = stringify(self.size_per_thread)
|
| 98 |
+
threads_per_warp = stringify(self.threads_per_warp)
|
| 99 |
+
warps_per_cta = stringify(self.warps_per_cta)
|
| 100 |
+
order = stringify(self.order)
|
| 101 |
+
cga_layout = "_".join("~".join(map(str, vec)) for vec in self.cga_layout) if self.cga_layout else ""
|
| 102 |
+
return f"B{size_per_thread}_{threads_per_warp}_{warps_per_cta}_{order}_{cga_layout}B"
|
| 103 |
+
|
| 104 |
+
def __hash__(self):
|
| 105 |
+
return hash((tuple(self.size_per_thread), tuple(self.threads_per_warp), tuple(self.warps_per_cta),
|
| 106 |
+
tuple(self.order), tuple(tuple(vec) for vec in self.cga_layout)))
|
| 107 |
+
|
| 108 |
+
@property
|
| 109 |
+
def rank(self):
|
| 110 |
+
return len(self.order)
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
@dataclass(frozen=True)
|
| 114 |
+
class SliceLayout(DistributedLayout):
|
| 115 |
+
"""
|
| 116 |
+
Represents a layout corresponding to slicing a distributed tensor along one dimension.
|
| 117 |
+
|
| 118 |
+
Args:
|
| 119 |
+
dim (int): The dimension index to slice.
|
| 120 |
+
parent (DistributedLayout): The parent layout before slicing.
|
| 121 |
+
"""
|
| 122 |
+
dim: int
|
| 123 |
+
parent: DistributedLayout
|
| 124 |
+
|
| 125 |
+
def __post_init__(self):
|
| 126 |
+
super().__setattr__("dim", _unwrap_if_constexpr(self.dim))
|
| 127 |
+
super().__setattr__("parent", _unwrap_if_constexpr(self.parent))
|
| 128 |
+
|
| 129 |
+
def _to_ir(self, builder):
|
| 130 |
+
return builder.get_slice_layout(
|
| 131 |
+
self.dim,
|
| 132 |
+
self.parent._to_ir(builder),
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
def mangle(self) -> str:
|
| 136 |
+
return f"SL{self.dim}_{self.parent.mangle()}SL"
|
| 137 |
+
|
| 138 |
+
def __hash__(self):
|
| 139 |
+
return hash((self.dim, self.parent))
|
| 140 |
+
|
| 141 |
+
@property
|
| 142 |
+
def rank(self):
|
| 143 |
+
return self.parent.rank - 1
|
| 144 |
+
|
| 145 |
+
@property
|
| 146 |
+
def cga_layout(self):
|
| 147 |
+
parent_cga_layout = self.parent.cga_layout
|
| 148 |
+
if not parent_cga_layout:
|
| 149 |
+
return []
|
| 150 |
+
|
| 151 |
+
rank = self.parent.rank
|
| 152 |
+
assert 0 <= self.dim < rank
|
| 153 |
+
return [basis[:self.dim] + basis[self.dim + 1:] for basis in parent_cga_layout]
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
@dataclass(frozen=True)
|
| 157 |
+
class DistributedLinearLayout(DistributedLayout):
|
| 158 |
+
"""
|
| 159 |
+
Represents a linear distributed layout with explicit bases at register, lane, warp, and block levels.
|
| 160 |
+
See: https://arxiv.org/abs/2505.23819 for reference.
|
| 161 |
+
|
| 162 |
+
Args:
|
| 163 |
+
reg_bases (List[List[int]]): Bases for register-level distribution.
|
| 164 |
+
lane_bases (List[List[int]]): Bases for lane-level distribution.
|
| 165 |
+
warp_bases (List[List[int]]): Bases for warp-level distribution.
|
| 166 |
+
block_bases (List[List[int]]): Bases for block-level distribution.
|
| 167 |
+
shape (List[int]): The tensor global shape.
|
| 168 |
+
"""
|
| 169 |
+
reg_bases: List[List[int]]
|
| 170 |
+
lane_bases: List[List[int]]
|
| 171 |
+
warp_bases: List[List[int]]
|
| 172 |
+
block_bases: List[List[int]]
|
| 173 |
+
shape: List[int]
|
| 174 |
+
|
| 175 |
+
def __post_init__(self):
|
| 176 |
+
super().__setattr__("reg_bases", _unwrap_shape(self.reg_bases))
|
| 177 |
+
super().__setattr__("lane_bases", _unwrap_shape(self.lane_bases))
|
| 178 |
+
super().__setattr__("warp_bases", _unwrap_shape(self.warp_bases))
|
| 179 |
+
super().__setattr__("block_bases", _unwrap_shape(self.block_bases))
|
| 180 |
+
super().__setattr__("shape", _unwrap_shape(self.shape))
|
| 181 |
+
|
| 182 |
+
rank = len(self.shape)
|
| 183 |
+
|
| 184 |
+
for basis in self.reg_bases:
|
| 185 |
+
assert len(basis) == rank
|
| 186 |
+
for basis in self.lane_bases:
|
| 187 |
+
assert len(basis) == rank
|
| 188 |
+
for basis in self.warp_bases:
|
| 189 |
+
assert len(basis) == rank
|
| 190 |
+
for basis in self.block_bases:
|
| 191 |
+
assert len(basis) == rank
|
| 192 |
+
|
| 193 |
+
def _to_ir(self, builder):
|
| 194 |
+
return builder.get_distributed_linear_layout(self.reg_bases, self.lane_bases, self.warp_bases, self.block_bases,
|
| 195 |
+
self.shape)
|
| 196 |
+
|
| 197 |
+
def mangle(self):
|
| 198 |
+
return f"DLL{self.reg_bases}_{self.lane_bases}_{self.warp_bases}_{self.block_bases}_{self.shape}DLL"
|
| 199 |
+
|
| 200 |
+
def __hash__(self):
|
| 201 |
+
return hash((
|
| 202 |
+
tuple(map(tuple, self.reg_bases)),
|
| 203 |
+
tuple(map(tuple, self.lane_bases)),
|
| 204 |
+
tuple(map(tuple, self.warp_bases)),
|
| 205 |
+
tuple(map(tuple, self.block_bases)),
|
| 206 |
+
tuple(self.shape),
|
| 207 |
+
))
|
| 208 |
+
|
| 209 |
+
@property
|
| 210 |
+
def rank(self):
|
| 211 |
+
return len(self.shape)
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
@dataclass(frozen=True)
|
| 215 |
+
class DotOperandLayout(DistributedLayout):
|
| 216 |
+
"""
|
| 217 |
+
Represents a layout for a dot operand.
|
| 218 |
+
|
| 219 |
+
Args:
|
| 220 |
+
operand_index (int): 0 for LHS and 1 for RHS of the dot operation.
|
| 221 |
+
parent (DistributedLayout): The parent layout, representing the MMA.
|
| 222 |
+
k_width (int): Number of elements per 32-bits.
|
| 223 |
+
"""
|
| 224 |
+
operand_index: int
|
| 225 |
+
parent: DistributedLayout
|
| 226 |
+
k_width: int
|
| 227 |
+
|
| 228 |
+
def __post_init__(self):
|
| 229 |
+
super().__setattr__("operand_index", _unwrap_if_constexpr(self.operand_index))
|
| 230 |
+
super().__setattr__("parent", _unwrap_if_constexpr(self.parent))
|
| 231 |
+
super().__setattr__("k_width", _unwrap_if_constexpr(self.k_width))
|
| 232 |
+
|
| 233 |
+
def _to_ir(self, builder):
|
| 234 |
+
return builder.get_dot_operand_layout(self.operand_index, self.parent._to_ir(builder), self.k_width)
|
| 235 |
+
|
| 236 |
+
def mangle(self) -> str:
|
| 237 |
+
return f"DO{self.operand_index}_{self.parent.mangle()}_{self.k_width}DO"
|
| 238 |
+
|
| 239 |
+
def __hash__(self):
|
| 240 |
+
return hash((self.operand_index, self.parent, self.k_width))
|
| 241 |
+
|
| 242 |
+
@property
|
| 243 |
+
def rank(self):
|
| 244 |
+
return self.parent.rank
|
| 245 |
+
|
| 246 |
+
@property
|
| 247 |
+
def cga_layout(self):
|
| 248 |
+
parent_cga_layout = _unwrap_if_constexpr(getattr(self.parent, "cga_layout", [])) or []
|
| 249 |
+
if not parent_cga_layout:
|
| 250 |
+
return []
|
| 251 |
+
|
| 252 |
+
rank = self.parent.rank
|
| 253 |
+
assert all(len(basis) == rank for basis in parent_cga_layout)
|
| 254 |
+
|
| 255 |
+
k_dim = rank - 1 if self.operand_index == 0 else rank - 2
|
| 256 |
+
assert 0 <= k_dim < rank
|
| 257 |
+
|
| 258 |
+
derived = []
|
| 259 |
+
for basis in parent_cga_layout:
|
| 260 |
+
new_basis = list(basis)
|
| 261 |
+
new_basis[k_dim] = 0
|
| 262 |
+
derived.append(new_basis)
|
| 263 |
+
return derived
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
@dataclass(frozen=True, eq=True)
|
| 267 |
+
class NVMMADistributedLayout(DistributedLayout):
|
| 268 |
+
"""
|
| 269 |
+
Represents a layout for NVIDIA MMA (tensor core) operations.
|
| 270 |
+
|
| 271 |
+
Args:
|
| 272 |
+
version (List[int]): Version identifier for the MMA instruction.
|
| 273 |
+
warps_per_cta (List[int]): Number of warps per CTA.
|
| 274 |
+
instr_shape (List[int]): Instruction shape for MMA.
|
| 275 |
+
cga_layout (Optional[List[List[int]]]): Bases describing CTA tiling.
|
| 276 |
+
"""
|
| 277 |
+
version: List[int]
|
| 278 |
+
warps_per_cta: List[int]
|
| 279 |
+
instr_shape: List[int]
|
| 280 |
+
cga_layout: List[List[int]] = field(default_factory=list)
|
| 281 |
+
|
| 282 |
+
def __post_init__(self):
|
| 283 |
+
super().__setattr__("version", _unwrap_if_constexpr(self.version))
|
| 284 |
+
super().__setattr__("warps_per_cta", _unwrap_if_constexpr(self.warps_per_cta))
|
| 285 |
+
super().__setattr__("instr_shape", _unwrap_if_constexpr(self.instr_shape))
|
| 286 |
+
|
| 287 |
+
object.__setattr__(self, "cga_layout", self.cga_layout)
|
| 288 |
+
|
| 289 |
+
def _to_ir(self, builder):
|
| 290 |
+
return builder.get_mma_layout(
|
| 291 |
+
self.version,
|
| 292 |
+
self.warps_per_cta,
|
| 293 |
+
self.cga_layout,
|
| 294 |
+
self.instr_shape,
|
| 295 |
+
)
|
| 296 |
+
|
| 297 |
+
def mangle(self) -> str:
|
| 298 |
+
cga_layout = "_".join("~".join(map(str, vec)) for vec in self.cga_layout) if self.cga_layout else ""
|
| 299 |
+
return f"MMA_{self.version}_{self.warps_per_cta}_{self.instr_shape}_{cga_layout}_MMA"
|
| 300 |
+
|
| 301 |
+
def __hash__(self):
|
| 302 |
+
return hash((tuple(self.version), tuple(self.warps_per_cta), tuple(self.instr_shape),
|
| 303 |
+
tuple(tuple(vec) for vec in self.cga_layout)))
|
| 304 |
+
|
| 305 |
+
@property
|
| 306 |
+
def rank(self):
|
| 307 |
+
return len(self.warps_per_cta)
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
class SharedLayout:
|
| 311 |
+
"""
|
| 312 |
+
Base class for shared memory layouts in Gluon IR.
|
| 313 |
+
"""
|
| 314 |
+
|
| 315 |
+
@property
|
| 316 |
+
def type(self):
|
| 317 |
+
return constexpr_type(self)
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
@constexpr_function
|
| 321 |
+
def _get_shape_per_cta(shape, cga_layout):
|
| 322 |
+
if not cga_layout:
|
| 323 |
+
return shape
|
| 324 |
+
shape_per_cta = list(shape)
|
| 325 |
+
rank = len(cga_layout[0])
|
| 326 |
+
cga_shape = [1] * rank
|
| 327 |
+
for basis in cga_layout:
|
| 328 |
+
assert len(basis) == rank
|
| 329 |
+
for i in range(rank):
|
| 330 |
+
cga_shape[i] = max(cga_shape[i], basis[i])
|
| 331 |
+
# The shape is the largest stride * 2
|
| 332 |
+
for i in range(rank):
|
| 333 |
+
cga_shape[i] *= 2
|
| 334 |
+
for dim in range(rank):
|
| 335 |
+
assert shape_per_cta[dim] % cga_shape[dim] == 0, f"Shape {shape} is not divisible by CGA layout {cga_layout}"
|
| 336 |
+
shape_per_cta[dim] //= cga_shape[dim]
|
| 337 |
+
return shape_per_cta
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
@dataclass(frozen=True)
|
| 341 |
+
class NVMMASharedLayout(SharedLayout):
|
| 342 |
+
"""
|
| 343 |
+
Represents a layout for shared memory suitable for NVIDIA MMA operations.
|
| 344 |
+
|
| 345 |
+
Args:
|
| 346 |
+
swizzle_byte_width (int): Width in bytes for swizzling.
|
| 347 |
+
element_bitwidth (int): Bitwidth of element type.
|
| 348 |
+
rank (int): Rank of the tensor.
|
| 349 |
+
transposed (bool): Whether the layout is transposed.
|
| 350 |
+
fp4_padded (bool): Whether FP4 padding is used.
|
| 351 |
+
cga_layout (Optional[List[List[int]]]): Bases describing CTA tiling.
|
| 352 |
+
"""
|
| 353 |
+
swizzle_byte_width: int
|
| 354 |
+
element_bitwidth: int
|
| 355 |
+
rank: int = 2
|
| 356 |
+
transposed: bool = False
|
| 357 |
+
fp4_padded: bool = False
|
| 358 |
+
cga_layout: List[List[int]] = field(default_factory=list)
|
| 359 |
+
|
| 360 |
+
def __post_init__(self):
|
| 361 |
+
super().__setattr__("swizzle_byte_width", _unwrap_if_constexpr(self.swizzle_byte_width))
|
| 362 |
+
super().__setattr__("element_bitwidth", _unwrap_if_constexpr(self.element_bitwidth))
|
| 363 |
+
super().__setattr__("transposed", _unwrap_if_constexpr(self.transposed))
|
| 364 |
+
super().__setattr__("fp4_padded", _unwrap_if_constexpr(self.fp4_padded))
|
| 365 |
+
|
| 366 |
+
# TODO: Make rank optional and check that (rank or cga_layout)
|
| 367 |
+
cga_layout = self.cga_layout or []
|
| 368 |
+
if cga_layout:
|
| 369 |
+
assert len(cga_layout[0]) == self.rank
|
| 370 |
+
|
| 371 |
+
super().__setattr__("rank", _unwrap_if_constexpr(self.rank))
|
| 372 |
+
super().__setattr__("cga_layout", _unwrap_if_constexpr(cga_layout))
|
| 373 |
+
|
| 374 |
+
assert self.element_bitwidth in [8, 16, 32, 64]
|
| 375 |
+
assert self.swizzle_byte_width in [0, 32, 64, 128]
|
| 376 |
+
|
| 377 |
+
def _to_ir(self, builder):
|
| 378 |
+
return builder.get_nvmma_shared_layout(
|
| 379 |
+
self.swizzle_byte_width,
|
| 380 |
+
self.element_bitwidth,
|
| 381 |
+
self.transposed,
|
| 382 |
+
self.fp4_padded,
|
| 383 |
+
self.cga_layout,
|
| 384 |
+
self.rank,
|
| 385 |
+
)
|
| 386 |
+
|
| 387 |
+
@staticmethod
|
| 388 |
+
@constexpr_function
|
| 389 |
+
def get_default_for(block_shape, dtype, transposed=False, fp4_padded=False, cga_layout=None):
|
| 390 |
+
"""Returns an NVMMASharedLayout with default swizzling for a given shape.
|
| 391 |
+
|
| 392 |
+
This picks the largest swizzle pattern compatible with the shape, which
|
| 393 |
+
allows emitting the fewest TMA or MMA messages.
|
| 394 |
+
"""
|
| 395 |
+
packing_factor = 2 if fp4_padded else 1
|
| 396 |
+
shape_per_cta = block_shape if cga_layout is None else _get_shape_per_cta(block_shape, cga_layout)
|
| 397 |
+
rank = len(block_shape)
|
| 398 |
+
if transposed:
|
| 399 |
+
shape_per_cta = shape_per_cta[1:] + shape_per_cta[:1]
|
| 400 |
+
contig_dim_size = shape_per_cta[-1] * packing_factor
|
| 401 |
+
contig_dim_bytes = contig_dim_size * dtype.primitive_bitwidth // 8
|
| 402 |
+
if contig_dim_bytes >= 128 and contig_dim_bytes % 128 == 0:
|
| 403 |
+
swizzle_byte_width = 128
|
| 404 |
+
elif contig_dim_bytes >= 64 and contig_dim_bytes % 64 == 0:
|
| 405 |
+
swizzle_byte_width = 64
|
| 406 |
+
elif contig_dim_bytes >= 32 and contig_dim_bytes % 32 == 0:
|
| 407 |
+
swizzle_byte_width = 32
|
| 408 |
+
else:
|
| 409 |
+
swizzle_byte_width = 0
|
| 410 |
+
|
| 411 |
+
flatten_outer_dim = 1
|
| 412 |
+
for size in shape_per_cta[:-1]:
|
| 413 |
+
flatten_outer_dim *= size
|
| 414 |
+
if len(block_shape) < 2 or flatten_outer_dim < 8:
|
| 415 |
+
swizzle_byte_width = 0
|
| 416 |
+
|
| 417 |
+
return NVMMASharedLayout(
|
| 418 |
+
swizzle_byte_width=swizzle_byte_width,
|
| 419 |
+
element_bitwidth=dtype.primitive_bitwidth,
|
| 420 |
+
rank=rank,
|
| 421 |
+
transposed=transposed,
|
| 422 |
+
fp4_padded=fp4_padded,
|
| 423 |
+
cga_layout=cga_layout,
|
| 424 |
+
)
|
| 425 |
+
|
| 426 |
+
def mangle(self) -> str:
|
| 427 |
+
cga_layout = "_".join("~".join(map(str, vec)) for vec in self.cga_layout) if self.cga_layout else ""
|
| 428 |
+
return f"NVMMA_{self.swizzle_byte_width}_{self.element_bitwidth}_{self.transposed}_{self.fp4_padded}_{cga_layout}_NVMMA"
|
| 429 |
+
|
| 430 |
+
def __hash__(self):
|
| 431 |
+
return hash((self.swizzle_byte_width, self.element_bitwidth, self.rank, self.transposed, self.fp4_padded,
|
| 432 |
+
tuple(tuple(vec) for vec in self.cga_layout) if self.cga_layout else None))
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
@dataclass(frozen=True, eq=True)
|
| 436 |
+
class SwizzledSharedLayout(SharedLayout):
|
| 437 |
+
"""
|
| 438 |
+
Represents a generic swizzled shared memory layout.
|
| 439 |
+
|
| 440 |
+
Args:
|
| 441 |
+
vec (int): Vector width for swizzling.
|
| 442 |
+
per_phase (int): Elements per swizzle phase.
|
| 443 |
+
max_phase (int): Maximum number of swizzle phases.
|
| 444 |
+
order (List[int]): Dimension ordering for swizzling.
|
| 445 |
+
cga_layout (Optional[List[List[int]]]): Bases describing CTA tiling.
|
| 446 |
+
"""
|
| 447 |
+
vec: int
|
| 448 |
+
per_phase: int
|
| 449 |
+
max_phase: int
|
| 450 |
+
order: List[int]
|
| 451 |
+
cga_layout: List[List[int]] = field(default_factory=list)
|
| 452 |
+
|
| 453 |
+
def __post_init__(self):
|
| 454 |
+
super().__setattr__("vec", _unwrap_if_constexpr(self.vec))
|
| 455 |
+
super().__setattr__("per_phase", _unwrap_if_constexpr(self.per_phase))
|
| 456 |
+
super().__setattr__("max_phase", _unwrap_if_constexpr(self.max_phase))
|
| 457 |
+
super().__setattr__("order", _unwrap_if_constexpr(self.order))
|
| 458 |
+
|
| 459 |
+
object.__setattr__(self, "cga_layout", self.cga_layout)
|
| 460 |
+
|
| 461 |
+
def _to_ir(self, builder):
|
| 462 |
+
return builder.get_swizzled_shared_layout(
|
| 463 |
+
self.vec,
|
| 464 |
+
self.per_phase,
|
| 465 |
+
self.max_phase,
|
| 466 |
+
self.order,
|
| 467 |
+
self.cga_layout,
|
| 468 |
+
)
|
| 469 |
+
|
| 470 |
+
def mangle(self) -> str:
|
| 471 |
+
|
| 472 |
+
def stringify(x):
|
| 473 |
+
if x is None:
|
| 474 |
+
return ""
|
| 475 |
+
return "_".join(map(str, x))
|
| 476 |
+
|
| 477 |
+
cga_layout = "_".join("~".join(map(str, vec)) for vec in self.cga_layout) if self.cga_layout else ""
|
| 478 |
+
return f"SSS_{self.vec}_{self.per_phase}_{self.max_phase}_{stringify(self.order)}_{cga_layout}_SSS"
|
| 479 |
+
|
| 480 |
+
def __hash__(self):
|
| 481 |
+
return hash(
|
| 482 |
+
(self.vec, self.per_phase, self.max_phase, tuple(self.order), tuple(tuple(vec) for vec in self.cga_layout)))
|
| 483 |
+
|
| 484 |
+
|
| 485 |
+
@dataclass(frozen=True, eq=True)
|
| 486 |
+
class PaddedSharedLayout(SharedLayout):
|
| 487 |
+
"""
|
| 488 |
+
Represents a layout for the access to shared memory. Compared to SwizzledSharedLayout,
|
| 489 |
+
it combined padding and element reordering via linear transformation (e.g. row permutation)
|
| 490 |
+
to avoid shared memory bank conflicts. After every interval tensor elements, the
|
| 491 |
+
corresponding number of padding elements are inserted. If a position corresponds to
|
| 492 |
+
multiple intervals, the padding amounts are summed.
|
| 493 |
+
|
| 494 |
+
In the following example of a tensor,
|
| 495 |
+
`eM` represents original elements in the and `pN` represents padded element.
|
| 496 |
+
|
| 497 |
+
Before padding, the shared memory looks like:
|
| 498 |
+
[e0, e1,
|
| 499 |
+
e2, e3,
|
| 500 |
+
e4, e5,
|
| 501 |
+
e6, e7,
|
| 502 |
+
...]
|
| 503 |
+
|
| 504 |
+
After padding with interval-padding list [[2, 1], [4, 2]] with an identity remapping,
|
| 505 |
+
the shared memory will be
|
| 506 |
+
[e0, e1, p0,
|
| 507 |
+
e2, e3, p1, p2, p3,
|
| 508 |
+
e4, e5, p4,
|
| 509 |
+
e6, e7, p5, p6, p7,
|
| 510 |
+
...]
|
| 511 |
+
|
| 512 |
+
Furthermore this encoding allows for a linear remapping from the 1-D shared
|
| 513 |
+
memory offset to logical n-D tensor elements. The remapping is given in the form
|
| 514 |
+
of linear bases mapping from offset to [dim0, dim1...dimN-1].
|
| 515 |
+
See LinearLayout.h for more details how linear layouts are applied to remap
|
| 516 |
+
elements.
|
| 517 |
+
Some concrete examples using `xN` and `yN` to mean the logical n-D tensor elements
|
| 518 |
+
and `pN` to mean padding:
|
| 519 |
+
|
| 520 |
+
After padding for shape = [8] with interval-padding list [[2, 2]], offset_bases = [[2], [1]] and block_bases = []:
|
| 521 |
+
[x0, x2, p0 p1, x1, x3]
|
| 522 |
+
|
| 523 |
+
After padding for shape = [8, 4] with interval_padding_pairs = [[8, 1]], offset_bases = [[0, 1], [0, 2], /*gap, stride by 2 rows*/[2, 0], [4, 0], [1, 0]]] and block_bases = []:
|
| 524 |
+
[
|
| 525 |
+
x0y0, x0y1, x0y2, x0y3,
|
| 526 |
+
x2y0, x2y1, x2y2, x2y3,
|
| 527 |
+
p0,
|
| 528 |
+
x4y0, x4y1, x4y2, x4y3,
|
| 529 |
+
x6y0, x6y1, x6y2, x6y3,
|
| 530 |
+
p1,
|
| 531 |
+
x1y0, x1y1, x1y2, x1y3,
|
| 532 |
+
x3y0, x3y1, x3y2, x3y3,
|
| 533 |
+
p2,
|
| 534 |
+
x5y0, x5y1, x5y2, x5y3,
|
| 535 |
+
x7y0, x7y1, x7y2, x7y3,
|
| 536 |
+
]
|
| 537 |
+
|
| 538 |
+
Args:
|
| 539 |
+
interval_padding_pairs (List[int]): List of [interval, padding] pair and both interval and padding must be powers of 2.
|
| 540 |
+
offset_bases (List[int]): Bases for shared memory offsets
|
| 541 |
+
block_bases (List[List[int]]): Bases for block-level shared memory offsets.
|
| 542 |
+
shape (List[int]): n-D logical shared memory shape
|
| 543 |
+
"""
|
| 544 |
+
interval_padding_pairs: List[List[int]]
|
| 545 |
+
offset_bases: List[List[int]]
|
| 546 |
+
block_bases: List[List[int]]
|
| 547 |
+
shape: List[int]
|
| 548 |
+
|
| 549 |
+
def __post_init__(self):
|
| 550 |
+
super().__setattr__("interval_padding_pairs", _unwrap_shape(self.interval_padding_pairs))
|
| 551 |
+
super().__setattr__("offset_bases", _unwrap_shape(self.offset_bases))
|
| 552 |
+
super().__setattr__("block_bases", _unwrap_shape(self.block_bases))
|
| 553 |
+
super().__setattr__("shape", _unwrap_shape(self.shape))
|
| 554 |
+
|
| 555 |
+
rank = len(self.shape)
|
| 556 |
+
|
| 557 |
+
for basis in self.offset_bases:
|
| 558 |
+
assert len(basis) == rank
|
| 559 |
+
for basis in self.block_bases:
|
| 560 |
+
assert len(basis) == rank
|
| 561 |
+
|
| 562 |
+
self.verify()
|
| 563 |
+
|
| 564 |
+
def _to_ir(self, builder):
|
| 565 |
+
intervals, paddings = zip(*self.interval_padding_pairs)
|
| 566 |
+
return builder.get_padded_shared_layout(intervals, paddings, self.offset_bases, self.block_bases, self.shape)
|
| 567 |
+
|
| 568 |
+
def mangle(self) -> str:
|
| 569 |
+
return f"PaddedShared_{self.interval_padding_pairs}_{self.offset_bases}_{self.block_bases}_{self.shape}_PaddedShared"
|
| 570 |
+
|
| 571 |
+
def verify(self):
|
| 572 |
+
pairs = self.interval_padding_pairs
|
| 573 |
+
assert len(pairs) > 0, "PaddedSharedLayout interval_padding_pairs must have at least one interval-padding pair"
|
| 574 |
+
assert all(len(pair) == 2 for pair in pairs)
|
| 575 |
+
intervals, paddings = zip(*pairs)
|
| 576 |
+
|
| 577 |
+
unique_intervals = list(set(intervals))
|
| 578 |
+
assert len(unique_intervals) == len(intervals)
|
| 579 |
+
|
| 580 |
+
is_power_of_2 = lambda n: n > 0 and n & (n - 1) == 0
|
| 581 |
+
assert all(is_power_of_2(n) for n in intervals), "PaddedSharedLayout interval values must all be power of two"
|
| 582 |
+
assert all(is_power_of_2(n) for n in paddings), "PaddedSharedLayout padding values must all be power of two"
|
| 583 |
+
|
| 584 |
+
rank = len(self.shape)
|
| 585 |
+
assert rank > 0, "PaddedSharedLayout order must not be empty"
|
| 586 |
+
|
| 587 |
+
@staticmethod
|
| 588 |
+
@constexpr_function
|
| 589 |
+
def with_identity_for(interval_padding_pairs, shape, order):
|
| 590 |
+
"""Returns a PaddedSharedLayout with the given interval and padding pairs and an identity mapping as the linear component for the given shape and order.
|
| 591 |
+
"""
|
| 592 |
+
assert len(shape) == len(order)
|
| 593 |
+
is_power_of_2 = lambda n: n > 0 and n & (n - 1) == 0
|
| 594 |
+
assert all(is_power_of_2(n) for n in shape)
|
| 595 |
+
|
| 596 |
+
rank = len(shape)
|
| 597 |
+
# Create a idendity mapping based on shape + order
|
| 598 |
+
offset_bases = []
|
| 599 |
+
for dim in order:
|
| 600 |
+
for basis in range(int(math.log2(shape[dim]))):
|
| 601 |
+
offset_bases.append([1 << basis if i == dim else 0 for i in range(rank)])
|
| 602 |
+
|
| 603 |
+
return PaddedSharedLayout(interval_padding_pairs, offset_bases, [], shape)
|
| 604 |
+
|
| 605 |
+
def __hash__(self):
|
| 606 |
+
return hash((tuple(map(tuple, self.interval_padding_pairs)), tuple(map(tuple, self.offset_bases)),
|
| 607 |
+
tuple(map(tuple, self.block_bases)), tuple(self.shape)))
|
| 608 |
+
|
| 609 |
+
|
| 610 |
+
@dataclass(frozen=True)
|
| 611 |
+
class SharedLinearLayout(SharedLayout):
|
| 612 |
+
"""Represents a shared memory layout defined via an explicit LinearLayout."""
|
| 613 |
+
|
| 614 |
+
offset_bases: List[List[int]]
|
| 615 |
+
block_bases: List[List[int]] = field(default_factory=list)
|
| 616 |
+
alignment: int = 16
|
| 617 |
+
|
| 618 |
+
def __post_init__(self):
|
| 619 |
+
super().__setattr__("offset_bases", _unwrap_shape(self.offset_bases))
|
| 620 |
+
super().__setattr__("block_bases", _unwrap_shape(self.block_bases))
|
| 621 |
+
super().__setattr__("alignment", _unwrap_if_constexpr(self.alignment))
|
| 622 |
+
|
| 623 |
+
assert len(self.offset_bases) != 0, "SharedLinearLayout offset_bases must not be empty"
|
| 624 |
+
rank = len(self.offset_bases[0])
|
| 625 |
+
assert rank > 0, "SharedLinearLayout offset_bases must not be empty"
|
| 626 |
+
for basis in self.offset_bases:
|
| 627 |
+
assert len(basis) == rank
|
| 628 |
+
for basis in self.block_bases:
|
| 629 |
+
assert len(basis) == rank
|
| 630 |
+
assert self.alignment > 0 and (self.alignment & (self.alignment - 1)) == 0, \
|
| 631 |
+
"SharedLinearLayout alignment must be a positive power of two"
|
| 632 |
+
|
| 633 |
+
def _to_ir(self, builder):
|
| 634 |
+
return builder.get_shared_linear_layout(self.offset_bases, self.block_bases, self.alignment)
|
| 635 |
+
|
| 636 |
+
def mangle(self) -> str:
|
| 637 |
+
return f"SharedLinear_{self.offset_bases}_{self.block_bases}_{self.alignment}_SharedLinear"
|
| 638 |
+
|
| 639 |
+
def __hash__(self):
|
| 640 |
+
return hash((
|
| 641 |
+
tuple(map(tuple, self.offset_bases)),
|
| 642 |
+
tuple(map(tuple, self.block_bases)),
|
| 643 |
+
self.alignment,
|
| 644 |
+
))
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
# Python impl of LinearEncodingAttr::basesPerDim
|
| 648 |
+
def bases_per_dim(bases, rank, skip_broadcast=True):
|
| 649 |
+
result = [1] * rank
|
| 650 |
+
|
| 651 |
+
if not bases:
|
| 652 |
+
return result
|
| 653 |
+
|
| 654 |
+
non_zero_idx = None
|
| 655 |
+
|
| 656 |
+
for basis in bases:
|
| 657 |
+
# Find the first non-zero index in the current basis
|
| 658 |
+
idx = next((i for i, v in enumerate(basis) if v != 0), None)
|
| 659 |
+
if idx is not None:
|
| 660 |
+
non_zero_idx = idx
|
| 661 |
+
result[idx] *= 2
|
| 662 |
+
elif not skip_broadcast:
|
| 663 |
+
# If no non-zero found and we're not skipping broadcasts, use the last found non-zero index
|
| 664 |
+
assert non_zero_idx is not None
|
| 665 |
+
result[non_zero_idx] *= 2
|
| 666 |
+
|
| 667 |
+
return result
|
| 668 |
+
|
| 669 |
+
|
| 670 |
+
def warps_per_cta(layout, shape):
|
| 671 |
+
if isinstance(layout, DistributedLinearLayout):
|
| 672 |
+
return bases_per_dim(layout.warp_bases, len(shape))
|
| 673 |
+
elif isinstance(layout, (SliceLayout, DotOperandLayout)):
|
| 674 |
+
return warps_per_cta(layout.parent, shape)
|
| 675 |
+
else:
|
| 676 |
+
return layout.warps_per_cta
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_math.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import triton.language.math as tl_math
|
| 2 |
+
from ._core import builtin
|
| 3 |
+
|
| 4 |
+
umulhi = builtin(tl_math.umulhi)
|
| 5 |
+
exp = builtin(tl_math.exp)
|
| 6 |
+
exp2 = builtin(tl_math.exp2)
|
| 7 |
+
fma = builtin(tl_math.fma)
|
| 8 |
+
log = builtin(tl_math.log)
|
| 9 |
+
log2 = builtin(tl_math.log2)
|
| 10 |
+
cos = builtin(tl_math.cos)
|
| 11 |
+
rsqrt = builtin(tl_math.rsqrt)
|
| 12 |
+
sin = builtin(tl_math.sin)
|
| 13 |
+
sqrt = builtin(tl_math.sqrt)
|
| 14 |
+
sqrt_rn = builtin(tl_math.sqrt_rn)
|
| 15 |
+
abs = builtin(tl_math.abs)
|
| 16 |
+
fdiv = builtin(tl_math.fdiv)
|
| 17 |
+
div_rn = builtin(tl_math.div_rn)
|
| 18 |
+
erf = builtin(tl_math.erf)
|
| 19 |
+
floor = builtin(tl_math.floor)
|
| 20 |
+
ceil = builtin(tl_math.ceil)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_semantic.py
ADDED
|
@@ -0,0 +1,573 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Sequence, List, TypeVar, Tuple, Callable
|
| 2 |
+
import math
|
| 3 |
+
from triton.language.semantic import TritonSemantic
|
| 4 |
+
from . import _core as ttgl
|
| 5 |
+
from ._layouts import AutoLayout, DistributedLayout, DistributedLinearLayout, SliceLayout, SharedLayout, CoalescedLayout
|
| 6 |
+
from triton._C.libtriton.gluon_ir import GluonOpBuilder, compute_tmem_reg_layout
|
| 7 |
+
from triton.compiler.code_generator import flatten_values_to_ir, unflatten_ir_values
|
| 8 |
+
|
| 9 |
+
TensorTy = TypeVar("TensorTy")
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def _check(cond: bool, msg_fn: Callable[[], str], category=ValueError):
|
| 13 |
+
if not cond:
|
| 14 |
+
raise category(msg_fn())
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def _is_int_list(value):
|
| 18 |
+
return isinstance(value, Sequence) and all(isinstance(i, int) for i in value)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def _compute_tmem_reg_layout(element_ty, shape, layout, num_warps, instr_variant, cga_layout=None):
|
| 22 |
+
_check(isinstance(instr_variant, str), lambda: "instr_variant must be a string")
|
| 23 |
+
_check(instr_variant in ("32x32b", "16x64b", "16x128b", "16x256b", "16x32bx2", "32x32b_splitn"),
|
| 24 |
+
lambda: f"unknown instr_variant: {instr_variant}")
|
| 25 |
+
_check(isinstance(num_warps, int), lambda: f"num_warps must be an int but got {type(num_warps)!r}")
|
| 26 |
+
_check(num_warps >= 4 and (num_warps & (num_warps - 1)) == 0, lambda: "num_warps must be a power of two and >= 4")
|
| 27 |
+
|
| 28 |
+
shape = list(shape)
|
| 29 |
+
_check(all(isinstance(dim, int) for dim in shape), lambda: f"shape entries must be ints but got {shape}")
|
| 30 |
+
rank = len(shape)
|
| 31 |
+
_check(rank == 2, lambda: "expected a 2D tensor")
|
| 32 |
+
|
| 33 |
+
if cga_layout is None:
|
| 34 |
+
cga_layout = []
|
| 35 |
+
splitn = instr_variant == "32x32b_splitn"
|
| 36 |
+
atom_variant = "32x32b" if splitn else instr_variant
|
| 37 |
+
|
| 38 |
+
if cga_layout:
|
| 39 |
+
for basis in cga_layout:
|
| 40 |
+
_check(len(basis) == rank, lambda: "cga_layout basis rank mismatch")
|
| 41 |
+
|
| 42 |
+
layout_obj = compute_tmem_reg_layout(
|
| 43 |
+
element_ty,
|
| 44 |
+
shape,
|
| 45 |
+
layout,
|
| 46 |
+
num_warps,
|
| 47 |
+
atom_variant,
|
| 48 |
+
cga_layout,
|
| 49 |
+
)
|
| 50 |
+
_check(layout_obj is not None,
|
| 51 |
+
lambda: f"TMEM layout '{atom_variant}' unsupported for shape {shape} and num_warps {num_warps}")
|
| 52 |
+
|
| 53 |
+
if splitn:
|
| 54 |
+
N = shape[1]
|
| 55 |
+
if not layout_obj.reg_bases:
|
| 56 |
+
# We cannot use this layout in a load or a store ATM due to a PTX bug!
|
| 57 |
+
# You can work around this by loading to 32x32b and follow by a convert_layout to this layout.
|
| 58 |
+
_check(layout_obj.lane_bases[-1] == [0, N // 2],
|
| 59 |
+
lambda: f"splitn with 1 register requires the last lane basis to be [0, N / 2]. Got {layout_obj}")
|
| 60 |
+
layout_obj.reg_bases.append([0, N // 2])
|
| 61 |
+
layout_obj.lane_bases[-1] = [0, 0]
|
| 62 |
+
elif layout_obj.reg_bases[-1] != [0, N // 2]:
|
| 63 |
+
bitwidth = element_ty.primitive_bitwidth
|
| 64 |
+
num_reg = 2**len(layout_obj.reg_bases)
|
| 65 |
+
_check(
|
| 66 |
+
num_reg > 32 // bitwidth, lambda: "To be able to `tmem.load` into `tl.split` you need to have more "
|
| 67 |
+
f"than {32 // bitwidth} {bitwidth}-bit registers, as you need to use "
|
| 68 |
+
"the instruction 32x32b.x1 twice. You can always load into "
|
| 69 |
+
"instr_variant=\"32x32b\" and then convert_layout to this layout otherwise.")
|
| 70 |
+
|
| 71 |
+
reg_bases = layout_obj.reg_bases
|
| 72 |
+
for bases_str in ("lane_bases", "warp_bases"):
|
| 73 |
+
bases = getattr(layout_obj, bases_str)
|
| 74 |
+
for i, basis in enumerate(bases):
|
| 75 |
+
if basis == [0, N // 2]:
|
| 76 |
+
reg_bases[-1], bases[i] = bases[i], reg_bases[-1]
|
| 77 |
+
return layout_obj
|
| 78 |
+
assert False, f"splitn requires at least one basis of [0, N / 2]. Got {layout}"
|
| 79 |
+
return layout_obj
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
_compute_tmem_reg_layout.__triton_builtin__ = True
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
class GluonCallerContext:
|
| 86 |
+
|
| 87 |
+
def __init__(self, num_warps: int):
|
| 88 |
+
self.num_warps = num_warps
|
| 89 |
+
|
| 90 |
+
def mangle(self):
|
| 91 |
+
return f"_NW{self.num_warps}"
|
| 92 |
+
|
| 93 |
+
def initialize_callee(self, fn, builder):
|
| 94 |
+
fn.set_attr("ttg.num-warps", builder.get_int32_attr(self.num_warps))
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
class GluonSemantic(TritonSemantic[TensorTy]):
|
| 98 |
+
tensor = ttgl.tensor
|
| 99 |
+
lang = ttgl
|
| 100 |
+
|
| 101 |
+
builder: GluonOpBuilder
|
| 102 |
+
|
| 103 |
+
def __init__(self, builder: GluonOpBuilder):
|
| 104 |
+
self.builder = builder
|
| 105 |
+
|
| 106 |
+
def _wrap_handle_infer_layout(self, handle, scalar_ty, shape):
|
| 107 |
+
if shape == []:
|
| 108 |
+
ty = scalar_ty
|
| 109 |
+
else:
|
| 110 |
+
ty = ttgl.distributed_type(scalar_ty, shape, self.builder.get_gluon_layout_from_tensor(handle))
|
| 111 |
+
return self.tensor(handle, ty)
|
| 112 |
+
|
| 113 |
+
def _wrap_tensor_infer_layout(self, tensor):
|
| 114 |
+
return self._wrap_handle_infer_layout(tensor.handle, tensor.type.scalar, tensor.shape)
|
| 115 |
+
|
| 116 |
+
def _broadcast_shapes(self, lhs_shape: List[int], rhs_shape: List[int]):
|
| 117 |
+
if len(lhs_shape) != len(rhs_shape):
|
| 118 |
+
raise ValueError(f"Cannot broadcast, rank mismatch: {lhs_shape}, {rhs_shape}")
|
| 119 |
+
|
| 120 |
+
ret_shape = []
|
| 121 |
+
for i, left in enumerate(lhs_shape):
|
| 122 |
+
right = rhs_shape[i]
|
| 123 |
+
if left == 1:
|
| 124 |
+
ret_shape.append(right)
|
| 125 |
+
elif (right == 1) or (right == left):
|
| 126 |
+
ret_shape.append(left)
|
| 127 |
+
else:
|
| 128 |
+
raise ValueError("Cannot make_shape_compatible: incompatible dimensions "
|
| 129 |
+
"at index " + str(i) + ": " + str(left) + " and " + str(right))
|
| 130 |
+
return ret_shape
|
| 131 |
+
|
| 132 |
+
def expand_dims(self, input: TensorTy, axis: int) -> TensorTy:
|
| 133 |
+
dst_shape = [ttgl._unwrap_if_constexpr(x) for x in input.shape]
|
| 134 |
+
dst_shape.insert(axis, 1)
|
| 135 |
+
|
| 136 |
+
if axis < 0:
|
| 137 |
+
axis += len(input.shape)
|
| 138 |
+
|
| 139 |
+
_check(isinstance(input.type, ttgl.distributed_type),
|
| 140 |
+
lambda: f"expected expand_dims input to be a distributed_type but got: {input.type!r}")
|
| 141 |
+
layout = input.type.layout
|
| 142 |
+
_check(isinstance(layout, (SliceLayout, AutoLayout, CoalescedLayout)),
|
| 143 |
+
lambda: f"expected expand_dims input to have a SliceLayout, but got: {layout}")
|
| 144 |
+
_check(
|
| 145 |
+
isinstance(layout, (AutoLayout, CoalescedLayout)) or layout.dim == axis,
|
| 146 |
+
lambda: f"expected expand_dims input layout to be sliced in axis {axis} but got {layout.dim}")
|
| 147 |
+
|
| 148 |
+
handle = self.builder.create_expand_dims(input.handle, axis)
|
| 149 |
+
return self._wrap_handle_infer_layout(handle, input.type.scalar, dst_shape)
|
| 150 |
+
|
| 151 |
+
def join(self, a: TensorTy, b: TensorTy) -> TensorTy:
|
| 152 |
+
a, b = self.broadcast_impl_value(a, b)
|
| 153 |
+
_check(a.shape != [], lambda: "Cannot join scalars in gluon")
|
| 154 |
+
value = super().join(a, b)
|
| 155 |
+
return self._wrap_tensor_infer_layout(value)
|
| 156 |
+
|
| 157 |
+
def split(self, a: TensorTy) -> Tuple[TensorTy, TensorTy]:
|
| 158 |
+
lhs, rhs = super().split(a)
|
| 159 |
+
return self._wrap_tensor_infer_layout(lhs), self._wrap_tensor_infer_layout(rhs)
|
| 160 |
+
|
| 161 |
+
def permute(self, input: TensorTy, dims: Tuple[int]) -> TensorTy:
|
| 162 |
+
value = super().permute(input, dims)
|
| 163 |
+
return self._wrap_tensor_infer_layout(value)
|
| 164 |
+
|
| 165 |
+
def broadcast_impl_shape(self, input: TensorTy, shape: Tuple[int]) -> TensorTy:
|
| 166 |
+
_check(isinstance(input.type, ttgl.distributed_type),
|
| 167 |
+
lambda: f"expected expand_dims input to be a distributed_type but got: {input.type!r}")
|
| 168 |
+
src_shape = input.type.get_block_shapes()
|
| 169 |
+
_check(len(src_shape) == len(shape), lambda: f"Cannot broadcast, rank mismatch: {src_shape}, {shape}")
|
| 170 |
+
if shape == src_shape:
|
| 171 |
+
return input
|
| 172 |
+
for i, item in enumerate(src_shape):
|
| 173 |
+
if shape[i] != item and item != 1:
|
| 174 |
+
raise ValueError(f"Cannot broadcast, the expanded size of the tensor ({shape[i]})"
|
| 175 |
+
f" must match the existing size ({item}) at non-singleton dimension"
|
| 176 |
+
f" {i}: {src_shape}, {shape}")
|
| 177 |
+
ret_ty = ttgl.distributed_type(input.type.scalar, shape, input.type.layout)
|
| 178 |
+
handle = self.builder.create_broadcast(input.handle, ret_ty.to_ir(self.builder))
|
| 179 |
+
return self.tensor(handle, ret_ty)
|
| 180 |
+
|
| 181 |
+
def broadcast_impl_value(self, lhs: TensorTy, rhs: TensorTy) -> TensorTy:
|
| 182 |
+
lhs_ty = lhs.type
|
| 183 |
+
rhs_ty = rhs.type
|
| 184 |
+
|
| 185 |
+
if not lhs_ty.is_block() or not rhs_ty.is_block():
|
| 186 |
+
return super().broadcast_impl_value(lhs, rhs)
|
| 187 |
+
|
| 188 |
+
_check(isinstance(lhs_ty, ttgl.distributed_type),
|
| 189 |
+
lambda: f"expected broadcast left input to be a distributed_type but got: {lhs_ty!r}")
|
| 190 |
+
_check(isinstance(rhs_ty, ttgl.distributed_type),
|
| 191 |
+
lambda: f"expected broadcast right input to be a distributed_type but got: {rhs_ty!r}")
|
| 192 |
+
|
| 193 |
+
lhs_shape = lhs_ty.get_block_shapes()
|
| 194 |
+
rhs_shape = rhs_ty.get_block_shapes()
|
| 195 |
+
ret_shape = self._broadcast_shapes(lhs_shape, rhs_shape)
|
| 196 |
+
|
| 197 |
+
is_lhs_auto = isinstance(lhs_ty.layout, AutoLayout)
|
| 198 |
+
is_rhs_auto = isinstance(rhs_ty.layout, AutoLayout)
|
| 199 |
+
if is_lhs_auto and not is_rhs_auto:
|
| 200 |
+
lhs = self.set_auto_layout(lhs, rhs_ty.layout)
|
| 201 |
+
elif is_rhs_auto and not is_lhs_auto:
|
| 202 |
+
rhs = self.set_auto_layout(rhs, lhs_ty.layout)
|
| 203 |
+
elif lhs_ty.layout != rhs_ty.layout:
|
| 204 |
+
raise ValueError(f"Layout mismatch in broadcast: {lhs_ty.layout} vs {rhs_ty.layout}")
|
| 205 |
+
|
| 206 |
+
lhs = self.broadcast_impl_shape(lhs, ret_shape)
|
| 207 |
+
rhs = self.broadcast_impl_shape(rhs, ret_shape)
|
| 208 |
+
return lhs, rhs
|
| 209 |
+
|
| 210 |
+
def arange(self, start, end, layout):
|
| 211 |
+
shape = [end - start]
|
| 212 |
+
if layout is None:
|
| 213 |
+
layout = AutoLayout()
|
| 214 |
+
ret_ty = ttgl.distributed_type(ttgl.int32, shape, layout)
|
| 215 |
+
return super().arange(start, end, ret_ty=ret_ty)
|
| 216 |
+
|
| 217 |
+
def reshape(self, input: TensorTy, dst_shape: List[int], can_reorder: bool):
|
| 218 |
+
_check(not can_reorder, lambda: "can_reorder is not supported in gluon")
|
| 219 |
+
value = super().reshape(input, dst_shape, can_reorder)
|
| 220 |
+
return self._wrap_tensor_infer_layout(value)
|
| 221 |
+
|
| 222 |
+
def splat(self, value, shape, layout):
|
| 223 |
+
if len(shape) == 0:
|
| 224 |
+
return value
|
| 225 |
+
ret_ty = ttgl.distributed_type(value.dtype, shape, layout)
|
| 226 |
+
handle = self.builder.create_splat(ret_ty.to_ir(self.builder), value.handle)
|
| 227 |
+
return ttgl.tensor(handle, ret_ty)
|
| 228 |
+
|
| 229 |
+
def full(self, shape, value, dtype, layout):
|
| 230 |
+
scalar = self.make_scalar(value, dtype)
|
| 231 |
+
if layout is None:
|
| 232 |
+
layout = AutoLayout()
|
| 233 |
+
return self.splat(scalar, shape, layout)
|
| 234 |
+
|
| 235 |
+
def convert_layout(self, value, layout, assert_trivial=False):
|
| 236 |
+
ty = value.type
|
| 237 |
+
_check(isinstance(ty, ttgl.distributed_type),
|
| 238 |
+
lambda: f"expected convert_layout input to be a distributed_type but got: {ty!r}")
|
| 239 |
+
_check(isinstance(layout, ttgl.DistributedLayout),
|
| 240 |
+
lambda: f"expected 'layout' to be a DistributedLayout but got {layout}")
|
| 241 |
+
ret_ty = ttgl.distributed_type(ty.element_ty, ty.shape, layout)
|
| 242 |
+
ret_ty_ir = ret_ty.to_ir(self.builder)
|
| 243 |
+
if assert_trivial and not self.builder.is_convert_layout_trivial(ret_ty_ir, value.handle):
|
| 244 |
+
raise TypeError(f"layout conversion from {ty.layout} to {layout} is not trivial.\n"
|
| 245 |
+
f"The linear layouts are:\n{self.to_linear_layout(ty.layout, ty.shape)}\n"
|
| 246 |
+
f"{self.to_linear_layout(layout, ty.shape)}")
|
| 247 |
+
handle = self.builder.create_convert_layout(ret_ty_ir, value.handle)
|
| 248 |
+
return ttgl.tensor(handle, ret_ty)
|
| 249 |
+
|
| 250 |
+
def allocate_shared(self, element_ty, shape, layout, value):
|
| 251 |
+
_check(isinstance(element_ty, ttgl.dtype), lambda: f"expected 'element_ty' to be a dtype but got {element_ty}")
|
| 252 |
+
_check(_is_int_list(shape), lambda: f"all elements of 'shape' must be integers but got {shape}")
|
| 253 |
+
_check(isinstance(layout, ttgl.SharedLayout),
|
| 254 |
+
lambda: f"expected 'layout' to be a SharedLayout but got {layout}")
|
| 255 |
+
ty = ttgl.shared_memory_descriptor_type(element_ty, shape, layout, shape)
|
| 256 |
+
if value is not None:
|
| 257 |
+
handle = self.builder.create_local_alloc(ty.to_ir(self.builder), value.handle)
|
| 258 |
+
else:
|
| 259 |
+
handle = self.builder.create_local_alloc(ty.to_ir(self.builder))
|
| 260 |
+
return ttgl.shared_memory_descriptor(handle, element_ty, shape, layout, shape)
|
| 261 |
+
|
| 262 |
+
def shared_load(self, mem_desc, layout):
|
| 263 |
+
_check(isinstance(layout, ttgl.DistributedLayout),
|
| 264 |
+
lambda: f"expected 'layout' to be a DistributedLayout but got {layout}")
|
| 265 |
+
ret_ty = ttgl.distributed_type(mem_desc.dtype, mem_desc.shape, layout)
|
| 266 |
+
handle = self.builder.create_local_load(ret_ty.to_ir(self.builder), mem_desc.handle)
|
| 267 |
+
return ttgl.tensor(handle, ret_ty)
|
| 268 |
+
|
| 269 |
+
def shared_store(self, mem_desc, value):
|
| 270 |
+
_check(isinstance(value, ttgl.tensor), lambda: f"expected 'value' to be a tensor, but got a {type(value)}")
|
| 271 |
+
_check(value.shape == mem_desc.shape,
|
| 272 |
+
lambda: f"source shape {value.shape} and destination shape {mem_desc.shape} must match")
|
| 273 |
+
_check(value.dtype == mem_desc.dtype,
|
| 274 |
+
lambda: f"source dtype {value.dtype} and destination dtype {mem_desc.dtype} must match")
|
| 275 |
+
self.builder.create_local_store(mem_desc.handle, value.handle)
|
| 276 |
+
|
| 277 |
+
def bank_conflicts(self, distr_ty, shared_ty):
|
| 278 |
+
if not isinstance(distr_ty, ttgl.distributed_type):
|
| 279 |
+
raise TypeError(
|
| 280 |
+
f"bank_conflicts expects the register layout to be a distributed_type, got {type(distr_ty)}")
|
| 281 |
+
|
| 282 |
+
if not isinstance(shared_ty, ttgl.shared_memory_descriptor_type):
|
| 283 |
+
raise TypeError(
|
| 284 |
+
f"bank_conflicts expects the shared layout to be a shared_memory_descriptor_type, got {type(shared_ty)}"
|
| 285 |
+
)
|
| 286 |
+
|
| 287 |
+
if distr_ty.shape != shared_ty.shape:
|
| 288 |
+
raise ValueError(f"register shape {distr_ty.shape} and shared shape {shared_ty.shape} must match")
|
| 289 |
+
if shared_ty.element_ty != distr_ty.element_ty:
|
| 290 |
+
raise ValueError(
|
| 291 |
+
f"mismatched dtypes between register ({distr_ty.element_ty}) and shared ({shared_ty.element_ty}) layouts"
|
| 292 |
+
)
|
| 293 |
+
if shared_ty.shape != shared_ty.alloc_shape[-len(shared_ty.shape):]:
|
| 294 |
+
raise ValueError(
|
| 295 |
+
f"bank_conflicts NYI for subslices. Got shape {shared_ty.shape} and alloc_shape {shared_ty.alloc_shape}"
|
| 296 |
+
)
|
| 297 |
+
|
| 298 |
+
reg_attr = distr_ty.layout._to_ir(self.builder)
|
| 299 |
+
shared_attr = shared_ty.layout._to_ir(self.builder)
|
| 300 |
+
return self.builder.get_shared_bank_conflicts(reg_attr, shared_attr, list(distr_ty.shape),
|
| 301 |
+
distr_ty.element_ty.primitive_bitwidth)
|
| 302 |
+
|
| 303 |
+
def to_linear_layout(self, layout, shape):
|
| 304 |
+
_check(isinstance(layout, (DistributedLayout, SharedLayout)),
|
| 305 |
+
lambda: f"Expected a DistributedLayout or SharedLayout, got {type(layout)}")
|
| 306 |
+
|
| 307 |
+
if not isinstance(shape, list):
|
| 308 |
+
shape = list(shape)
|
| 309 |
+
|
| 310 |
+
layout = ttgl._unwrap_if_constexpr(layout)
|
| 311 |
+
|
| 312 |
+
if isinstance(layout, (AutoLayout, DistributedLinearLayout)):
|
| 313 |
+
return ttgl.constexpr(layout)
|
| 314 |
+
|
| 315 |
+
return ttgl.constexpr(self.builder.to_linear_layout(layout._to_ir(self.builder), shape))
|
| 316 |
+
|
| 317 |
+
def shared_dealloc(self, mem_desc):
|
| 318 |
+
self.builder.create_local_dealloc(mem_desc.handle)
|
| 319 |
+
|
| 320 |
+
def set_auto_layout(self, value, layout):
|
| 321 |
+
src_ty = value.type
|
| 322 |
+
_check(isinstance(layout, DistributedLayout),
|
| 323 |
+
lambda: f"set_auto_layout must set to a distributed layout but got {layout}")
|
| 324 |
+
_check(isinstance(src_ty.layout, AutoLayout),
|
| 325 |
+
lambda: f"set_auto_layout input must have auto layout but got {value.type.layout}")
|
| 326 |
+
handle = self.builder.create_set_auto_layout(layout._to_ir(self.builder), value.handle)
|
| 327 |
+
res_ty = ttgl.distributed_type(src_ty.element_ty, src_ty.shape, layout)
|
| 328 |
+
return self.tensor(handle, res_ty)
|
| 329 |
+
|
| 330 |
+
def memdesc_slice(self, mem_desc, start, length, dim):
|
| 331 |
+
_check(isinstance(start, int), lambda: f"expected 'start' to be an int but got {start}")
|
| 332 |
+
_check(isinstance(length, int), lambda: f"expected 'length' to be an int but got {length}")
|
| 333 |
+
_check(isinstance(dim, int), lambda: f"expected 'dim' to be an int but got {dim}")
|
| 334 |
+
offsets = [0] * mem_desc.rank
|
| 335 |
+
offsets[dim] = start
|
| 336 |
+
shape = list(mem_desc.shape)
|
| 337 |
+
shape[dim] = length
|
| 338 |
+
layout = mem_desc.layout
|
| 339 |
+
ty = ttgl.shared_memory_descriptor_type(mem_desc.dtype, shape, layout, mem_desc.type.alloc_shape)
|
| 340 |
+
builder = self.builder
|
| 341 |
+
handle = builder.create_memdesc_subslice(ty.to_ir(builder), mem_desc.handle, offsets)
|
| 342 |
+
return ttgl.shared_memory_descriptor(handle, **ty.__dict__)
|
| 343 |
+
|
| 344 |
+
def memdesc_index(self, mem_desc, index):
|
| 345 |
+
index = self.to_tensor(index)
|
| 346 |
+
_check(index.type == ttgl.int32, lambda: f"expected 'index' to be int32 but got {index.type}")
|
| 347 |
+
shape = mem_desc.shape[1:]
|
| 348 |
+
index = self.to_tensor(index).handle
|
| 349 |
+
layout = mem_desc.layout
|
| 350 |
+
ty = ttgl.shared_memory_descriptor_type(mem_desc.dtype, shape, layout, shape)
|
| 351 |
+
builder = self.builder
|
| 352 |
+
handle = builder.create_memdesc_index(ty.to_ir(builder), mem_desc.handle, index)
|
| 353 |
+
return ttgl.shared_memory_descriptor(handle, **ty.__dict__)
|
| 354 |
+
|
| 355 |
+
def memdesc_trans(self, mem_desc, order):
|
| 356 |
+
_check(_is_int_list(order), lambda: f"all elements of 'order' must be integers but got {order}")
|
| 357 |
+
_check(
|
| 358 |
+
len(order) == len(mem_desc.shape),
|
| 359 |
+
lambda: f"source rank ({mem_desc.rank}) and order length ({len(order)}) must match")
|
| 360 |
+
|
| 361 |
+
shape = [mem_desc.shape[i] for i in order]
|
| 362 |
+
alloc_shape = mem_desc.type.alloc_shape
|
| 363 |
+
new_alloc_shape = alloc_shape[:len(alloc_shape) - mem_desc.rank]
|
| 364 |
+
new_alloc_shape += [alloc_shape[len(alloc_shape) - mem_desc.rank:][i] for i in order]
|
| 365 |
+
|
| 366 |
+
handle = self.builder.create_memdesc_trans(mem_desc.handle, order)
|
| 367 |
+
layout = self.builder.get_gluon_layout_from_memdesc(handle)
|
| 368 |
+
return ttgl.shared_memory_descriptor(handle, element_ty=mem_desc.dtype, shape=shape,
|
| 369 |
+
alloc_shape=new_alloc_shape, layout=layout)
|
| 370 |
+
|
| 371 |
+
def memdesc_reshape(self, mem_desc, shape):
|
| 372 |
+
_check(_is_int_list(shape), lambda: f"all elements of 'shape' must be integers but got {shape}")
|
| 373 |
+
_check(
|
| 374 |
+
math.prod(shape) == math.prod(mem_desc.shape),
|
| 375 |
+
lambda: (f"memdesc_reshape total elements mismatch: "
|
| 376 |
+
f"{mem_desc.shape} -> {shape}"),
|
| 377 |
+
)
|
| 378 |
+
|
| 379 |
+
handle = self.builder.create_memdesc_reshape(mem_desc.handle, shape)
|
| 380 |
+
layout = self.builder.get_gluon_layout_from_memdesc(handle)
|
| 381 |
+
alloc_shape = mem_desc.type.alloc_shape
|
| 382 |
+
prefix_len = len(alloc_shape) - mem_desc.rank
|
| 383 |
+
new_alloc_shape = alloc_shape[:prefix_len] + list(shape)
|
| 384 |
+
|
| 385 |
+
return ttgl.shared_memory_descriptor(
|
| 386 |
+
handle,
|
| 387 |
+
element_ty=mem_desc.dtype,
|
| 388 |
+
shape=shape,
|
| 389 |
+
alloc_shape=new_alloc_shape,
|
| 390 |
+
layout=layout,
|
| 391 |
+
)
|
| 392 |
+
|
| 393 |
+
def memdesc_reinterpret(self, mem_desc, dtype, shape, layout):
|
| 394 |
+
_check(isinstance(dtype, ttgl.dtype), lambda: f"expected 'dtype' to be a dtype but got {dtype}")
|
| 395 |
+
_check(_is_int_list(shape), lambda: f"all elements of 'shape' must be integers but got {shape}")
|
| 396 |
+
_check(isinstance(layout, ttgl.SharedLayout),
|
| 397 |
+
lambda: f"expected 'layout' to be a SharedLayout but got {layout}")
|
| 398 |
+
ty = ttgl.shared_memory_descriptor_type(dtype, shape, layout, shape)
|
| 399 |
+
handle = self.builder.create_memdesc_reinterpret(ty.to_ir(self.builder), mem_desc.handle)
|
| 400 |
+
return ttgl.shared_memory_descriptor(handle, **ty.__dict__)
|
| 401 |
+
|
| 402 |
+
def wrap_tensor(self, x, scalar_ty, ret_shape, layout):
|
| 403 |
+
if ret_shape:
|
| 404 |
+
res_ty = ttgl.distributed_type(scalar_ty, ret_shape, layout)
|
| 405 |
+
else:
|
| 406 |
+
res_ty = scalar_ty
|
| 407 |
+
return self.tensor(x, res_ty)
|
| 408 |
+
|
| 409 |
+
@staticmethod
|
| 410 |
+
def _check_same_layout(xs):
|
| 411 |
+
for x in xs:
|
| 412 |
+
_check(isinstance(x.type, ttgl.distributed_type), lambda: f"expected distributed_type but got: {x.type!r}")
|
| 413 |
+
layouts = [x.type.layout for x in xs]
|
| 414 |
+
l0 = layouts[0]
|
| 415 |
+
_check(all(l == l0 for l in layouts[1:]),
|
| 416 |
+
lambda: f"Expected inputs to have matching layouts, but got: {layouts}")
|
| 417 |
+
|
| 418 |
+
def associative_scan(self, inputs: Sequence[TensorTy], axis: int, region_builder_fn,
|
| 419 |
+
reverse: bool) -> Tuple[TensorTy, ...]:
|
| 420 |
+
shape = inputs[0].type.shape
|
| 421 |
+
rank = len(shape)
|
| 422 |
+
|
| 423 |
+
assert -rank <= axis < rank, f"scan axis {axis} must be < inputs rank ({rank})"
|
| 424 |
+
|
| 425 |
+
if axis < 0:
|
| 426 |
+
axis += rank
|
| 427 |
+
|
| 428 |
+
for t in inputs:
|
| 429 |
+
assert t.type.shape == shape, "all scan inputs must have the same shape"
|
| 430 |
+
|
| 431 |
+
scan_op = self.builder.create_scan([t.handle for t in inputs], axis, reverse)
|
| 432 |
+
region_builder_fn(scan_op)
|
| 433 |
+
assert scan_op.verify()
|
| 434 |
+
|
| 435 |
+
return tuple(
|
| 436 |
+
self._wrap_handle_infer_layout(scan_op.get_result(i), inputs[i].type.scalar, shape)
|
| 437 |
+
for i in range(len(inputs)))
|
| 438 |
+
|
| 439 |
+
def reduction(self, inputs: Sequence[TensorTy], axis: int, region_builder_fn) -> Tuple[TensorTy, ...]:
|
| 440 |
+
if axis is None:
|
| 441 |
+
inputs = tuple(self.reshape(t, [t.numel.value], can_reorder=False) for t in inputs)
|
| 442 |
+
axis = 0
|
| 443 |
+
# get result shape
|
| 444 |
+
shape = inputs[0].type.shape
|
| 445 |
+
rank = len(shape)
|
| 446 |
+
_check(0 <= axis < rank, lambda: f"expected reduction axis to be in the range [0, {rank}) but got {axis}")
|
| 447 |
+
self._check_same_layout(inputs)
|
| 448 |
+
ret_shape = [s for i, s in enumerate(shape) if i != axis]
|
| 449 |
+
assert all(t.type.shape == shape for t in inputs), "all reduction inputs must have the same shape"
|
| 450 |
+
|
| 451 |
+
reduce_op = self.builder.create_reduce([t.handle for t in inputs], axis)
|
| 452 |
+
region_builder_fn(reduce_op)
|
| 453 |
+
assert reduce_op.verify()
|
| 454 |
+
|
| 455 |
+
return tuple(
|
| 456 |
+
self._wrap_handle_infer_layout(reduce_op.get_result(i), inputs[i].type.scalar, ret_shape)
|
| 457 |
+
for i in range(len(inputs)))
|
| 458 |
+
|
| 459 |
+
def histogram(self, input: TensorTy, num_bins: int, mask: TensorTy, layout) -> TensorTy:
|
| 460 |
+
_check(len(input.shape) == 1, lambda: "histogram only supports 1D input")
|
| 461 |
+
_check(input.dtype.is_int(), lambda: "histogram only supports integer input")
|
| 462 |
+
_check(layout is not None, lambda: "histogram requires a destination layout")
|
| 463 |
+
if mask is not None:
|
| 464 |
+
mask, input = self.broadcast_impl_value(mask, input)
|
| 465 |
+
_check(mask.type.scalar.is_bool(), lambda: "Mask must have boolean scalar type")
|
| 466 |
+
mask = mask.handle
|
| 467 |
+
layout_attr = layout._to_ir(self.builder)
|
| 468 |
+
handle = self.builder.create_histogram(input.handle, num_bins, mask, layout_attr)
|
| 469 |
+
return self.wrap_tensor(handle, ttgl.int32, [num_bins], layout)
|
| 470 |
+
|
| 471 |
+
def cat(self, lhs: TensorTy, rhs: TensorTy, can_reorder: bool, layout) -> TensorTy:
|
| 472 |
+
_check(layout is not None, lambda: "cat requires a destination layout")
|
| 473 |
+
_check(can_reorder, lambda: "current implementation of `cat` always may reorder elements")
|
| 474 |
+
_check(len(lhs.shape) == 1, lambda: "cat requires a rank-1 input")
|
| 475 |
+
ret_type = ttgl.distributed_type(lhs.type.scalar, [lhs.shape[0] + rhs.shape[0]], layout)
|
| 476 |
+
return self.tensor(self.builder.create_cat(lhs.handle, rhs.handle, ret_type.to_ir(self.builder)), ret_type)
|
| 477 |
+
|
| 478 |
+
def gather(self, src: TensorTy, index: TensorTy, axis: int) -> TensorTy:
|
| 479 |
+
_check(isinstance(src.type, ttgl.distributed_type), lambda: f"expected distributed_type but got: {src.type!r}")
|
| 480 |
+
_check(isinstance(index.type, ttgl.distributed_type),
|
| 481 |
+
lambda: f"expected distributed_type but got: {index.type!r}")
|
| 482 |
+
_check(index.type.scalar.is_int(), lambda: f"expected integer scalar type but got: {index.type.scalar!r}")
|
| 483 |
+
|
| 484 |
+
rank = len(src.type.shape)
|
| 485 |
+
_check(len(index.type.shape) == rank, lambda: "source and index tensors must have the same rank")
|
| 486 |
+
_check(-rank <= axis < rank, lambda: f"gather axis {axis} must be < source rank ({rank})")
|
| 487 |
+
if axis < 0:
|
| 488 |
+
axis += rank
|
| 489 |
+
|
| 490 |
+
for d in range(rank):
|
| 491 |
+
if d == axis:
|
| 492 |
+
continue
|
| 493 |
+
_check(
|
| 494 |
+
index.type.shape[d] == src.type.shape[d],
|
| 495 |
+
lambda: f"index dim {axis} must match the corresponding source dim",
|
| 496 |
+
)
|
| 497 |
+
gather = self.builder.create_gather(src.handle, index.handle, axis)
|
| 498 |
+
return self.wrap_tensor(gather, src.type.scalar, index.type.shape, index.type.layout)
|
| 499 |
+
|
| 500 |
+
def fp4_to_fp(self, src: TensorTy, elem_type, axis) -> TensorTy:
|
| 501 |
+
result = self.builder.create_fp4_to_fp(src.handle, elem_type.to_ir(self.builder), axis)
|
| 502 |
+
shape = list(src.type.shape)
|
| 503 |
+
shape[axis] *= 2
|
| 504 |
+
return self._wrap_handle_infer_layout(result, elem_type, shape)
|
| 505 |
+
|
| 506 |
+
def warp_specialize(self, functions_and_args, worker_num_warps: Sequence[int], worker_num_regs: Sequence[int],
|
| 507 |
+
generator):
|
| 508 |
+
for _, args in functions_and_args:
|
| 509 |
+
_check(isinstance(args, (tuple, ttgl.tuple)),
|
| 510 |
+
lambda: f"function arguments must be a tuple of arguments, but got {type(args)}")
|
| 511 |
+
|
| 512 |
+
assert len(functions_and_args) >= 1, "expected at least one function for the default partition"
|
| 513 |
+
default_partition, default_args = functions_and_args[0]
|
| 514 |
+
num_partitions = len(functions_and_args) - 1
|
| 515 |
+
workers = functions_and_args[1:]
|
| 516 |
+
|
| 517 |
+
assert num_partitions == len(
|
| 518 |
+
worker_num_warps
|
| 519 |
+
), f"warp specialize got {num_partitions} partitions but {len(worker_num_warps)} warp counts"
|
| 520 |
+
assert num_partitions == len(
|
| 521 |
+
worker_num_regs
|
| 522 |
+
), f"warp specialize got {num_partitions} partitions but {len(worker_num_regs)} register counts"
|
| 523 |
+
|
| 524 |
+
builder = self.builder
|
| 525 |
+
insert_pt = builder.get_insertion_point()
|
| 526 |
+
|
| 527 |
+
# Emit the default partition to get the result types.
|
| 528 |
+
default_block = builder.new_block()
|
| 529 |
+
builder.set_insertion_point_to_start(default_block)
|
| 530 |
+
default_results = generator.call_JitFunction(default_partition, default_args, kwargs={})
|
| 531 |
+
mlir_results = []
|
| 532 |
+
if default_results is not None:
|
| 533 |
+
mlir_results = flatten_values_to_ir(default_results)
|
| 534 |
+
builder.create_warp_yield(mlir_results)
|
| 535 |
+
result_types = [r.get_type() for r in mlir_results]
|
| 536 |
+
|
| 537 |
+
# Create the warp specialize op.
|
| 538 |
+
worker_args = [flatten_values_to_ir(args) for _, args in workers]
|
| 539 |
+
mlir_args = sum(worker_args, [])
|
| 540 |
+
builder.restore_insertion_point(insert_pt)
|
| 541 |
+
ws_op = builder.create_warp_specialize(result_types, mlir_args, worker_num_warps)
|
| 542 |
+
ws_op.get_default_region().push_back(default_block)
|
| 543 |
+
ws_op.set_requested_registers(worker_num_regs)
|
| 544 |
+
|
| 545 |
+
# Emit the partition regions.
|
| 546 |
+
builder.create_block_with_parent(ws_op.get_partition_op_holder(), [])
|
| 547 |
+
partitions_op = builder.create_warp_specialize_partitions(num_partitions)
|
| 548 |
+
arg_types = [arg.get_type() for arg in mlir_args]
|
| 549 |
+
arg_it = 0
|
| 550 |
+
for i, (func, args) in enumerate(workers):
|
| 551 |
+
caller_context = GluonCallerContext(num_warps=worker_num_warps[i])
|
| 552 |
+
block = builder.create_block_with_parent(partitions_op.get_region(i), arg_types)
|
| 553 |
+
mlir_args = worker_args[i]
|
| 554 |
+
block_args = [block.get_argument(arg_it + j) for j in range(len(mlir_args))]
|
| 555 |
+
block_args = unflatten_ir_values(block_args, [arg.type for arg in args])
|
| 556 |
+
generator.call_JitFunction(func, block_args, kwargs={}, caller_context=caller_context)
|
| 557 |
+
builder.create_warp_return()
|
| 558 |
+
arg_it += len(mlir_args)
|
| 559 |
+
|
| 560 |
+
builder.set_insertion_point_after(ws_op.get_operation())
|
| 561 |
+
mlir_results = [ws_op.get_result(i) for i in range(len(result_types))]
|
| 562 |
+
if default_results is None:
|
| 563 |
+
return
|
| 564 |
+
return tuple(unflatten_ir_values(mlir_results, [r.type for r in default_results]))
|
| 565 |
+
|
| 566 |
+
def num_ctas(self):
|
| 567 |
+
return ttgl.constexpr(self.builder.options.num_ctas)
|
| 568 |
+
|
| 569 |
+
def num_warps(self, generator):
|
| 570 |
+
if generator.caller_context is not None:
|
| 571 |
+
assert isinstance(generator.caller_context, GluonCallerContext)
|
| 572 |
+
return ttgl.constexpr(generator.caller_context.num_warps)
|
| 573 |
+
return ttgl.constexpr(self.builder.options.num_warps)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/_standard.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import TypeVar
|
| 2 |
+
from triton.runtime.jit import JITFunction
|
| 3 |
+
import triton.language.standard as tl_standard
|
| 4 |
+
from .._runtime import GluonJITFunction, jit
|
| 5 |
+
from triton import knobs
|
| 6 |
+
from . import _core as ttgl
|
| 7 |
+
|
| 8 |
+
T = TypeVar("T")
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def _import_from_triton(fn: JITFunction[T]) -> GluonJITFunction[T]:
|
| 12 |
+
assert knobs.runtime.interpret or isinstance(fn, JITFunction)
|
| 13 |
+
# Wrap the function and preserve its original docstring
|
| 14 |
+
gluon_fn = jit(fn.fn)
|
| 15 |
+
gluon_fn.__doc__ = fn.__doc__
|
| 16 |
+
return gluon_fn
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
cdiv = _import_from_triton(tl_standard.cdiv)
|
| 20 |
+
sum = _import_from_triton(tl_standard.sum)
|
| 21 |
+
max = _import_from_triton(tl_standard.max)
|
| 22 |
+
min = _import_from_triton(tl_standard.min)
|
| 23 |
+
ravel = _import_from_triton(tl_standard.ravel)
|
| 24 |
+
reduce_or = _import_from_triton(tl_standard.reduce_or)
|
| 25 |
+
xor_sum = _import_from_triton(tl_standard.xor_sum)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@jit
|
| 29 |
+
def zeros(shape, dtype, layout=None):
|
| 30 |
+
"""
|
| 31 |
+
Create a tensor filled with zeros.
|
| 32 |
+
|
| 33 |
+
Args:
|
| 34 |
+
shape (Sequence[int]): The shape of the tensor.
|
| 35 |
+
dtype (dtype): The data type for the tensor.
|
| 36 |
+
layout (Optional[DistributedLayout]): The distributed layout of the tensor, defaults to AutoLayout().
|
| 37 |
+
|
| 38 |
+
Returns:
|
| 39 |
+
tensor: A tensor where every element is zero.
|
| 40 |
+
"""
|
| 41 |
+
return ttgl.full(shape, 0, dtype, layout)
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
@jit
|
| 45 |
+
def full_like(input, value, shape=None, dtype=None, layout=None):
|
| 46 |
+
"""
|
| 47 |
+
Create a tensor with the same properties as a given tensor, filled with a specified value.
|
| 48 |
+
|
| 49 |
+
Args:
|
| 50 |
+
input (tensor): Reference tensor to infer default shape, dtype, and layout.
|
| 51 |
+
value (int or float): The fill value.
|
| 52 |
+
shape (Sequence[int], optional): Target shape. Defaults to input.shape.
|
| 53 |
+
dtype (dtype, optional): Target data type. Defaults to input.dtype.
|
| 54 |
+
layout (DistributedLayout, optional): Target layout. Defaults to input.layout.
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
tensor: A tensor where every element equals value.
|
| 58 |
+
"""
|
| 59 |
+
return ttgl.full(
|
| 60 |
+
input.shape if shape is None else shape,
|
| 61 |
+
value,
|
| 62 |
+
input.dtype if dtype is None else dtype,
|
| 63 |
+
input.type.layout if layout is None else layout,
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
@jit
|
| 68 |
+
def zeros_like(input, shape=None, dtype=None, layout=None):
|
| 69 |
+
"""
|
| 70 |
+
Create a tensor with the same properties as a given tensor, filled with zeros.
|
| 71 |
+
|
| 72 |
+
Args:
|
| 73 |
+
input (tensor): Reference tensor to infer default shape, dtype, and layout.
|
| 74 |
+
shape (Sequence[int], optional): Target shape. Defaults to input.shape.
|
| 75 |
+
dtype (dtype, optional): Target data type. Defaults to input.dtype.
|
| 76 |
+
layout (DistributedLayout, optional): Target layout. Defaults to input.layout.
|
| 77 |
+
|
| 78 |
+
Returns:
|
| 79 |
+
tensor: A tensor where every element is zero.
|
| 80 |
+
"""
|
| 81 |
+
return full_like(input, 0, shape=shape, dtype=dtype, layout=layout)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/__init__.py
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ._layouts import AMDMFMALayout, AMDWMMALayout
|
| 2 |
+
from . import cdna3, cdna4
|
| 3 |
+
from . import rdna3, rdna4
|
| 4 |
+
from . import gfx1250
|
| 5 |
+
|
| 6 |
+
__all__ = ["AMDMFMALayout", "AMDWMMALayout", "cdna3", "cdna4", "rdna3", "rdna4", "gfx1250"]
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/_layouts.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from dataclasses import dataclass, field
|
| 4 |
+
from typing import List, Optional
|
| 5 |
+
from triton.language.core import _unwrap_if_constexpr
|
| 6 |
+
|
| 7 |
+
from triton.experimental.gluon.language._layouts import DistributedLayout
|
| 8 |
+
|
| 9 |
+
__all__ = [
|
| 10 |
+
"AMDMFMALayout",
|
| 11 |
+
"AMDWMMALayout",
|
| 12 |
+
]
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@dataclass(frozen=True)
|
| 16 |
+
class AMDMFMALayout(DistributedLayout):
|
| 17 |
+
"""
|
| 18 |
+
Represents a layout for AMD MFMA (matrix core) operations.
|
| 19 |
+
|
| 20 |
+
Args:
|
| 21 |
+
version (int): The GPU architecture.
|
| 22 |
+
instr_shape (List[int]): The shape in the form of (M, N, K) of the matrix.
|
| 23 |
+
transposed (bool): Indicates the result tensor is transposed so that each thread holds consecutive elements in the same row instead of column, which is good for chained dot and global write.
|
| 24 |
+
warps_per_cta (List[int]): The warp layout in the block.
|
| 25 |
+
element_bitwidth Optional(int): Bit width of the output element type. Supported values are 32 and 64. Defaults to 32.
|
| 26 |
+
tiles_per_warp Optional(List[int]): The tile layout within a warp. Defaults to unit tile layout, i.e., single tile on all dimensions.
|
| 27 |
+
cga_layout (Optional[List[List[int]]]): Bases describing CTA tiling.
|
| 28 |
+
|
| 29 |
+
Current supported versions:
|
| 30 |
+
|
| 31 |
+
- 1: gfx908
|
| 32 |
+
- 2: gfx90a
|
| 33 |
+
- 3: gfx942
|
| 34 |
+
- 4: gfx950
|
| 35 |
+
"""
|
| 36 |
+
version: int
|
| 37 |
+
instr_shape: List[int]
|
| 38 |
+
transposed: bool
|
| 39 |
+
warps_per_cta: List[int]
|
| 40 |
+
element_bitwidth: Optional[int] = None
|
| 41 |
+
tiles_per_warp: Optional[List[int]] = None
|
| 42 |
+
cga_layout: List[List[int]] = field(default_factory=list)
|
| 43 |
+
|
| 44 |
+
def __post_init__(self):
|
| 45 |
+
super().__setattr__("version", _unwrap_if_constexpr(self.version))
|
| 46 |
+
super().__setattr__("instr_shape", _unwrap_if_constexpr(self.instr_shape))
|
| 47 |
+
super().__setattr__("transposed", _unwrap_if_constexpr(self.transposed))
|
| 48 |
+
super().__setattr__("warps_per_cta", _unwrap_if_constexpr(self.warps_per_cta))
|
| 49 |
+
super().__setattr__("element_bitwidth", _unwrap_if_constexpr(self.element_bitwidth))
|
| 50 |
+
super().__setattr__("tiles_per_warp", _unwrap_if_constexpr(self.tiles_per_warp))
|
| 51 |
+
|
| 52 |
+
if self.element_bitwidth is None:
|
| 53 |
+
object.__setattr__(self, "element_bitwidth", 32)
|
| 54 |
+
if self.tiles_per_warp is None:
|
| 55 |
+
object.__setattr__(self, "tiles_per_warp", [1] * len(self.warps_per_cta))
|
| 56 |
+
|
| 57 |
+
object.__setattr__(self, "cga_layout", self.cga_layout)
|
| 58 |
+
self.verify()
|
| 59 |
+
|
| 60 |
+
def _to_ir(self, builder):
|
| 61 |
+
return builder.get_amd_mfma_layout(
|
| 62 |
+
self.version,
|
| 63 |
+
self.warps_per_cta,
|
| 64 |
+
self.instr_shape,
|
| 65 |
+
self.transposed,
|
| 66 |
+
self.cga_layout,
|
| 67 |
+
self.tiles_per_warp,
|
| 68 |
+
self.element_bitwidth,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
def mangle(self) -> str:
|
| 72 |
+
|
| 73 |
+
def stringify(x):
|
| 74 |
+
if x is None:
|
| 75 |
+
return ""
|
| 76 |
+
return "_".join(map(str, x))
|
| 77 |
+
|
| 78 |
+
cga_layout = stringify(["~".join(map(str, vec)) for vec in self.cga_layout] if self.cga_layout else None)
|
| 79 |
+
return f"MFMA_{self.version}_{stringify(self.instr_shape)}_{self.transposed}_{stringify(self.warps_per_cta)}_{self.element_bitwidth}_{stringify(self.tiles_per_warp)}_{cga_layout}_MFMA"
|
| 80 |
+
|
| 81 |
+
def verify(self):
|
| 82 |
+
assert self.version >= 1 and self.version <= 4, "version must be in the [1, 4] range"
|
| 83 |
+
assert len(self.instr_shape) == 3, "instr_shape must follow the (M, N, K) format"
|
| 84 |
+
valid_shapes = [[32, 32], [16, 16], [64, 4], [4, 64]]
|
| 85 |
+
assert self.instr_shape[0:2] in valid_shapes, f"invalid intrinsic shape {self.instr_shape}"
|
| 86 |
+
assert self.element_bitwidth in [32, 64], "element bitwidth must be 32 or 64"
|
| 87 |
+
|
| 88 |
+
rank = len(self.warps_per_cta)
|
| 89 |
+
assert all(len(vec) == rank for vec in self.cga_layout), "cga_layout basis rank mismatch"
|
| 90 |
+
|
| 91 |
+
def __hash__(self):
|
| 92 |
+
return hash((
|
| 93 |
+
self.version,
|
| 94 |
+
tuple(self.instr_shape),
|
| 95 |
+
self.transposed,
|
| 96 |
+
tuple(self.warps_per_cta),
|
| 97 |
+
self.element_bitwidth if self.element_bitwidth else None,
|
| 98 |
+
tuple(self.tiles_per_warp) if self.tiles_per_warp else None,
|
| 99 |
+
tuple(tuple(vec) for vec in self.cga_layout),
|
| 100 |
+
))
|
| 101 |
+
|
| 102 |
+
@property
|
| 103 |
+
def rank(self):
|
| 104 |
+
return len(self.warps_per_cta)
|
| 105 |
+
|
| 106 |
+
|
| 107 |
+
@dataclass(frozen=True)
|
| 108 |
+
class AMDWMMALayout(DistributedLayout):
|
| 109 |
+
"""
|
| 110 |
+
Represents a layout for AMD WMMA (matrix core) operations.
|
| 111 |
+
|
| 112 |
+
Args:
|
| 113 |
+
version (int): Indicates the GPU architecture.
|
| 114 |
+
transposed (bool): Indicates the result tensor is transposed.
|
| 115 |
+
warps_per_cta (List[int]): Number of warps per CTA.
|
| 116 |
+
instr_shape (Optional[List[int]]): Instruction shape (M, N, K). Defaults to (16, 16, 16).
|
| 117 |
+
cga_layout (Optional[List[List[int]]]): Bases describing CTA tiling.
|
| 118 |
+
|
| 119 |
+
Current supported versions:
|
| 120 |
+
|
| 121 |
+
- 1: RDNA3; e.g., gfx1100, gfx1101
|
| 122 |
+
- 2: RDNA4; e.g., gfx1200, gfx1201
|
| 123 |
+
- 3: gfx1250
|
| 124 |
+
"""
|
| 125 |
+
version: int
|
| 126 |
+
transposed: bool
|
| 127 |
+
warps_per_cta: List[int]
|
| 128 |
+
instr_shape: Optional[List[int]] = None
|
| 129 |
+
tiles_per_warp: Optional[List[int]] = None
|
| 130 |
+
cga_layout: List[List[int]] = field(default_factory=list)
|
| 131 |
+
|
| 132 |
+
def __post_init__(self):
|
| 133 |
+
super().__setattr__("version", _unwrap_if_constexpr(self.version))
|
| 134 |
+
super().__setattr__("transposed", _unwrap_if_constexpr(self.transposed))
|
| 135 |
+
super().__setattr__("warps_per_cta", _unwrap_if_constexpr(self.warps_per_cta))
|
| 136 |
+
|
| 137 |
+
if self.tiles_per_warp is None:
|
| 138 |
+
tiles_per_warp = [1] * len(self.warps_per_cta)
|
| 139 |
+
else:
|
| 140 |
+
tiles_per_warp = _unwrap_if_constexpr(self.tiles_per_warp)
|
| 141 |
+
|
| 142 |
+
super().__setattr__("tiles_per_warp", tiles_per_warp)
|
| 143 |
+
|
| 144 |
+
instr_shape = _unwrap_if_constexpr(self.instr_shape) if self.instr_shape is not None else [16, 16, 16]
|
| 145 |
+
super().__setattr__("instr_shape", _unwrap_if_constexpr(instr_shape))
|
| 146 |
+
object.__setattr__(self, "cga_layout", self.cga_layout)
|
| 147 |
+
self.verify()
|
| 148 |
+
|
| 149 |
+
def _to_ir(self, builder):
|
| 150 |
+
return builder.get_amd_wmma_layout(
|
| 151 |
+
self.version,
|
| 152 |
+
self.transposed,
|
| 153 |
+
self.warps_per_cta,
|
| 154 |
+
self.tiles_per_warp,
|
| 155 |
+
self.cga_layout,
|
| 156 |
+
self.instr_shape,
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
def mangle(self) -> str:
|
| 160 |
+
|
| 161 |
+
def stringify(x):
|
| 162 |
+
if x is None:
|
| 163 |
+
return ""
|
| 164 |
+
return "_".join(map(str, x))
|
| 165 |
+
|
| 166 |
+
cga_layout = stringify(["~".join(map(str, vec)) for vec in self.cga_layout] if self.cga_layout else None)
|
| 167 |
+
return f"WMMA_{self.version}_{self.transposed}_{stringify(self.warps_per_cta)}_{stringify(self.tiles_per_warp)}_{stringify(self.instr_shape)}_{cga_layout}_WMMA"
|
| 168 |
+
|
| 169 |
+
def verify(self):
|
| 170 |
+
assert self.version >= 1 and self.version <= 3, "version must be in the [1, 3] range"
|
| 171 |
+
|
| 172 |
+
rank = len(self.warps_per_cta)
|
| 173 |
+
assert all(len(vec) == rank for vec in self.cga_layout), "cga_layout basis rank mismatch"
|
| 174 |
+
|
| 175 |
+
def __hash__(self):
|
| 176 |
+
return hash((
|
| 177 |
+
self.version,
|
| 178 |
+
self.transposed,
|
| 179 |
+
tuple(self.warps_per_cta),
|
| 180 |
+
tuple(self.tiles_per_warp) if self.tiles_per_warp else None,
|
| 181 |
+
tuple(self.instr_shape) if self.instr_shape else None,
|
| 182 |
+
tuple(tuple(vec) for vec in self.cga_layout),
|
| 183 |
+
))
|
| 184 |
+
|
| 185 |
+
@property
|
| 186 |
+
def rank(self):
|
| 187 |
+
return len(self.warps_per_cta)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/_ops.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import math
|
| 2 |
+
|
| 3 |
+
from triton import knobs
|
| 4 |
+
from triton.experimental.gluon.language import _core as ttgl
|
| 5 |
+
from triton.experimental.gluon.language._semantic import _check
|
| 6 |
+
|
| 7 |
+
from .._core import _unwrap_if_constexpr
|
| 8 |
+
from .._layouts import DotOperandLayout
|
| 9 |
+
from ._layouts import AMDWMMALayout
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def _verify_wmma(version, a, b, acc):
|
| 13 |
+
_check(acc is not None, lambda: "acc is required")
|
| 14 |
+
|
| 15 |
+
layout = acc.type.layout
|
| 16 |
+
_check(
|
| 17 |
+
isinstance(layout, AMDWMMALayout) and layout.version == version,
|
| 18 |
+
lambda: f"Expected layout to be an instance of AMDWMMALayout with version {version}")
|
| 19 |
+
|
| 20 |
+
a_layout = a.type.layout
|
| 21 |
+
_check(
|
| 22 |
+
isinstance(a_layout, DotOperandLayout) and isinstance(a_layout.parent, AMDWMMALayout)
|
| 23 |
+
and a_layout.parent.version == version,
|
| 24 |
+
lambda: "Expected a's layout to be a DotOperandLayout with parent matching AMDWMMALayout")
|
| 25 |
+
|
| 26 |
+
b_layout = b.type.layout
|
| 27 |
+
_check(
|
| 28 |
+
isinstance(b_layout, DotOperandLayout) and isinstance(b_layout.parent, AMDWMMALayout)
|
| 29 |
+
and b_layout.parent.version == version,
|
| 30 |
+
lambda: "Expected b's layout to be a DotOperandLayout with parent matching AMDWMMALayout")
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def _wmma(version, a, b, acc, semantic):
|
| 34 |
+
""" Shared implementation for AMD WMMA operations for Gluon builtins """
|
| 35 |
+
_verify_wmma(version, a, b, acc)
|
| 36 |
+
|
| 37 |
+
handle = semantic.dot(a, b, acc, input_precision=knobs.language.fp32_default, max_num_imprecise_acc=None,
|
| 38 |
+
out_dtype=acc.dtype).handle
|
| 39 |
+
return ttgl.tensor(handle, acc.type)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def _mma_scaled(a, a_scale, a_format, b, b_scale, b_format, acc, scale_fn, semantic):
|
| 43 |
+
""" Shared implementation for AMD WMMA scaled and MFMA scaled operation. """
|
| 44 |
+
|
| 45 |
+
def _get_scale_shape(op_idx, operand, format):
|
| 46 |
+
operand_shape = [s for s in operand.type.shape]
|
| 47 |
+
scale_shape = operand_shape
|
| 48 |
+
unpack_factor = 2 if format.value == "e2m1" else 1
|
| 49 |
+
if op_idx == 0:
|
| 50 |
+
k = scale_shape[-1] * unpack_factor
|
| 51 |
+
scale_shape[-1] = k // 32
|
| 52 |
+
else:
|
| 53 |
+
k = scale_shape[-2] * unpack_factor
|
| 54 |
+
scale_shape[-2] = k // 32
|
| 55 |
+
scale_shape[-2], scale_shape[-1] = scale_shape[-1], scale_shape[-2]
|
| 56 |
+
return scale_shape
|
| 57 |
+
|
| 58 |
+
def _create_and_broadcast_default_scale(op_idx, scale, format):
|
| 59 |
+
operand = a if op_idx == 0 else b
|
| 60 |
+
|
| 61 |
+
scale_shape = _get_scale_shape(op_idx, operand, format)
|
| 62 |
+
if isinstance(scale, ttgl.tensor) and scale.numel.value != 1:
|
| 63 |
+
# In the case of scale pre-shuffling, the input shape is different from the default shape. We only check
|
| 64 |
+
# the number of elements here.
|
| 65 |
+
assert math.prod(scale_shape) == scale.numel.value, "Incompatible scale shape"
|
| 66 |
+
return scale
|
| 67 |
+
|
| 68 |
+
scale_layout = scale_fn(operand.type.layout, scale_shape)
|
| 69 |
+
scale_value = _unwrap_if_constexpr(scale)
|
| 70 |
+
scale_value = 0x7F if scale_value is None else scale_value
|
| 71 |
+
return semantic.full(scale_shape, scale_value, ttgl.uint8, scale_layout)
|
| 72 |
+
|
| 73 |
+
a_scale = _create_and_broadcast_default_scale(0, a_scale, a_format)
|
| 74 |
+
b_scale = _create_and_broadcast_default_scale(1, b_scale, b_format)
|
| 75 |
+
output = semantic.dot_scaled(a, a_scale, a_format, b, b_scale, b_format, acc, fast_math=False, lhs_k_pack=True,
|
| 76 |
+
rhs_k_pack=True, out_dtype=ttgl.float32)
|
| 77 |
+
return ttgl.tensor(output.handle, acc.type)
|
miniconda3/envs/ladir/lib/python3.10/site-packages/triton/experimental/gluon/language/amd/cdna3/__init__.py
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
from typing import TYPE_CHECKING
|
| 3 |
+
|
| 4 |
+
from triton import knobs
|
| 5 |
+
from triton.experimental.gluon.language import _core as ttgl
|
| 6 |
+
from triton._C.libtriton import ir
|
| 7 |
+
from ..._core import builtin, _unwrap_if_constexpr
|
| 8 |
+
|
| 9 |
+
if TYPE_CHECKING:
|
| 10 |
+
from ..._semantic import GluonSemantic
|
| 11 |
+
|
| 12 |
+
__all__ = [
|
| 13 |
+
"buffer_atomic_add", "buffer_atomic_and", "buffer_atomic_min", "buffer_atomic_max", "buffer_atomic_or",
|
| 14 |
+
"buffer_atomic_xor", "buffer_atomic_xor", "buffer_load", "buffer_store", "mfma"
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
_atomic_op_str_to_op = {
|
| 18 |
+
"smax": ir.ATOMIC_OP.MAX, "smin": ir.ATOMIC_OP.MIN, "umax": ir.ATOMIC_OP.UMAX, "umin": ir.ATOMIC_OP.UMIN, "fadd":
|
| 19 |
+
ir.ATOMIC_OP.FADD, "iadd": ir.ATOMIC_OP.ADD, "and": ir.ATOMIC_OP.AND, "or": ir.ATOMIC_OP.OR, "xor":
|
| 20 |
+
ir.ATOMIC_OP.XOR, "xchg": ir.ATOMIC_OP.XCHG
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def _verify_buffer_ops(ptr, offsets, mask=None, other=None):
|
| 25 |
+
assert ptr.type.is_ptr(), "ptr must be a scalar pointer type"
|
| 26 |
+
|
| 27 |
+
assert isinstance(offsets.type, ttgl.distributed_type), "expected offsets type to be a distributed_type"
|
| 28 |
+
assert offsets.dtype.is_int32() or offsets.dtype.is_uint32(), "offsets element type must be int32 or uint32"
|
| 29 |
+
|
| 30 |
+
if other is not None:
|
| 31 |
+
assert mask is not None, "when other is not None, mask should not be None"
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def _verify_element_type_and_dispatch_op(op, elem_type, arch):
|
| 35 |
+
supported_types = [
|
| 36 |
+
ttgl.float16, ttgl.float32, ttgl.bfloat16, ttgl.float64, ttgl.int32, ttgl.int64, ttgl.uint32, ttgl.uint64
|
| 37 |
+
]
|
| 38 |
+
assert elem_type in supported_types, f"{elem_type} is not supported in buffer atomic on {arch}."
|
| 39 |
+
|
| 40 |
+
if op in ['and', 'or', 'xor', 'xchg']:
|
| 41 |
+
assert elem_type in [ttgl.int32, ttgl.int64], f"{op} with {elem_type} is not supported on CDNA3 or CDNA4"
|
| 42 |
+
return _atomic_op_str_to_op[_unwrap_if_constexpr(op)]
|
| 43 |
+
|
| 44 |
+
if op in ['max', 'min']:
|
| 45 |
+
if elem_type in [ttgl.int32, ttgl.int64, ttgl.float64]:
|
| 46 |
+
op = 's' + op
|
| 47 |
+
return _atomic_op_str_to_op[_unwrap_if_constexpr(op)]
|
| 48 |
+
elif elem_type in [ttgl.uint32, ttgl.uint64]:
|
| 49 |
+
op = 'u' + op
|
| 50 |
+
return _atomic_op_str_to_op[_unwrap_if_constexpr(op)]
|
| 51 |
+
else:
|
| 52 |
+
raise ValueError(f"{op} with {elem_type} is not supported on CDNA3 and CDNA4")
|
| 53 |
+
|
| 54 |
+
if op == 'add':
|
| 55 |
+
if elem_type in [ttgl.uint32, ttgl.uint64]:
|
| 56 |
+
op = 'i' + op
|
| 57 |
+
return _atomic_op_str_to_op[_unwrap_if_constexpr(op)]
|
| 58 |
+
elif elem_type in [ttgl.float16, ttgl.float32, ttgl.float64]:
|
| 59 |
+
op = 'f' + op
|
| 60 |
+
return _atomic_op_str_to_op[_unwrap_if_constexpr(op)]
|
| 61 |
+
elif elem_type is ttgl.bfloat16:
|
| 62 |
+
assert arch == "cdna4", "Buffer atomic fadd with bf16 is only supported on CDNA4 for now."
|
| 63 |
+
op = 'f' + op
|
| 64 |
+
return _atomic_op_str_to_op[_unwrap_if_constexpr(op)]
|
| 65 |
+
else:
|
| 66 |
+
raise ValueError(f"{op} with {elem_type} is not supported on CDNA3 and CDNA4")
|
| 67 |
+
|
| 68 |
+
raise ValueError(f"Unknown {op} on CDNA3 or CDNA4")
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
def _buffer_atomic_rmw_impl(op, ptr, offsets, value, arch, mask, sem, scope, _semantic):
|
| 72 |
+
_verify_buffer_ops(ptr, offsets, mask)
|
| 73 |
+
|
| 74 |
+
op = _verify_element_type_and_dispatch_op(op, ptr.type.scalar.element_ty, arch)
|
| 75 |
+
|
| 76 |
+
mask = _unwrap_if_constexpr(mask)
|
| 77 |
+
if mask is not None:
|
| 78 |
+
mask = _semantic.to_tensor(mask)
|
| 79 |
+
mask = _semantic.cast(mask, ttgl.int1)
|
| 80 |
+
_, mask = _semantic.broadcast_impl_value(offsets, mask)
|
| 81 |
+
mask = mask.handle if mask is not None else ir.value()
|
| 82 |
+
|
| 83 |
+
value = _unwrap_if_constexpr(value)
|
| 84 |
+
value = _semantic.to_tensor(value)
|
| 85 |
+
_, value = _semantic.broadcast_impl_value(offsets, value)
|
| 86 |
+
|
| 87 |
+
sem = _semantic._str_to_sem(sem)
|
| 88 |
+
scope = _semantic._str_to_scope(scope)
|
| 89 |
+
return _semantic.tensor(
|
| 90 |
+
_semantic.builder.create_buffer_atomic_rmw(op, ptr.handle, offsets.handle, value.handle, sem, scope, mask),
|
| 91 |
+
value.type)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
@builtin
|
| 95 |
+
def buffer_load(ptr, offsets, mask=None, other=None, cache=None, _semantic=None):
|
| 96 |
+
"""
|
| 97 |
+
AMD buffer load from global memory via a scalar base pointer and a tensor of
|
| 98 |
+
offsets instead of a tensor of pointers. This operation will load data
|
| 99 |
+
directly into registers.
|
| 100 |
+
|
| 101 |
+
Args:
|
| 102 |
+
ptr (pointer to scalar): Global memory scalar base pointer to load from.
|
| 103 |
+
offsets (tensor): Offsets tensor for the load operation.
|
| 104 |
+
mask (tensor, optional): Mask tensor for predicated loads. Defaults to None.
|
| 105 |
+
other (tensor or scalar, optional): Tensor or scalar providing default values for masked elements. Defaults to None.
|
| 106 |
+
cache_modifier (str): Cache modifier specifier. Defaults to "".
|
| 107 |
+
"""
|
| 108 |
+
_verify_buffer_ops(ptr, offsets, mask, other)
|
| 109 |
+
|
| 110 |
+
mask = _unwrap_if_constexpr(mask)
|
| 111 |
+
if mask is not None:
|
| 112 |
+
offsets, mask = _semantic.broadcast_impl_value(offsets, mask)
|
| 113 |
+
|
| 114 |
+
other = _unwrap_if_constexpr(other)
|
| 115 |
+
if other is not None:
|
| 116 |
+
other = _semantic.to_tensor(other)
|
| 117 |
+
other = _semantic.cast(other, ptr.dtype.element_ty)
|
| 118 |
+
offsets, other = _semantic.broadcast_impl_value(offsets, other)
|
| 119 |
+
|
| 120 |
+
other = other.handle if other is not None else ir.value()
|
| 121 |
+
mask = mask.handle if mask is not None else ir.value()
|
| 122 |
+
cache_modifier = _semantic._str_to_load_cache_modifier(cache) if cache is not None else ir.CACHE_MODIFIER.NONE
|
| 123 |
+
|
| 124 |
+
ret_ty = offsets.type.with_element_ty(ptr.type.scalar.element_ty)
|
| 125 |
+
builder = _semantic.builder
|
| 126 |
+
handle = builder.create_buffer_load(ret_ty.to_ir(builder), ptr.handle, offsets.handle, mask, other, cache_modifier)
|
| 127 |
+
return ttgl.tensor(handle, ret_ty)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
@builtin
|
| 131 |
+
def buffer_store(stored_value, ptr, offsets, mask=None, cache=None, _semantic: GluonSemantic = None):
|
| 132 |
+
"""
|
| 133 |
+
AMD buffer store a tensor directly to global memory via a scalar base pointer and a tensor of
|
| 134 |
+
offsets instead of a tensor of pointers.
|
| 135 |
+
Args:
|
| 136 |
+
stored_value (tensor to be stored): The tensor to be stored to global memory.
|
| 137 |
+
ptr (pointer to scalar): Global memory scalar base pointer to store to.
|
| 138 |
+
offsets (tensor): Offsets tensor for the store operation.
|
| 139 |
+
mask (tensor, optional): Mask tensor for predicated store. Defaults to None.
|
| 140 |
+
cache_modifier (str): Cache modifier specifier. Defaults to "".
|
| 141 |
+
"""
|
| 142 |
+
_verify_buffer_ops(ptr, offsets, mask)
|
| 143 |
+
|
| 144 |
+
if mask is not None:
|
| 145 |
+
offsets, mask = _semantic.broadcast_impl_value(offsets, mask)
|
| 146 |
+
|
| 147 |
+
mask = mask.handle if mask is not None else ir.value()
|
| 148 |
+
cache_modifier = _semantic._str_to_store_cache_modifier(cache) if cache is not None else ir.CACHE_MODIFIER.NONE
|
| 149 |
+
|
| 150 |
+
_semantic.builder.create_buffer_store(stored_value.handle, ptr.handle, offsets.handle, mask, cache_modifier)
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
@builtin
|
| 154 |
+
def mfma(a, b, acc, _semantic: GluonSemantic = None):
|
| 155 |
+
"""
|
| 156 |
+
Computes matrix-multiplication of a * b + acc using AMD native matrix core units.
|
| 157 |
+
Args:
|
| 158 |
+
a (tensor): The first operand of mfma.
|
| 159 |
+
b (tensor): The second operand of mfma.
|
| 160 |
+
acc (tensor): The accumulator tensor.
|
| 161 |
+
"""
|
| 162 |
+
assert acc is not None, "acc is required"
|
| 163 |
+
ret_type = acc.type
|
| 164 |
+
acc = ttgl._unwrap_if_constexpr(acc)
|
| 165 |
+
|
| 166 |
+
handle = _semantic.dot(a, b, acc, input_precision=knobs.language.fp32_default, max_num_imprecise_acc=None,
|
| 167 |
+
out_dtype=acc.dtype).handle
|
| 168 |
+
return ttgl.tensor(handle, ret_type)
|
| 169 |
+
|
| 170 |
+
|
| 171 |
+
"""
|
| 172 |
+
AMD Buffer Atomic RMW operations.
|
| 173 |
+
The supported operatios are max, min, add, and, or, xor, xchg.
|
| 174 |
+
Similar to normal atomic ops: it loads data at ptr plus offsets, do `op` with `value`, and store result to `ptr` plus `offsets` with
|
| 175 |
+
the specified memory semantics and scope.
|
| 176 |
+
|
| 177 |
+
Buffer atomics access global memory via a scalar base pointer and a tensor of offsets instead of a tensor of pointers.
|
| 178 |
+
Similar to other buffer ops, the `mask` is a boolean vector that determines if a given element should be processed with
|
| 179 |
+
the atomic RMW op. Elements with `mask[i] == 0` are dropped (i.e., the atomic is not executed).
|
| 180 |
+
|
| 181 |
+
Buffer Atomic RMW ops return the pre-op value in the global memory.
|
| 182 |
+
|
| 183 |
+
Args:
|
| 184 |
+
ptr (pointer to scalar): Global memory scalar base pointer to load from.
|
| 185 |
+
offsets (tensor): Offsets tensor for the load operation.
|
| 186 |
+
value (tensor): Another operand of `op`.
|
| 187 |
+
mask (tensor, optional): Mask tensor for predicated loads. Defaults to None.
|
| 188 |
+
sem (str, optional): Memory Semantic Descriptor. Default is None which means acq_rel memory semantic.
|
| 189 |
+
scope (str, optional): Memory Sync Scope for atomic accesses. Default is None and it will be mapped to `gpu`, which is called `agent` for AMDGPU. Please ref https://llvm.org/docs/AMDGPUUsage.html#memory-model-gfx942 for details.
|
| 190 |
+
"""
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
@builtin
|
| 194 |
+
def buffer_atomic_max(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 195 |
+
return _buffer_atomic_rmw_impl('max', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 196 |
+
_semantic=_semantic)
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
@builtin
|
| 200 |
+
def buffer_atomic_min(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 201 |
+
|
| 202 |
+
return _buffer_atomic_rmw_impl('min', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 203 |
+
_semantic=_semantic)
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
@builtin
|
| 207 |
+
def buffer_atomic_add(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 208 |
+
|
| 209 |
+
return _buffer_atomic_rmw_impl('add', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 210 |
+
_semantic=_semantic)
|
| 211 |
+
|
| 212 |
+
|
| 213 |
+
@builtin
|
| 214 |
+
def buffer_atomic_and(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 215 |
+
|
| 216 |
+
return _buffer_atomic_rmw_impl('and', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 217 |
+
_semantic=_semantic)
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
@builtin
|
| 221 |
+
def buffer_atomic_or(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 222 |
+
|
| 223 |
+
return _buffer_atomic_rmw_impl('or', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 224 |
+
_semantic=_semantic)
|
| 225 |
+
|
| 226 |
+
|
| 227 |
+
@builtin
|
| 228 |
+
def buffer_atomic_xor(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 229 |
+
|
| 230 |
+
return _buffer_atomic_rmw_impl('xor', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 231 |
+
_semantic=_semantic)
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
@builtin
|
| 235 |
+
def buffer_atomic_xchg(ptr, offsets, value, mask=None, sem=None, scope=None, _semantic=None):
|
| 236 |
+
|
| 237 |
+
return _buffer_atomic_rmw_impl('xchg', ptr, offsets, value, "cdna3", mask=mask, sem=sem, scope=scope,
|
| 238 |
+
_semantic=_semantic)
|