feat: Implement temporary patch for C10_CHECK macro import missing

This commit is contained in:
Donato Capitella
2026-02-23 09:49:42 +00:00
bovenliggende b3fcb0091f
commit 5a7f0cc676
+15 -7
Bestand weergeven
@@ -66,13 +66,21 @@ RUN echo "import sys, re" > patch_strix.py && \
echo "txt = re.sub(r'device_name = .*', 'device_name = \"gfx1151\"', txt)" >> patch_strix.py && \
echo "txt += '\n def get_device_name(self, device_id: int = 0) -> str:\n return \"AMD-gfx1151\"\n'" >> patch_strix.py && \
echo "p.write_text(txt)" >> patch_strix.py && \
# Patch 3: Fix C10_HIP_CHECK undeclared identifier in selective_scan_fwd.hip
echo "p_hip = Path('csrc/mamba/mamba_ssm/selective_scan_fwd.hip')" >> patch_strix.py && \
echo "if p_hip.exists():" >> patch_strix.py && \
echo " txt_hip = p_hip.read_text()" >> patch_strix.py && \
echo " macro_def = '#ifndef C10_HIP_CHECK\n#include <c10/hip/HIPException.h>\n#ifndef C10_HIP_CHECK\n#define C10_HIP_CHECK(error) if (error != hipSuccess) { abort(); }\n#endif\n#endif\n'" >> patch_strix.py && \
echo " txt_hip = macro_def + txt_hip" >> patch_strix.py && \
echo " p_hip.write_text(txt_hip)" >> patch_strix.py && \
# Patch 3: Fix C10_HIP_CHECK undeclared identifier by patching source files
echo "import glob" >> patch_strix.py && \
echo "for f in glob.glob('csrc/mamba/mamba_ssm/selective_scan_*.cu') + glob.glob('csrc/mamba/mamba_ssm/selective_scan_*.hip'):" >> patch_strix.py && \
echo " p_f = Path(f)" >> patch_strix.py && \
echo " if p_f.exists():" >> patch_strix.py && \
echo " txt = p_f.read_text()" >> patch_strix.py && \
echo " macro_def = '''" >> patch_strix.py && \
echo "#ifndef C10_HIP_CHECK" >> patch_strix.py && \
echo "#define C10_HIP_CHECK(error) do { if (error != hipSuccess) { abort(); } } while(0)" >> patch_strix.py && \
echo "#endif" >> patch_strix.py && \
echo "#ifndef C10_CUDA_CHECK" >> patch_strix.py && \
echo "#define C10_CUDA_CHECK(error) do { if (error != cudaSuccess) { abort(); } } while(0)" >> patch_strix.py && \
echo "#endif" >> patch_strix.py && \
echo "'''" >> patch_strix.py && \
echo " p_f.write_text(macro_def + '\\n' + txt)" >> patch_strix.py && \
# -----------
echo "print('Successfully patched vLLM for Strix Halo')" >> patch_strix.py && \
python patch_strix.py && \