Skip to content

Kyojin: open-source engine that runs 100 GB-class open models (GLM-5.3, Qwen3.8, DeepSeek V4.1) on one desktop machine. AMD Strix Halo, NVIDIA RTX and Apple Mac. OpenAI API, built on ExLlamaV3.

Ship the .hip kernels and gr_mix_hip inside the installed package

YanissAmz12a017add2fa
diff --git a/exllamav3/modules/gr_fn/__init__.py b/exllamav3/modules/gr_fn/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/gr/gr_mix.hip b/exllamav3/modules/gr_fn/gr_mix.hip
similarity index 100%
rename from gr/gr_mix.hip
rename to exllamav3/modules/gr_fn/gr_mix.hip
diff --git a/gr/gr_mix_hip.py b/exllamav3/modules/gr_fn/gr_mix_hip.py
similarity index 100%
rename from gr/gr_mix_hip.py
rename to exllamav3/modules/gr_fn/gr_mix_hip.py
diff --git a/exllamav3/modules/hyperconnections.py b/exllamav3/modules/hyperconnections.py
index cd32fdb..699e796 100644
--- a/exllamav3/modules/hyperconnections.py
+++ b/exllamav3/modules/hyperconnections.py
@@ -472,13 +472,10 @@ _gr_hip_mod = []
def _gr_hip():
- # hand-written HIP WMMA gated-residual GEMMs (gr/gr_mix_hip.py), opt-in with EXL3_GR_HIP=1; None on failure
+ # hand-written HIP WMMA gated-residual GEMMs (modules/gr_fn/gr_mix_hip.py), opt-in with EXL3_GR_HIP=1; None on failure
if not _gr_hip_mod:
try:
- import sys
- d = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))), "gr")
- if d not in sys.path: sys.path.insert(0, d)
- import gr_mix_hip
+ from exllamav3.modules.gr_fn import gr_mix_hip
_gr_hip_mod.append(gr_mix_hip)
except Exception as e:
print(f" ! EXL3_GR_HIP unavailable: {e}")
diff --git a/pyproject.toml b/pyproject.toml
index 60cb996..b4e5b92 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -87,6 +87,7 @@ exllamav3 = [
"util/hadamard_data/*",
"conversion/standard_cal_data/*.utf8",
"exllamav3_ext/**/*",
+ "**/*.hip",
]
[tool.setuptools.dynamic]
diff --git a/tests/test_hip_compiler_cpu.py b/tests/test_hip_compiler_cpu.py
index 3892603..81c0d6a 100644
--- a/tests/test_hip_compiler_cpu.py
+++ b/tests/test_hip_compiler_cpu.py
@@ -7,7 +7,7 @@ import pytest
ROOT = Path(__file__).resolve().parent.parent
_PKGS = ["exllamav3", "exllamav3.util", "exllamav3.vendor", "exllamav3.vendor.fla", "exllamav3.vendor.fla.hip",
- "exllamav3.modules", "exllamav3.modules.ple_fn", "gr"]
+ "exllamav3.modules", "exllamav3.modules.ple_fn", "exllamav3.modules.gr_fn"]
_added = []
for _n in _PKGS:
if _n not in sys.modules:
@@ -16,7 +16,7 @@ for _n in _PKGS:
try:
hip_compiler = importlib.import_module("exllamav3.util.hip_compiler")
LOADERS = {n: importlib.import_module(n) for n in (
- "gr.gr_mix_hip", "exllamav3.vendor.fla.hip.gdn_fused_h_hip", "exllamav3.vendor.fla.hip.kda_fused_h_hip",
+ "exllamav3.modules.gr_fn.gr_mix_hip", "exllamav3.vendor.fla.hip.gdn_fused_h_hip", "exllamav3.vendor.fla.hip.kda_fused_h_hip",
"exllamav3.modules.ple_fn.ple_hip")}
finally:
for _n in _added:
@@ -124,7 +124,7 @@ def test_warning_text(env, monkeypatch):
@pytest.mark.parametrize("modname,call", [
- ("gr.gr_mix_hip", lambda m: m.compile_hsaco()),
+ ("exllamav3.modules.gr_fn.gr_mix_hip", lambda m: m.compile_hsaco()),
("exllamav3.vendor.fla.hip.gdn_fused_h_hip", lambda m: m._compile("", "gfx1151")),
("exllamav3.vendor.fla.hip.kda_fused_h_hip", lambda m: m._compile("", "gfx1151")),
("exllamav3.modules.ple_fn.ple_hip", lambda m: m.compile_hsaco()),
@@ -148,7 +148,7 @@ def test_cache_key_includes_compiler(env, monkeypatch, modname, call):
def test_old_cache_name_not_reused(env, monkeypatch):
import hashlib
- m = LOADERS["gr.gr_mix_hip"]
+ m = LOADERS["exllamav3.modules.gr_fn.gr_mix_hip"]
log = env / "calls.log"
a = fake_hipcc(env / "a" / "hipcc", "clang version 22", log)
monkeypatch.setenv("EXL3_HIPCC", str(a))
@@ -186,12 +186,12 @@ def test_compiler_health_fields(env, monkeypatch):
def test_every_jit_site_uses_the_resolver():
- sites = ["gr/gr_mix_hip.py", "exllamav3/vendor/fla/hip/gdn_fused_h_hip.py", "exllamav3/vendor/fla/hip/kda_fused_h_hip.py",
+ sites = ["exllamav3/modules/gr_fn/gr_mix_hip.py", "exllamav3/vendor/fla/hip/gdn_fused_h_hip.py", "exllamav3/vendor/fla/hip/kda_fused_h_hip.py",
"exllamav3/modules/ple_fn/ple_hip.py", "exllamav3/modules/attention_fn/qsa_prefill_hip.py"]
for f in sites:
s = (ROOT / f).read_text()
assert "hip_compiler.hipcc()" in s and "hip_compiler.key()" in s and "EXL3_ROCM_SDK" not in s, f
import subprocess
- out = subprocess.run(["grep", "-rl", "--include=*.py", "-e", "--genco", str(ROOT / "exllamav3"), str(ROOT / "gr")],
+ out = subprocess.run(["grep", "-rl", "--include=*.py", "-e", "--genco", str(ROOT / "exllamav3")],
capture_output=True, text=True).stdout.split()
assert sorted(Path(o).relative_to(ROOT).as_posix() for o in out) == sorted(sites)