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