| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2017-2021 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <stdint.h> |
| 12 |
|
| 13 |
namespace iOpenCL { |
| 14 |
// |
| 15 |
// The layout of the (IGC) program debug data is as follows: |
| 16 |
// |
| 17 |
/* |
| 18 |
-------------------------------------------------------------------------- |
| 19 |
| SProgramDebugDataHeaderIGC: | |
| 20 |
-------------------------------------------------------------------------- |
| 21 |
| Program Kernel Data Table: | |
| 22 |
| (All kernels have debug data entries in here. If kernel has no debug | |
| 23 |
| info the debug info size will be zero.) | |
| 24 |
| ---> (IGC) Program Kernel Data 1 | |
| 25 |
| ---> ... | |
| 26 |
| ---> (IGC) Program Kernel Data n | |
| 27 |
-------------------------------------------------------------------------- |
| 28 |
*/ |
| 29 |
|
| 30 |
// |
| 31 |
// The layout of the (IGC) kernel data is as follows: |
| 32 |
// |
| 33 |
/* |
| 34 |
-------------------------------------------------------------------------- |
| 35 |
| (IGC) Program Kernel Data: | |
| 36 |
-------------------------------------------------------------------------- |
| 37 |
| SKernelDebugDataHeaderIGC: | |
| 38 |
| (All kernels have debug data entries in here. If kernel has no debug | |
| 39 |
| info the debug info size will be zero.) | |
| 40 |
-------------------------------------------------------------------------- |
| 41 |
| Kernel name: | |
| 42 |
| (NULL terminated string aligned on sizeof(DWORD).) | |
| 43 |
-------------------------------------------------------------------------- |
| 44 |
| VISA debug info: | |
| 45 |
-------------------------------------------------------------------------- |
| 46 |
| GenISA debug info: | |
| 47 |
-------------------------------------------------------------------------- |
| 48 |
*/ |
| 49 |
|
| 50 |
/*****************************************************************************\ |
| 51 |
STRUCT: SProgramDebugDataHeaderIGC |
| 52 |
\*****************************************************************************/ |
| 53 |
typedef struct _SProgramDebugDataHeaderIGC { |
| 54 |
uint32_t Magic; |
| 55 |
uint32_t Version; |
| 56 |
uint32_t Size; |
| 57 |
uint32_t Device; |
| 58 |
uint32_t SteppingId; |
| 59 |
uint32_t GPUPointerSizeInBytes; |
| 60 |
uint32_t NumberOfKernels; |
| 61 |
} SProgramDebugDataHeaderIGC; |
| 62 |
|
| 63 |
/*****************************************************************************\ |
| 64 |
STRUCT: SKernelDebugDataHeaderIGC |
| 65 |
\*****************************************************************************/ |
| 66 |
typedef struct _SKernelDebugDataHeaderIGC { |
| 67 |
uint32_t KernelNameSize; |
| 68 |
uint32_t SizeVisaDbgInBytes; |
| 69 |
uint32_t SizeGenIsaDbgInBytes; |
| 70 |
} SKernelDebugDataHeaderIGC; |
| 71 |
|
| 72 |
// |
| 73 |
// The layout of the program debug data is as follows: |
| 74 |
// |
| 75 |
/* |
| 76 |
-------------------------------------------------------------------------- |
| 77 |
| SProgramDebugDataHeader: | |
| 78 |
-------------------------------------------------------------------------- |
| 79 |
| Program String Table: | |
| 80 |
| (This is a sequence of null-terminated strings. The first set of | |
| 81 |
| strings correspond to the directory table entries appearing in order. | |
| 82 |
| The second set of strings correspond to the directory table entries | |
| 83 |
| appearing in order. The third set of strings correspond to the kernel | |
| 84 |
| names appearing in order. (Note not all kernels may have associated | |
| 85 |
| debug data. The debug data reader must use the KernelIndex field in | |
| 86 |
| SKernelDebugDataHeader to check if debug data exist for a kernel that | |
| 87 |
| is present in kernel binary data). | |
| 88 |
-------------------------------------------------------------------------- |
| 89 |
| Program Directory Table: | |
| 90 |
| ---> SProgramDebugDataDirTableHeader | |
| 91 |
| (Its string entries appear in order in the string table.) | |
| 92 |
-------------------------------------------------------------------------- |
| 93 |
| Program File Table: | |
| 94 |
| ---> SProgramDebugDataFileTableHeader | |
| 95 |
| (Its string entries appear in order in the string table.) | |
| 96 |
| ---> SProgramDebugDataFileTableEntry 1 | |
| 97 |
| ---> ... | |
| 98 |
| ---> SProgramDebugDataFileTableEntry n | |
| 99 |
-------------------------------------------------------------------------- |
| 100 |
| Program Kernel Data Table: | |
| 101 |
| (Only kernels that have debug data have entries in here. The | |
| 102 |
| KernelIndex field is used to specfy the kernel whose debug data | |
| 103 |
| appears here.) | |
| 104 |
| ---> Program Kernel Data 1 | |
| 105 |
| ---> ... | |
| 106 |
| ---> Program Kernel Data n | |
| 107 |
-------------------------------------------------------------------------- |
| 108 |
*/ |
| 109 |
|
| 110 |
// |
| 111 |
// The layout of the kernel data is as follows: |
| 112 |
// |
| 113 |
/* |
| 114 |
-------------------------------------------------------------------------- |
| 115 |
| Program Kernel Data: | |
| 116 |
-------------------------------------------------------------------------- |
| 117 |
| SKernelDebugDataHeader: | |
| 118 |
| (Only kernels that have debug data have entries in here. The | |
| 119 |
| KernelIndex field is used to specfy the kernel whose debug data | |
| 120 |
| appears here.) | |
| 121 |
-------------------------------------------------------------------------- |
| 122 |
| SKernelDebugDataLineTableHeader: | |
| 123 |
-------------------------------------------------------------------------- |
| 124 |
| SKernelDebugDataLineTableEntry 1: | |
| 125 |
-------------------------------------------------------------------------- |
| 126 |
| ... | |
| 127 |
-------------------------------------------------------------------------- |
| 128 |
| SKernelDebugDataLineTableEntry n: | |
| 129 |
-------------------------------------------------------------------------- |
| 130 |
*/ |
| 131 |
|
| 132 |
/*****************************************************************************\ |
| 133 |
STRUCT: SProgramDebugDataHeader |
| 134 |
\*****************************************************************************/ |
| 135 |
typedef struct _SProgramDebugDataHeader { |
| 136 |
uint32_t Magic; |
| 137 |
uint32_t Version; |
| 138 |
uint32_t Size; |
| 139 |
uint32_t StringTableSize; |
| 140 |
uint32_t DirTableSize; |
| 141 |
uint32_t FileTableSize; |
| 142 |
uint32_t Device; |
| 143 |
uint32_t SteppingId; |
| 144 |
uint32_t GPUPointerSizeInBytes; |
| 145 |
uint32_t NumberOfKernels; |
| 146 |
uint32_t NumberOfKernelsWithDebugData; |
| 147 |
} SProgramDebugDataHeader; |
| 148 |
|
| 149 |
/*****************************************************************************\ |
| 150 |
STRUCT: SProgramProgramDebugDataDirTableHeader |
| 151 |
\*****************************************************************************/ |
| 152 |
typedef struct _SProgramDebugDataDirTableHeader { |
| 153 |
uint32_t NumberOfDirs; |
| 154 |
} SProgramDebugDataDirTableHeader; |
| 155 |
|
| 156 |
/*****************************************************************************\ |
| 157 |
STRUCT: SProgramProgramDebugDataFileTableHeader |
| 158 |
\*****************************************************************************/ |
| 159 |
typedef struct _SProgramDebugDataFileTableHeader { |
| 160 |
uint32_t NumberOfFiles; |
| 161 |
} SProgramDebugDataFileTableHeader; |
| 162 |
|
| 163 |
/*****************************************************************************\ |
| 164 |
STRUCT: SProgramDebugDataFileTableEntry |
| 165 |
\*****************************************************************************/ |
| 166 |
typedef struct _SProgramDebugDataFileTableEntry { |
| 167 |
uint32_t DirIndex; |
| 168 |
} SProgramDebugDataFileTableEntry; |
| 169 |
|
| 170 |
/*****************************************************************************\ |
| 171 |
STRUCT: SKernelDebugDataHeader |
| 172 |
\*****************************************************************************/ |
| 173 |
typedef struct _SKernelDebugDataHeader { |
| 174 |
uint32_t KernelIndex; |
| 175 |
uint32_t CodeOffset; |
| 176 |
uint32_t Size; |
| 177 |
} SKernelDebugDataHeader; |
| 178 |
|
| 179 |
/*****************************************************************************\ |
| 180 |
STRUCT: SKernelDebugDataLineTableHeader |
| 181 |
\*****************************************************************************/ |
| 182 |
typedef struct _SKernelDebugDataLineTableHeader { |
| 183 |
uint32_t NumberOfEntries; |
| 184 |
} SKernelDebugDataLineTableHeader; |
| 185 |
|
| 186 |
/*****************************************************************************\ |
| 187 |
STRUCT: SKernelDebugDataLineTableEntry |
| 188 |
\*****************************************************************************/ |
| 189 |
typedef struct _SKernelDebugDataLineTableEntry { |
| 190 |
uint32_t Offset; |
| 191 |
uint32_t LineColumnNumber; |
| 192 |
uint32_t FileIndex; |
| 193 |
} SKernelDebugDataLineTableEntry; |
| 194 |
|
| 195 |
}; // namespace iOpenCL |