gafime-rocm 0.4.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gafime_rocm-0.4.7/MANIFEST.in +7 -0
- gafime_rocm-0.4.7/PKG-INFO +20 -0
- gafime_rocm-0.4.7/README.md +7 -0
- gafime_rocm-0.4.7/gafime/_dummy.c +11 -0
- gafime_rocm-0.4.7/gafime_rocm/__init__.py +19 -0
- gafime_rocm-0.4.7/gafime_rocm.egg-info/PKG-INFO +20 -0
- gafime_rocm-0.4.7/gafime_rocm.egg-info/SOURCES.txt +14 -0
- gafime_rocm-0.4.7/gafime_rocm.egg-info/dependency_links.txt +1 -0
- gafime_rocm-0.4.7/gafime_rocm.egg-info/requires.txt +1 -0
- gafime_rocm-0.4.7/gafime_rocm.egg-info/top_level.txt +1 -0
- gafime_rocm-0.4.7/pyproject.toml +3 -0
- gafime_rocm-0.4.7/setup.cfg +4 -0
- gafime_rocm-0.4.7/setup.py +159 -0
- gafime_rocm-0.4.7/src/common/interfaces.h +665 -0
- gafime_rocm-0.4.7/src/rocm/kernels.hip +2765 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gafime-rocm
|
|
3
|
+
Version: 0.4.7
|
|
4
|
+
Summary: AMD ROCm/HIP runtime payload for GAFIME
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: gafime==0.4.7
|
|
8
|
+
Dynamic: description
|
|
9
|
+
Dynamic: description-content-type
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
Dynamic: summary
|
|
13
|
+
|
|
14
|
+
# gafime-rocm
|
|
15
|
+
|
|
16
|
+
Vendor GPU runtime payload for GAFIME 0.4.7.
|
|
17
|
+
|
|
18
|
+
This package is generated from the GAFIME source tree during CI and carries
|
|
19
|
+
only the ROCM native runtime payload. Install the base package
|
|
20
|
+
with `gafime`; use this package only for the matching GPU runtime.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# gafime-rocm
|
|
2
|
+
|
|
3
|
+
Vendor GPU runtime payload for GAFIME 0.4.7.
|
|
4
|
+
|
|
5
|
+
This package is generated from the GAFIME source tree during CI and carries
|
|
6
|
+
only the ROCM native runtime payload. Install the base package
|
|
7
|
+
with `gafime`; use this package only for the matching GPU runtime.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#include <Python.h>
|
|
2
|
+
static struct PyModuleDef dummy_module = {
|
|
3
|
+
PyModuleDef_HEAD_INIT,
|
|
4
|
+
"_native",
|
|
5
|
+
"Dummy extension block",
|
|
6
|
+
-1,
|
|
7
|
+
NULL, NULL, NULL, NULL, NULL
|
|
8
|
+
};
|
|
9
|
+
PyMODINIT_FUNC PyInit__native(void) {
|
|
10
|
+
return PyModule_Create(&dummy_module);
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
__version__ = "0.4.7"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def package_dir() -> Path:
|
|
9
|
+
return Path(__file__).resolve().parent
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def library_candidates() -> list[Path]:
|
|
13
|
+
base = package_dir()
|
|
14
|
+
return [
|
|
15
|
+
base / "gafime_rocm.dll",
|
|
16
|
+
base / "libgafime_rocm.so",
|
|
17
|
+
base / "gafime_rocm.so",
|
|
18
|
+
base / "gafime_rocm.pyd",
|
|
19
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gafime-rocm
|
|
3
|
+
Version: 0.4.7
|
|
4
|
+
Summary: AMD ROCm/HIP runtime payload for GAFIME
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: gafime==0.4.7
|
|
8
|
+
Dynamic: description
|
|
9
|
+
Dynamic: description-content-type
|
|
10
|
+
Dynamic: requires-dist
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
Dynamic: summary
|
|
13
|
+
|
|
14
|
+
# gafime-rocm
|
|
15
|
+
|
|
16
|
+
Vendor GPU runtime payload for GAFIME 0.4.7.
|
|
17
|
+
|
|
18
|
+
This package is generated from the GAFIME source tree during CI and carries
|
|
19
|
+
only the ROCM native runtime payload. Install the base package
|
|
20
|
+
with `gafime`; use this package only for the matching GPU runtime.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
MANIFEST.in
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
/home/runner/work/GAFIME/GAFIME/payload-src/gafime-rocm/gafime/_dummy.c
|
|
6
|
+
gafime/_dummy.c
|
|
7
|
+
gafime_rocm/__init__.py
|
|
8
|
+
gafime_rocm.egg-info/PKG-INFO
|
|
9
|
+
gafime_rocm.egg-info/SOURCES.txt
|
|
10
|
+
gafime_rocm.egg-info/dependency_links.txt
|
|
11
|
+
gafime_rocm.egg-info/requires.txt
|
|
12
|
+
gafime_rocm.egg-info/top_level.txt
|
|
13
|
+
src/common/interfaces.h
|
|
14
|
+
src/rocm/kernels.hip
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gafime==0.4.7
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gafime_rocm
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import platform
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from setuptools import Extension, setup
|
|
11
|
+
from setuptools.command.build_ext import build_ext
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
VERSION = "0.4.7"
|
|
15
|
+
ROOT = Path(__file__).resolve().parent
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class RocmPayloadBuildExt(build_ext):
|
|
19
|
+
def run(self):
|
|
20
|
+
package_dir = Path(self.build_lib) / "gafime_rocm"
|
|
21
|
+
package_dir.mkdir(parents=True, exist_ok=True)
|
|
22
|
+
self.output_dir = package_dir
|
|
23
|
+
self.build_rocm_backend()
|
|
24
|
+
super().run()
|
|
25
|
+
|
|
26
|
+
def build_rocm_backend(self) -> None:
|
|
27
|
+
if sys.platform not in {"linux", "win32"}:
|
|
28
|
+
raise RuntimeError("gafime-rocm currently supports Linux/Windows x86_64 targets.")
|
|
29
|
+
machine = platform.machine().lower()
|
|
30
|
+
if machine in {"aarch64", "arm64"} or machine.startswith("arm"):
|
|
31
|
+
raise RuntimeError(f"gafime-rocm does not support ARM target {platform.machine()}.")
|
|
32
|
+
|
|
33
|
+
hipcc = shutil.which("hipcc")
|
|
34
|
+
if not hipcc:
|
|
35
|
+
raise RuntimeError("hipcc was not found. Install ROCm/HIP to build gafime-rocm.")
|
|
36
|
+
|
|
37
|
+
src_dir = ROOT / "src"
|
|
38
|
+
rocm_source = src_dir / "rocm" / "kernels.hip"
|
|
39
|
+
output_file = self.output_dir / ("gafime_rocm.dll" if sys.platform == "win32" else "libgafime_rocm.so")
|
|
40
|
+
arch_env = os.environ.get("GAFIME_ROCM_ARCHS")
|
|
41
|
+
if arch_env:
|
|
42
|
+
arch_mode = arch_env.strip().lower().replace("_", "-")
|
|
43
|
+
if arch_mode in {"release", "package", "wheel", "release-wheel"}:
|
|
44
|
+
archs = self._windows_release_rocm_archs() if sys.platform == "win32" else self._linux_release_rocm_archs()
|
|
45
|
+
elif arch_mode in {"linux-release", "linux-wheel"}:
|
|
46
|
+
archs = self._linux_release_rocm_archs()
|
|
47
|
+
elif arch_mode in {"windows-release", "windows-wheel"}:
|
|
48
|
+
archs = self._windows_release_rocm_archs()
|
|
49
|
+
else:
|
|
50
|
+
archs = [arch.strip() for arch in arch_env.replace(";", ",").replace(" ", ",").split(",") if arch.strip()]
|
|
51
|
+
else:
|
|
52
|
+
archs = self._detect_rocm_archs()
|
|
53
|
+
if not archs:
|
|
54
|
+
raise RuntimeError(
|
|
55
|
+
"Unable to detect ROCm/HIP offload architecture. "
|
|
56
|
+
"Set GAFIME_ROCM_ARCHS explicitly, for example GAFIME_ROCM_ARCHS=<rocm-offload-target>."
|
|
57
|
+
)
|
|
58
|
+
arch_flags = [f"--offload-arch={arch}" for arch in archs]
|
|
59
|
+
|
|
60
|
+
cmd = [
|
|
61
|
+
hipcc,
|
|
62
|
+
*arch_flags,
|
|
63
|
+
"-O3",
|
|
64
|
+
"--shared",
|
|
65
|
+
"-Wno-unused-result",
|
|
66
|
+
"-DGAFIME_BUILDING_DLL",
|
|
67
|
+
"-I",
|
|
68
|
+
str(src_dir / "common"),
|
|
69
|
+
"-o",
|
|
70
|
+
str(output_file),
|
|
71
|
+
str(rocm_source),
|
|
72
|
+
]
|
|
73
|
+
if sys.platform != "win32":
|
|
74
|
+
cmd.insert(cmd.index("-Wno-unused-result"), "-fPIC")
|
|
75
|
+
result = subprocess.run(cmd, capture_output=True, text=True)
|
|
76
|
+
if result.returncode != 0:
|
|
77
|
+
raise RuntimeError(f"ROCm/HIP build failed\nSTDOUT:\n{result.stdout}\nSTDERR:\n{result.stderr}")
|
|
78
|
+
|
|
79
|
+
@staticmethod
|
|
80
|
+
def _linux_release_rocm_archs() -> list[str]:
|
|
81
|
+
# ROCm does not provide a single NVIDIA-PTX-like forward-compatible
|
|
82
|
+
# code object for every AMD GPU. Release wheels therefore carry a
|
|
83
|
+
# package-policy target set covering current ROCm 7.x client, APU, and
|
|
84
|
+
# datacenter families instead of baking in one developer machine target.
|
|
85
|
+
return [
|
|
86
|
+
"gfx90a",
|
|
87
|
+
"gfx942",
|
|
88
|
+
"gfx950",
|
|
89
|
+
"gfx1030",
|
|
90
|
+
"gfx1031",
|
|
91
|
+
"gfx1032",
|
|
92
|
+
"gfx1100",
|
|
93
|
+
"gfx1101",
|
|
94
|
+
"gfx1102",
|
|
95
|
+
"gfx1150",
|
|
96
|
+
"gfx1151",
|
|
97
|
+
"gfx1200",
|
|
98
|
+
"gfx1201",
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
@staticmethod
|
|
102
|
+
def _windows_release_rocm_archs() -> list[str]:
|
|
103
|
+
# Windows HIP SDK publishes a narrower officially supported set than
|
|
104
|
+
# Linux ROCm. Keep this list aligned with AMD's Windows HIP SDK support
|
|
105
|
+
# table so CI does not feed datacenter/Linux-only code objects to the
|
|
106
|
+
# Windows installer toolchain.
|
|
107
|
+
return [
|
|
108
|
+
"gfx1030",
|
|
109
|
+
"gfx1031",
|
|
110
|
+
"gfx1032",
|
|
111
|
+
"gfx1100",
|
|
112
|
+
"gfx1101",
|
|
113
|
+
"gfx1102",
|
|
114
|
+
"gfx1151",
|
|
115
|
+
"gfx1200",
|
|
116
|
+
"gfx1201",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
@staticmethod
|
|
120
|
+
def _detect_rocm_archs() -> list[str]:
|
|
121
|
+
enumerator = shutil.which("rocm_agent_enumerator")
|
|
122
|
+
if enumerator:
|
|
123
|
+
try:
|
|
124
|
+
result = subprocess.run([enumerator], capture_output=True, text=True, check=False, timeout=10)
|
|
125
|
+
archs: list[str] = []
|
|
126
|
+
for line in result.stdout.splitlines():
|
|
127
|
+
arch = line.strip()
|
|
128
|
+
if arch.startswith("gfx") and arch not in archs:
|
|
129
|
+
archs.append(arch)
|
|
130
|
+
if archs:
|
|
131
|
+
return archs
|
|
132
|
+
except Exception:
|
|
133
|
+
pass
|
|
134
|
+
return []
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
setup_kwargs = dict(
|
|
138
|
+
name="gafime-rocm",
|
|
139
|
+
version=VERSION,
|
|
140
|
+
description="AMD ROCm/HIP runtime payload for GAFIME",
|
|
141
|
+
long_description=(ROOT / "README.md").read_text(encoding="utf-8"),
|
|
142
|
+
long_description_content_type="text/markdown",
|
|
143
|
+
packages=["gafime_rocm"],
|
|
144
|
+
package_data={"gafime_rocm": ["*.so", "*.dll", "*.pyd"]},
|
|
145
|
+
include_package_data=False,
|
|
146
|
+
install_requires=[f"gafime=={VERSION}"],
|
|
147
|
+
python_requires=">=3.10",
|
|
148
|
+
ext_modules=[Extension("gafime_rocm._native", sources=[str(ROOT / "gafime" / "_dummy.c")])],
|
|
149
|
+
cmdclass={"build_ext": RocmPayloadBuildExt},
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
if sys.platform == "linux":
|
|
153
|
+
setup_kwargs["options"] = {
|
|
154
|
+
"bdist_wheel": {
|
|
155
|
+
"plat_name": os.environ.get("GAFIME_ROCM_PLAT_NAME", "manylinux_2_28_x86_64")
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
setup(**setup_kwargs)
|