Exporter writes kernel.cl next to kernel.cu (same instruction list; memory-hard core emitted in a third, OpenCL C dialect with the same literals as memhard.h). Pack headers are now C99-safe so a plain C host can include them. proto-opencl/host.c: C99 + OpenCL 1.2 API, device list, runtime build, cache fill and FNV check, dataset build and self-test, 3 vector warps standalone and in batch, bench and sweep as host.cu, whole-batch fingerprint. The 32-lane exchange is sub_group_shuffle_xor only when the queried sub-group size for a 32-item work-group is exactly 32; otherwise a local-memory exchange with one barrier per exchange, so wave64 hardware cannot change the hash (WAVEFRONT.md). build.sh (macOS, Linux), build.bat (MSVC), README with the exact AMD-rig commands. Proven without AMD silicon: Apple OpenCL 1.2 on the M5 Max 96/96 on all three packs (45.0 Mhash/s at 1 GiB, Apple number, not AMD); pocl 7.2 CPU device 96/96 on both exchange paths including the real sub_group_shuffle_xor text; CPU emulator 7 configurations incl. 64-wide sub-groups, identical fingerprint f99fb375b3abeaf5 everywhere. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
59 lines
2.8 KiB
Batchfile
59 lines
2.8 KiB
Batchfile
@echo off
|
|
rem Build igneum-bench-cl for one program pack (Windows, MSVC).
|
|
rem Run from an "x64 Native Tools Command Prompt for VS 2022" (or 2026 with any toolset: this is plain C, no nvcc involved).
|
|
rem Needs the OpenCL headers (CL\cl.h) and the ICD loader import library (OpenCL.lib). The script looks, in order, at:
|
|
rem OPENCL_SDK a Khronos OpenCL-SDK or vcpkg tree: %OPENCL_SDK%\include\CL\cl.h and %OPENCL_SDK%\lib\OpenCL.lib
|
|
rem CUDA_PATH the CUDA Toolkit ships both: %CUDA_PATH%\include\CL\cl.h and %CUDA_PATH%\lib\x64\OpenCL.lib
|
|
rem OCL_ROOT the old AMD APP SDK layout: %OCL_ROOT%\include and %OCL_ROOT%\lib\x86_64
|
|
rem The runtime itself (OpenCL.dll in System32 plus the vendor ICD) comes with the AMD Adrenalin driver; no SDK needed to run.
|
|
rem Usage: build.bat [pack]
|
|
rem pack directory name under ..\proto-cuda\packs\ (default igneum-genesis-mh)
|
|
setlocal
|
|
cd /d "%~dp0"
|
|
|
|
set PACK=%1
|
|
if "%PACK%"=="" set PACK=igneum-genesis-mh
|
|
set PACKDIR=..\proto-cuda\packs\%PACK%
|
|
|
|
where cl >nul 2>nul
|
|
if errorlevel 1 (
|
|
echo cl.exe not found. Open an "x64 Native Tools Command Prompt" ^(Visual Studio Build Tools, Desktop development with C++^) and run this again.
|
|
exit /b 1
|
|
)
|
|
if not exist "%PACKDIR%\kernel.cl" (
|
|
echo no pack at %PACKDIR% ^(expected kernel.cl, program.h, vectors.h^)
|
|
exit /b 1
|
|
)
|
|
|
|
set INC=
|
|
set LIB=
|
|
if not "%OPENCL_SDK%"=="" if exist "%OPENCL_SDK%\include\CL\cl.h" (
|
|
set INC=%OPENCL_SDK%\include
|
|
if exist "%OPENCL_SDK%\lib\OpenCL.lib" set LIB=%OPENCL_SDK%\lib\OpenCL.lib
|
|
if exist "%OPENCL_SDK%\lib\x64\OpenCL.lib" set LIB=%OPENCL_SDK%\lib\x64\OpenCL.lib
|
|
)
|
|
if "%LIB%"=="" if not "%CUDA_PATH%"=="" if exist "%CUDA_PATH%\include\CL\cl.h" (
|
|
set INC=%CUDA_PATH%\include
|
|
set LIB=%CUDA_PATH%\lib\x64\OpenCL.lib
|
|
)
|
|
if "%LIB%"=="" if not "%OCL_ROOT%"=="" if exist "%OCL_ROOT%\include\CL\cl.h" (
|
|
set INC=%OCL_ROOT%\include
|
|
set LIB=%OCL_ROOT%\lib\x86_64\OpenCL.lib
|
|
)
|
|
if "%LIB%"=="" (
|
|
echo No OpenCL SDK found. Set OPENCL_SDK to a tree with include\CL\cl.h and lib\OpenCL.lib, for example:
|
|
echo vcpkg install opencl:x64-windows then set OPENCL_SDK=C:\vcpkg\installed\x64-windows
|
|
echo or the Khronos OpenCL-SDK release zip, or install the CUDA Toolkit ^(it ships CL\cl.h and OpenCL.lib^).
|
|
exit /b 1
|
|
)
|
|
|
|
echo using headers %INC% and import library %LIB%
|
|
echo cl /nologo /O2 /W3 /std:c11 /I "%INC%" /I "%PACKDIR%" /DIGNEUM_KERNEL_PATH="\"%PACKDIR:\=/%/kernel.cl\"" /Fe:igneum-bench-cl-%PACK%.exe host.c /link "%LIB%"
|
|
cl /nologo /O2 /W3 /std:c11 /I "%INC%" /I "%PACKDIR%" /DIGNEUM_KERNEL_PATH="\"%PACKDIR:\=/%/kernel.cl\"" /Fe:igneum-bench-cl-%PACK%.exe host.c /link "%LIB%"
|
|
if errorlevel 1 (
|
|
echo build failed. If cl.exe rejects /std:c11, drop that flag: the code is C99 and MSVC's default C mode accepts it.
|
|
exit /b 1
|
|
)
|
|
del host.obj >nul 2>nul
|
|
echo built igneum-bench-cl-%PACK%.exe
|
|
endlocal
|