1// 2// Copyright (C) 2009-2021 Intel Corporation 3// 4// SPDX-License-Identifier: MIT 5// 6// 7 8module input_dump; 9 10kernel_module input_dumper("input_dump.cl") 11{ 12 links lsc_intrinsics; 13 14 kernel opencl_kernel_find_max_used_byte_in_buff < kernelFunction="find_max_used_byte_in_buff" >; 15 kernel opencl_kernel_allocate_linear_offsets_for_vertex_buffers < kernelFunction="allocate_linear_offsets_for_vertex_buffers" >; 16 kernel opencl_kernel_allocate_data_space_for_inputs < kernelFunction="allocate_data_space_for_inputs" >; 17 kernel opencl_kernel_allocate_data_space_for_outputs < kernelFunction="allocate_data_space_for_outputs" >; 18 kernel opencl_kernel_calc_outputs_data_size < kernelFunction="calc_outputs_data_size" >; 19 kernel opencl_kernel_write_output_data_op < kernelFunction="write_output_data_op" >; 20 kernel opencl_kernel_write_geo_data < kernelFunction="write_geo_data" >; 21 kernel opencl_kernel_write_input_build_op < kernelFunction="write_input_build_op" >; 22 kernel opencl_kernel_copy_instance_descriptors_array < kernelFunction="copy_instance_descriptors_array" >; 23 kernel opencl_kernel_copy_instance_descriptors_array_of_ptrs < kernelFunction="copy_instance_descriptors_array_of_ptrs" >; 24 kernel opencl_kernel_insert_copy_op < kernelFunction="insert_copy_op" >; 25 kernel opencl_kernel_copy_vertex_data < kernelFunction="copy_vertex_data" >; 26 kernel opencl_kernel_generate_unique_batch_id < kernelFunction="generate_unique_batch_id" >; 27 kernel opencl_kernel_finish_batch_dump_inputs < kernelFunction="finish_batch_dump_inputs" >; 28 kernel opencl_kernel_finish_batch_dump_outputs < kernelFunction="finish_batch_dump_outputs" >; 29} 30 31 32metakernel find_max_used_byte_in_buff( 33 qword indexBuffPtr, 34 qword vertexBufferUsedByteEnd, 35 dword IndexCount, 36 dword IndexFormat, 37 dword VertexCount, 38 qword VertexBufferByteStride, 39 dword numPhysThreads) 40{ 41 dispatch opencl_kernel_find_max_used_byte_in_buff(numPhysThreads, 1, 1) args( 42 indexBuffPtr, 43 vertexBufferUsedByteEnd, 44 IndexCount, 45 IndexFormat, 46 VertexCount, 47 VertexBufferByteStride); 48} 49 50metakernel allocate_linear_offsets_for_vertex_buffers( 51 qword batchPtrs, 52 qword m_VertexBufferUsedByteEnd, 53 qword m_VertexBufferOffset, 54 dword numVertexBuffers, 55 dword numPhysThreads) 56{ 57 dispatch opencl_kernel_allocate_linear_offsets_for_vertex_buffers(numPhysThreads, 1, 1) args( 58 batchPtrs, 59 m_VertexBufferUsedByteEnd, 60 m_VertexBufferOffset, 61 numVertexBuffers); 62} 63 64metakernel allocate_data_space_for_inputs( 65 qword inputDumpMainBuffer, 66 qword batchPtrs, 67 dword nonVertexSize, 68 qword batchIdPtr) 69{ 70 dispatch opencl_kernel_allocate_data_space_for_inputs(1, 1, 1) args( 71 inputDumpMainBuffer, 72 batchPtrs, 73 nonVertexSize, 74 batchIdPtr); 75} 76 77metakernel allocate_data_space_for_outputs( 78 qword inputDumpMainBuffer, 79 qword batchPtrs, 80 qword batchIdPtr) 81{ 82 dispatch opencl_kernel_allocate_data_space_for_outputs(1, 1, 1) args( 83 inputDumpMainBuffer, 84 batchPtrs, 85 batchIdPtr); 86} 87 88metakernel calc_outputs_data_size( 89 qword pbi, 90 qword destOffsets, 91 qword numOutputs, 92 qword batchPtrs) 93{ 94 dispatch opencl_kernel_calc_outputs_data_size(1, 1, 1) args( 95 pbi, 96 destOffsets, 97 numOutputs, 98 batchPtrs); 99} 100 101metakernel write_output_data_op( 102 qword batchPtrs, 103 qword destOffset, 104 qword src, 105 qword pbi) 106{ 107 dispatch opencl_kernel_write_output_data_op(1, 1, 1) args( 108 batchPtrs, 109 destOffset, 110 src, 111 pbi); 112} 113 114metakernel write_geo_data( 115 qword batchPtrs, 116 qword srcDesc, 117 qword pVertexBufferOffsetInLinearisedUniqueVertexBuffers, 118 qword pVertexBufferSize, 119 qword dstDescOffset, 120 qword dstDataOffset, 121 dword numThreads) 122{ 123 dispatch opencl_kernel_write_geo_data(numThreads, 1, 1) args( 124 batchPtrs, 125 srcDesc, 126 pVertexBufferOffsetInLinearisedUniqueVertexBuffers, 127 pVertexBufferSize, 128 dstDescOffset, 129 dstDataOffset, 130 numThreads); 131} 132 133metakernel write_input_build_op( 134 qword batchPtrs, 135 qword buildOpOffset, 136 qword srcBvh, 137 qword dstBvhAddr, 138 dword offsetToEnd, 139 dword flags, 140 dword numGeometries, 141 dword numInstances, 142 dword instArrayOfPtrs) 143 144{ 145 dispatch opencl_kernel_write_input_build_op(1, 1, 1) args( 146 batchPtrs, 147 buildOpOffset, 148 srcBvh, 149 dstBvhAddr, 150 offsetToEnd, 151 flags, 152 numGeometries, 153 numInstances, 154 instArrayOfPtrs); 155} 156 157metakernel copy_instance_descriptors_array( 158 qword batchPtrs, 159 qword instanceDescArr, 160 qword offset, 161 dword numInstances, 162 dword numPhysThreads) 163{ 164 dispatch opencl_kernel_copy_instance_descriptors_array(numPhysThreads, 1, 1) args( 165 batchPtrs, 166 instanceDescArr, 167 offset, 168 numInstances); 169} 170 171metakernel copy_instance_descriptors_array_of_ptrs( 172 qword batchPtrs, 173 qword instanceDescArrPtrs, 174 qword offset, 175 dword numInstances, 176 dword numPhysThreads) 177{ 178 dispatch opencl_kernel_copy_instance_descriptors_array_of_ptrs(numPhysThreads, 1, 1) args( 179 batchPtrs, 180 instanceDescArrPtrs, 181 offset, 182 numInstances); 183} 184 185metakernel insert_copy_op( 186 qword batchPtrs, 187 qword offset, 188 qword src, 189 qword dst, 190 dword type) 191{ 192 dispatch opencl_kernel_insert_copy_op(1, 1, 1) args( 193 batchPtrs, 194 offset, 195 src, 196 dst, 197 type); 198} 199 200metakernel copy_vertex_data( 201 qword desc, 202 qword src, 203 qword offset, 204 qword size) 205{ 206 define byteSize REG0; 207 define numGroupsRqd REG1; 208 define shift REG2; 209 define minimum REG3; 210 211 shift = 6; 212 minimum = 1; 213 byteSize = load_dword(size); 214 numGroupsRqd = byteSize >> shift; 215 numGroupsRqd = numGroupsRqd + minimum; 216 DISPATCHDIM_X = numGroupsRqd.lo; 217 DISPATCHDIM_Y = 1; 218 DISPATCHDIM_Z = 1; 219 220 dispatch_indirect opencl_kernel_copy_vertex_data args( 221 desc, 222 src, 223 offset, 224 size); 225} 226 227metakernel generate_unique_batch_id( 228 qword batchIds, 229 dword batchIndex) 230{ 231 dispatch opencl_kernel_generate_unique_batch_id(1, 1, 1) args( 232 batchIds, 233 batchIndex); 234} 235 236metakernel finish_batch_dump_inputs( 237 qword batchPtrs, 238 qword dumpMainBuffer) 239{ 240 dispatch opencl_kernel_finish_batch_dump_inputs(1, 1, 1) args( 241 batchPtrs, 242 dumpMainBuffer); 243} 244 245metakernel finish_batch_dump_outputs( 246 qword batchPtrs, 247 qword dumpMainBuffer) 248{ 249 dispatch opencl_kernel_finish_batch_dump_outputs(1, 1, 1) args( 250 batchPtrs, 251 dumpMainBuffer); 252} 253