1// 2// Copyright (C) 2009-2021 Intel Corporation 3// 4// SPDX-License-Identifier: MIT 5// 6// 7 8module bvh_on_gpu_checks; 9 10kernel_module debug_kernels ("bvh_debug.cl") 11{ 12 links lsc_intrinsics; 13 kernel opencl_check_tree_topology < kernelFunction="check_tree_topology">; 14 kernel opencl_check_instances_linked_bvhs < kernelFunction="check_instances_linked_bvhs">; 15 kernel opencl_check_geos_before_quad_update < kernelFunction="check_geos_before_quad_update">; 16 kernel opencl_check_geos_vs_quads < kernelFunction="check_geos_vs_quads">; 17} 18 19 20metakernel debug_checks_prepare_const_regs() 21{ 22 define cRoundingSIMD REG4; 23 define cInit0 REG5; 24 define cShiftForSIMD REG3; 25 cRoundingSIMD = (16-1); 26 cShiftForSIMD = 4; 27 DISPATCHDIM_Y = 1; 28 DISPATCHDIM_Z = 1; 29} 30 31metakernel debug_checks_bvh_topology( 32 qword some_null_ptr, 33 qword bvh, 34 qword bvh_inner_nodes_end, 35 qword error_struct, 36 dword when, 37 dword bvh_inner_nodes_start_value ) 38{ 39 define cRoundingSIMD REG4; 40 define cShiftForSIMD REG3; 41 REG1.lo = load_dword(bvh_inner_nodes_end); 42 REG0 = bvh_inner_nodes_start_value; 43 REG1.hi = 0; 44 REG2 = REG1 - REG0; 45 REG2 = REG2 + cRoundingSIMD; 46 REG2 = REG2 >> cShiftForSIMD; 47 48 DISPATCHDIM_X = REG2.lo; 49 50 dispatch_indirect opencl_check_tree_topology args( 51 some_null_ptr, 52 bvh, 53 error_struct, 54 when); 55} 56 57metakernel debug_check_instances_linked_bvhs( 58 qword some_null_ptr, 59 qword bvh, 60 qword error_struct, 61 dword numHWThreads, 62 dword when) 63{ 64 dispatch opencl_check_instances_linked_bvhs(numHWThreads,1,1) args( 65 some_null_ptr, 66 bvh, 67 error_struct, 68 when); 69} 70 71metakernel debug_check_geos_before_quad_update( 72 qword bvh, 73 qword geos, 74 qword some_null_ptr, 75 qword error_struct, 76 dword when, 77 dword numGeos, 78 dword numHWThreads ) 79{ 80 dispatch opencl_check_geos_before_quad_update(numHWThreads,1,1) args( 81 bvh, 82 geos, 83 some_null_ptr, 84 error_struct, 85 when, 86 numGeos, 87 numHWThreads ); 88} 89 90metakernel debug_check_geos_vs_quads( 91 qword bvh, 92 qword geos, 93 qword some_null_ptr, 94 qword error_struct, 95 dword when, 96 dword numGeos, 97 dword numHWThreads ) 98{ 99 dispatch opencl_check_geos_vs_quads(numHWThreads,1,1) args( 100 bvh, 101 geos, 102 some_null_ptr, 103 error_struct, 104 when, 105 numGeos, 106 numHWThreads ); 107} 108