Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ jobs:

- name: Compile
if: env.SHOULD_RUN == 1
run: python setup.py bdist_wheel
run: |
python setup.py bdist_wheel

- name: Test install
if: env.SHOULD_RUN == 1
Expand Down Expand Up @@ -395,7 +396,8 @@ jobs:
git checkout pr-${PR_NUMBER}

- name: Compile
run: python -m build --no-isolation --sdist
run: |
python -m build --no-isolation --sdist

- name: Check dist
run: |
Expand Down Expand Up @@ -478,7 +480,7 @@ jobs:
git config --global --add safe.directory $(pwd)
git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER}
git checkout pr-${PR_NUMBER}

- uses: actions/setup-python@v6
with:
python-version: 3.13
Expand All @@ -488,15 +490,19 @@ jobs:
run: |
pip install build setuptools uv -U
uv pip install torch twine ninja --system

- name: Compile
run: python -m build --no-isolation --sdist
run: |
python -m build --no-isolation --sdist


- name: Check dist
run: |
ls -ahl dist
whl=$(ls -t dist/*.gz | head -n 1 | xargs basename)
echo "WHL_NAME=$whl" >> $GITHUB_ENV
twine check dist/$whl

- name: Upload to artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -516,6 +522,7 @@ jobs:
if: (github.event_name == 'release' || github.event.inputs.upload_pypi == 'true') && !cancelled()
run: |
for i in {1..5}; do sleep 5; done

- name: Upload sdist to pypi
if: (github.event_name == 'release' || github.event.inputs.upload_pypi == 'true') && !cancelled()
env:
Expand Down
2 changes: 2 additions & 0 deletions gptqmodel_ext/machete/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

_CUTLASS_PYTHON_DIR = _CUTLASS_ROOT / "python"

_CUTLASS_PYTHON_DIR.mkdir(parents=True, exist_ok=True)

if str(_CUTLASS_EXT_DIR) not in sys.path:
sys.path.append(str(_CUTLASS_EXT_DIR))
if _CUTLASS_PYTHON_DIR.exists() and str(_CUTLASS_PYTHON_DIR) not in sys.path:
Expand Down
37 changes: 12 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,33 +615,20 @@ def _hipify_compile_flags(flags):
]

if BUILD_MACHETE and HAS_CUDA_V9 and _version_geq(NVCC_VERSION, 12, 0):
machete_dir = Path("gptqmodel_ext/machete")
machete_generated_dir = machete_dir / "generated"

machete_sources = [str(machete_dir / "machete_pytorch.cu")]
machete_generated_sources = sorted(machete_generated_dir.glob("*.cu"))

if not machete_generated_sources:
raise RuntimeError(
"No generated machete kernel templates detected. Run gptqmodel_ext/machete/generate.py"
" with CUTLASS checkout before building."
try:
result = subprocess.run(
[sys.executable, "gptqmodel_ext/machete/generate.py"],
check=True,
text=True,
capture_output=True
)

machete_sources += [str(path) for path in machete_generated_sources]

machete_include_dirs = [str(Path("gptqmodel_ext").resolve())] + [str(path) for path in cutlass_include_paths]

extensions += [
cpp_ext.CUDAExtension(
"gptqmodel_machete_kernels",
machete_sources,
extra_link_args=extra_link_args,
extra_compile_args=extra_compile_args,
include_dirs=machete_include_dirs,
except subprocess.CalledProcessError as e:
raise RuntimeError(
f"Error generating machete kernel templates:\n"
f"Return code: {e.returncode}\n"
f"Stderr: {e.stderr}\n"
f"Stdout: {e.stdout}"
)
]

if BUILD_MACHETE and HAS_CUDA_V9 and _version_geq(NVCC_VERSION, 12, 0):
machete_dir = Path("gptqmodel_ext/machete")
machete_generated_dir = machete_dir / "generated"

Expand Down