ae2f_docs
MlpPool.def.cc
1#ifndef ae2fVK_AnnMlpPool_h
2
3#if __ae2f_MACRO_GENERATED
4#define ae2fVK_AnnMlpPool_h
5#endif
6
7#if !ae2f_MAC_BUILD || !__ae2f_MACRO_GENERATED
8#include <ae2f/Macro.h>
9#include <assert.h>
10#endif
11
12#include <ae2fVK/Ann/Mlp.h>
13#include <ae2fVK/Ann/MlpPool.auto.h>
14#include <ae2fVK/Ann/SlpPool.auto.h>
15
16ae2f_MAC() _ae2fVK_AnnMlpDescPoolCmdMkPredict_imp(
17 ae2fVK_AnnMlpDescPoolCmdMk_t v_cmdmk,
18
19 ae2fVK_AnnMlp iv_mlp,
20 ae2f_err_t iv_err,
21 const ae2fVK_AnnSlpDescPool i_pool,
22
23 ae2fVK_AnnMlpDescPoolCmd r_cmd,
24
25 const VkCommandBuffer i_vkcmdbuf
26 )
27{
30 {
31 vkCmdPushConstants(
32 i_vkcmdbuf
33 , (iv_mlp).m_vkpipelayout[ae2fVK_eAnnSlpPipeLayouts_kPredict]
34 , VK_SHADER_STAGE_COMPUTE_BIT
35 , 0
36 , sizeof(uint32_t)
37 , &(iv_mlp).m_mlp.m_depth
38 );
39
40 vkCmdPushConstants(
41 i_vkcmdbuf
42 , (iv_mlp).m_vkpipelayout[ae2fVK_eAnnSlpPipeLayouts_kPredict]
43 , VK_SHADER_STAGE_COMPUTE_BIT
44 , sizeof(uint32_t)
45 , sizeof(uint32_t)
46 , &(iv_mlp).m_mlp.m_weightc
47 );
48
49 vkCmdDispatch(
50 i_vkcmdbuf
51 , (iv_mlp).m_mlp.m_outc
52 , (iv_mlp).m_mlp.m_outc
53 , 1
54 );
55 }
56 )
57
58 , v_cmdmk
59 , r_cmd
60 , iv_mlp
61 , i_pool
62 , iv_err
63
64 , 1
65
66 , 0
67 , 0
68 + sizeof(uint32_t) * (iv_mlp).m_mlp.m_depth
69 + sizeof(ae2f_float_t) * ((iv_mlp).m_mlp.m_outc) * ((iv_mlp).m_mlp.m_depth * 2 + 1)
70 + sizeof(ae2f_float_t) * (iv_mlp).m_mlp.m_outc * (iv_mlp).m_mlp.m_outc * (iv_mlp).m_mlp.m_depth
71 , 0, sizeof(ae2f_float_t) * (iv_mlp).m_mlp.m_outc * 2
72
73 , ae2fVK_eAnnMlpDescLayouts_ONLY /** i_desclayout */
74 , ae2fVK_eAnnMlpPipes_kPredict /** i_pipe */
75 , ae2fVK_eAnnMlpPipeLayouts_kPredict /** i_pipelayout */
76 , i_vkcmdbuf
77 );
78}
79
80ae2f_MAC() _ae2fVK_AnnMlpDescPoolCmdMkTrain_imp(
81 ae2fVK_AnnMlpDescPoolCmdMk_t v_cmdmk,
82
83 ae2fVK_AnnMlp iv_mlp,
84 ae2f_err_t iv_err,
85 const ae2fVK_AnnMlpDescPool i_pool,
86
87 ae2fVK_AnnSlpDescPoolCmd r_cmd,
88
89 const VkCommandBuffer i_vkcmdbuf
90
91 )
92{
95 {
96 vkCmdPushConstants(
97 i_vkcmdbuf
98 , (iv_mlp).m_vkpipelayout[ae2fVK_eAnnSlpPipeLayouts_kTrain]
99 , VK_SHADER_STAGE_COMPUTE_BIT
100 , 0
101 , sizeof(uint32_t)
102 , &(iv_mlp).m_mlp.m_depth
103 );
104
105 vkCmdPushConstants(
106 i_vkcmdbuf
107 , (iv_mlp).m_vkpipelayout[ae2fVK_eAnnSlpPipeLayouts_kTrain]
108 , VK_SHADER_STAGE_COMPUTE_BIT
109 , ae2f_CmpGetGt(sizeof(ae2f_float_t), sizeof(uint32_t))
110 , sizeof(ae2f_float_t)
111 , &(iv_mlp).m_mlp.m_learningrate
112 );
113
114 vkCmdPushConstants(
115 i_vkcmdbuf
116 , (iv_mlp).m_vkpipelayout[ae2fVK_eAnnSlpPipeLayouts_kTrain]
117 , VK_SHADER_STAGE_COMPUTE_BIT
118 , ae2f_CmpGetGt(sizeof(ae2f_float_t), sizeof(uint32_t)) * 2
119 , sizeof(ae2f_float_t)
120 , &(iv_mlp).m_mlp.m_learningrate_bias
121 );
122
123 vkCmdPushConstants(
124 i_vkcmdbuf
125 , (iv_mlp).m_vkpipelayout[ae2fVK_eAnnSlpPipeLayouts_kTrain]
126 , VK_SHADER_STAGE_COMPUTE_BIT
127 , ae2f_CmpGetGt(sizeof(ae2f_float_t), sizeof(uint32_t)) * 3
128 , sizeof(uint32_t)
129 , &(iv_mlp).m_mlp.m_weightc
130 );
131
132 vkCmdDispatch(
133 i_vkcmdbuf
134 , (iv_mlp).m_mlp.m_outc
135 , (iv_mlp).m_mlp.m_outc
136 , 1
137 );
138 }
139 )
140 , v_cmdmk
141 , r_cmd
142 , iv_mlp
143 , i_pool
144 , iv_err
145
146 , 2
147
148 , 0
149 , __ae2fVK_AnnMlpGlobMemSz((iv_mlp).m_mlp.m_depth, (iv_mlp).m_mlp.m_outc, (iv_mlp).m_mlp.m_weightc)
150
151 , 0, (((iv_mlp).m_mlp.m_outc * ((iv_mlp).m_mlp.m_depth + 2)) * sizeof(ae2f_float_t))
152
153 , ae2fVK_eAnnMlpDescLayouts_ONLY /** i_desclayout */
154 , ae2fVK_eAnnMlpPipes_kTrainAuto /** i_pipe */
155 , ae2fVK_eAnnMlpPipeLayouts_kTrain /** i_pipelayout */
156 , i_vkcmdbuf
157 );
158}
159
160#endif
#define ae2f_CastMerge(...)
simply merge all text inside the round bracket, counting them as a single text block.
Definition Cast.h:25
#define ae2f_CmpGetGt(a, b)
Definition Cmp.h:20
uint8_t ae2f_err_t
Informs that this number represents the error.
Definition errGlob.h:19
#define __ae2fVK_AnnMlpGlobMemSz(i_depth, i_outc, i_weightc)
Definition Mlp.core.h:160
#define __ae2fVK_AnnMlpDescPoolCmdMk_imp
Definition Mlp.core.h:167
#define __ae2fVK_AnnSlpDescPoolCmdMk_imp(COMMANDONRECORDING, v_cmdmk, r_cmd, iv_slp, i_pool, iv_err, i_desccount, i_offglob, i_szglob, i_offloc, i_szloc, i_desclayout, i_pipe, i_pipelayout, i_vkcmdbuf)
#define ae2f_MAC(...)
Definition mac.h:28