1@ECHO OFF
2
3SET HS_GEN=..\..\..\..\..\..\spinel\bin\x64\Debug\hs_gen
4
5:: --- 64-bit keys ---
6
7::
8:: This is not a great mapping to GEN but the compiler is not cooperating
9::
10
11%HS_GEN% -v -a "opencl" -D HS_INTEL_GEN8 -t 2 -w 8 -r 16 -s 21504 -S 65536 -b 16 -B 48 -m 1 -M 1 -f 1 -F 1 -c 1 -C 1 -z
12
13::
14:: This should be the proper mapping onto the Intel GEN8+ subslices but the compiler is spilling
15::
16:: %HS_GEN% -v -a "opencl" -D HS_INTEL_GEN8 -t 2 -w 8 -r 16 -s 32768 -S 65536 -b 28 -B 56 -m 1 -M 1 -f 0 -F 0 -c 0 -C 0 -z
17::
18
19::
20:: remove trailing whitespace from generated files
21::
22
23sed -i 's/[[:space:]]*$//' hs_config.h
24
25::
26:: preprocess and build kernels
27::
28
29SET OPENCL_STD=-cl-std=CL1.2
30SET OPENCL_PRE=__OPENCL_C_VERSION__=120
31
32:: SET OPENCL_STD=-cl-std=CL2.0
33:: SET OPENCL_PRE=__OPENCL_C_VERSION__=200
34
35::
36::
37::
38
39SET IOC=ioc64
40
41::
42::
43::
44
45SET IOC_IR_OPTS_OPT=%OPENCL_STD% -cl-single-precision-constant -cl-denorms-are-zero -cl-mad-enable -cl-no-signed-zeros -cl-fast-relaxed-math -cl-kernel-arg-info
46
47SET IOC_IR_OPTS_DBG=%OPENCL_STD% -cl-kernel-arg-info -g
48
49SET IOC_IR_OPTS=%IOC_IR_OPTS_OPT%
50
51::
52::
53::
54
55SET PRE_SRC=hs_kernels.pre.cl
56SET PRE_SRC_XXD=hs_kernels.src.xxd
57SET PRE_SRC_LEN_XXD=hs_kernels.src.len.xxd
58
59SET PRE_BIN=hs_kernels.bin
60SET PRE_BIN_XXD=hs_kernels.bin.xxd
61SET PRE_BIN_LEN_XXD=hs_kernels.bin.len.xxd
62
63::
64:: *.pre.cl
65::
66
67clang-format -style=Mozilla -i hs_kernels.cl                                                   || goto :error
68cl -I ..\.. -I "%INTELOCLSDKROOT%\include" -D %OPENCL_PRE% -EP hs_kernels.cl -P -Fi"%PRE_SRC%" || goto :error
69clang-format -style=Mozilla -i %PRE_SRC%                                                       || goto :error
70dos2unix -q %PRE_SRC%                                                                          || goto :error
71
72echo %PRE_SRC%
73
74::
75:: *.src.xxd
76:: *.src.len.xxd
77::
78
79xxd -i < %PRE_SRC% > %PRE_SRC_XXD%  || goto :error
80
81for /f %%A in ('wc -c %PRE_SRC%') do (
82    echo %PRE_SRC% %%A
83    printf "%%.8x" %%A | xxd -r -p | xxd -i > %PRE_SRC_LEN_XXD%  || goto :error
84)
85
86echo %PRE_SRC_XXD%
87echo %PRE_SRC_LEN_XXD%
88
89::
90:: *.pre.bin
91::
92
93%IOC% -cmd=build -bo="%IOC_IR_OPTS%" -device=gpu -input=%PRE_SRC% -ir=%PRE_BIN%  || goto :error
94
95echo %PRE_BIN%
96
97::
98:: *.bin.xxd
99:: *.bin.len.xxd
100::
101
102xxd -i < %PRE_BIN% > %PRE_BIN_XXD%  || goto :error
103
104for /f %%A in ('wc -c %PRE_BIN%') do (
105    echo %PRE_BIN% %%A
106    printf "%%.8x" %%A | xxd -r -p | xxd -i > %PRE_BIN_LEN_XXD%  || goto :error
107)
108
109echo %PRE_BIN_XXD%
110echo %PRE_BIN_LEN_XXD%
111
112::
113:: dump a binary
114::
115
116cl -I ../../../../.. -I ../../.. /DHS_DUMP /Fe:hs_dump.exe *.c
117hs_dump
118
119::
120:: delete temporary files
121::
122
123:: del hs_target.bin
124:: del *.pre.cl
125del *.obj
126del *.exe
127
128exit /b 0
129
130:error
131
132exit /b %errorlevel%
133