Skip to content

Commit 26d7555

Browse files
author
Jaime Arteaga
authored
Fix pNext definition and code snippets (#128, #131)
Resolves: #125, #131 Signed-off-by: Jaime Arteaga <[email protected]>
1 parent d35632a commit 26d7555

File tree

8 files changed

+46
-30
lines changed

8 files changed

+46
-30
lines changed

scripts/core/EXT_Exp_BandwidthProperties.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ The following pseudo-code demonstrates a sequence for obtaining the copy bandwid
9292
${x}_copy_bandwidth_exp_properties_t* cmdqueueGroupBandwidth = (${x}_copy_bandwidth_exp_properties_t*)
9393
allocate(cmdqueueGroupCount * sizeof(${x}_copy_bandwidth_exp_properties_t));
9494
for( uint32_t i = 0; i < cmdqueueGroupCount; ++i ) {
95-
cmdqueueGroupProperties[i].stype = ZE_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES;
95+
cmdqueueGroupProperties[i].stype = ${X}_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES;
9696
cmdqueueGroupProperties[i].pNext = &cmdqueueGroupBandwidth[i];
97-
cmdqueueGroupBandwidth[i].stype = ZE_STRUCTURE_TYPE_COPY_BANDWIDTH_EXT_PROPERTIES;
97+
cmdqueueGroupBandwidth[i].stype = ${X}_STRUCTURE_TYPE_COPY_BANDWIDTH_EXP_PROPERTIES;
9898
cmdqueueGroupBandwidth[i].pNext = nullptr;
9999
}
100100
${x}DeviceGetCommandQueueGroupProperties(hDevice, &cmdqueueGroupCount, cmdqueueGroupProperties);

scripts/core/EXT_LinkageInspection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ The following psuedo-code demonstrates a sequence for inspecting the import depe
5050
5151
...
5252
// Create a linkage inspection descriptor
53-
${x}_linkage_inspection_ext_desc_t inspectDesc = {
53+
${x}_linkage_inspection_ext_desc_t inspectDesc = {${X}_STRUCTURE_TYPE_LINKAGE_INSPECTION_EXT_DESC, nullptr,
5454
${X}_LINKAGE_INSPECTION_EXT_FLAG_IMPORTS | ${X}_LINKAGE_INSPECTION_EXT_FLAG_UNRESOLVABLE_IMPORTS | ${X}_LINKAGE_INSPECTION_EXT_FLAG_EXPORTS
5555
};
5656
${x}_module_build_log_handle_t linkLog;

scripts/core/PROG.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,8 @@ The following pseudo-code demonstrates a basic sequence for discovery of command
728728
729729
${x}_command_queue_group_properties_t* cmdqueueGroupProperties = (${x}_command_queue_group_properties_t*)
730730
allocate(cmdqueueGroupCount * sizeof(${x}_command_queue_group_properties_t));
731+
cmdqueueGroupProperties[ i ].stype = ${X}_STRUCTURE_TYPE_COMMAND_QUEUE_GROUP_PROPERTIES;
732+
cmdqueueGroupProperties[ i ].pNext = nullptr;
731733
${x}DeviceGetCommandQueueGroupProperties(hDevice, &cmdqueueGroupCount, cmdqueueGroupProperties);
732734
733735
@@ -1891,6 +1893,8 @@ The following pseudo-code demonstrates interoperability with OpenCL *from* a Ope
18911893
clGetProgramInfo(cl_program, CL_PROGRAM_BINARIES, clDeviceBinary, &clDeviceBinarySize);
18921894
18931895
${x}_module_desc_t desc = {
1896+
${X}_STRUCTURE_TYPE_MODULE_DESC,
1897+
nullptr,
18941898
${X}_MODULE_FORMAT_NATIVE,
18951899
clDeviceBinarySize,
18961900
clDeviceBinary

scripts/core/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ members:
552552
desc: "[in] type of this structure"
553553
- type: "void*"
554554
name: pNext
555-
desc: "[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
555+
desc: "[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
556556
init: nullptr
557557
--- #--------------------------------------------------------------------------
558558
type: struct
@@ -564,7 +564,7 @@ members:
564564
desc: "[in] type of this structure"
565565
- type: "const void*"
566566
name: pNext
567-
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
567+
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
568568
init: nullptr
569569
--- #--------------------------------------------------------------------------
570570
type: env

scripts/sysman/PROG.rst

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ supported:
382382
allocate_memory(numFreqDomains * sizeof(${s}_freq_handle_t))
383383
if (${s}DeviceEnumFrequencyDomains(hSysmanDevice, &numFreqDomains, pFreqHandles) == ${X}_RESULT_SUCCESS)
384384
for (index = 0 .. numFreqDomains-1)
385-
${s}_freq_properties_t props
385+
${s}_freq_properties_t props {};
386+
props.stype = ${S}_STRUCTURE_TYPE_FREQ_PROPERTIES;
386387
if (${s}FrequencyGetProperties(pFreqHandles[index], &props) == ${X}_RESULT_SUCCESS)
387388
# Only change the frequency of the domain if:
388389
# 1. The domain controls a GPU accelerator
@@ -424,7 +425,8 @@ sub-device (notice the additional sub-device check):
424425
allocate_memory(numFreqDomains * sizeof(${s}_freq_handle_t))
425426
if (${s}DeviceEnumFrequencyDomains(hSysmanDevice, &numFreqDomains, pFreqHandles) == ${X}_RESULT_SUCCESS)
426427
for (index = 0 .. numFreqDomains-1)
427-
${s}_freq_properties_t props
428+
${s}_freq_properties_t props {};
429+
props.stype = ${S}_STRUCTURE_TYPE_FREQ_PROPERTIES;
428430
if (${s}FrequencyGetProperties(pFreqHandles[index], &props) == ${X}_RESULT_SUCCESS)
429431
# Only change the frequency of the domain if:
430432
# 1. The domain controls a GPU accelerator
@@ -597,7 +599,8 @@ The pseudo code below shows how to output the PCI BDF address:
597599
.. parsed-literal::
598600
599601
function ShowPciInfo(${s}_device_handle_t hSysmanDevice)
600-
${s}_pci_properties_t pciProps;
602+
${s}_pci_properties_t pciProps {};
603+
pciProps.stype = ${S}_STRUCTURE_TYPE_PCI_PROPERTIES;
601604
if (${s}DevicePciGetProperties(hSysmanDevice, &pciProps) == ${X}_RESULT_SUCCESS)
602605
output(" PCI address: %04u:%02u:%02u.%u",
603606
pciProps.address.domain,
@@ -792,7 +795,8 @@ domain on a device:
792795
allocate_memory(numPowerDomains * sizeof(${s}_pwr_handle_t))
793796
if (${s}DeviceEnumPowerDomains(hSysmanDevice, &numPowerDomains, phPower) == ${X}_RESULT_SUCCESS)
794797
for (pwrIndex = 0 .. numPowerDomains-1)
795-
${s}_power_properties_t props
798+
${s}_power_properties_t props {};
799+
props.stype = ${S}_STRUCTURE_TYPE_POWER_PROPERTIES;
796800
if (${s}PowerGetProperties(phPower[pwrIndex], &props) == ${X}_RESULT_SUCCESS)
797801
if (props.onSubdevice)
798802
output("Sub-device %u power:\n", props.subdeviceId)
@@ -808,7 +812,7 @@ domain on a device:
808812
function ShowPowerLimits(${s}_pwr_handle_t hPower)
809813
uint32_t limitCount = 0
810814
if (${s}PowerGetLimitsExt(hPower, &limitCount, nullptr) == ${X}_RESULT_SUCCESS)
811-
${s}_power_limit_ext_desc_t * allLimits = allocate(limitCount * sizeof(${s}_power_limit_ext_desc_t))
815+
${s}_power_limit_ext_desc_t * allLimits = allocate(limitCount * sizeof(${s}_power_limit_ext_desc_t));
812816
if (${s}PowerGetLimitsExt(hPower, &numLimits, allLimits) == ${X}_RESULT_SUCCESS)
813817
814818
for (i = 0; i < limitCount; ++i)
@@ -827,11 +831,12 @@ domain found on a device:
827831
allocate_memory(numPowerDomains * sizeof(${s}_pwr_handle_t))
828832
if (${s}DeviceEnumPowerDomains(hSysmanDevice, &numPowerDomains, phPower) == ${X}_RESULT_SUCCESS)
829833
for (pwrIndex = 0 .. numPowerDomains-1)
830-
${s}_power_properties_t props
834+
${s}_power_properties_t props {};
835+
props.stype = ${S}_STRUCTURE_TYPE_POWER_PROPERTIES;
831836
if (${s}PowerGetProperties(phPower[pwrIndex], &props) == ${X}_RESULT_SUCCESS)
832837
uint32_t limitCount = 0
833838
if (${s}PowerGetLimitsExt(hPower, &limitCount, nullptr) == ${X}_RESULT_SUCCESS)
834-
${s}_power_limit_ext_desc_t * allLimits = allocate(limitCount * sizeof(${s}_power_limit_ext_desc_t))
839+
${s}_power_limit_ext_desc_t * allLimits = allocate(limitCount * sizeof(${s}_power_limit_ext_desc_t));
835840
if (${s}PowerGetLimitsExt(hPower, &numLimits, allLimits) == ${X}_RESULT_SUCCESS)
836841
for (i = 0; i < limitCount; ++i)
837842
if (allLimits[i].level == ${S}_POWER_LEVEL_SUSTAINED)
@@ -1586,7 +1591,8 @@ the device and sub-devices:
15861591
free_memory(...)
15871592
15881593
function ShowFabricPortInfo(${s}_fabric_port_handle_t hPort)
1589-
${s}_fabric_port_properties_t props
1594+
${s}_fabric_port_properties_t props {};
1595+
props.stype = ${S}_STRUCTURE_TYPE_FABRIC_PORT_PROPERTIES;
15901596
if (${s}FabricPortGetProperties(hPort, &props) == ${X}_RESULT_SUCCESS)
15911597
${s}_fabric_port_state_t state
15921598
if (${s}FabricPortGetState(hPort, &state) == ${X}_RESULT_SUCCESS)
@@ -1826,7 +1832,8 @@ value in RPM, but only if control is permitted:
18261832
speedRequest.speed = SpeedRpm
18271833
speedRequest.speedUnits = ${S}_FAN_SPEED_UNITS_RPM
18281834
for (fanIndex = 0 .. numFans-1)
1829-
${s}_fan_properties_t fanprops
1835+
${s}_fan_properties_t fanprops {};
1836+
fanprops.stype = ${S}_STRUCTURE_TYPE_FAN_PROPERTIES;
18301837
if (${s}FanGetProperties(phFans[fanIndex], &fanprops) == ${X}_RESULT_SUCCESS)
18311838
if (fanprops.canControl)
18321839
${s}FanSetFixedSpeedMode(phFans[fanIndex], &speedRequest)
@@ -2024,7 +2031,8 @@ current state of RAS errors:
20242031
allocate_memory(numRasErrorSets * sizeof(${s}_ras_handle_t))
20252032
if (${s}DeviceEnumRasErrorSets(hSysmanDevice, &numRasErrorSets, phRasErrorSets) == ${X}_RESULT_SUCCESS)
20262033
for (rasIndex = 0 .. numRasErrorSets)
2027-
${s}_ras_properties_t props
2034+
${s}_ras_properties_t props {};
2035+
props.stype = ${S}_STRUCTURE_TYPE_RAS_PROPERTIES;
20282036
if (${s}RasGetProperties(phRasErrorSets[rasIndex], &props) == ${X}_RESULT_SUCCESS)
20292037
var pErrorType
20302038
switch (props.type)
@@ -2146,7 +2154,8 @@ tests in each:
21462154
for (suiteIndex = 0 .. numTestSuites-1)
21472155
uint32_t numTests = 0
21482156
${s}_diag_test_t* pTests
2149-
${s}_diag_properties_t suiteProps
2157+
${s}_diag_properties_t suiteProps {};
2158+
suiteProps.stype = ${S}_STRUCTURE_TYPE_DIAG_PROPERTIES;
21502159
if (${s}DiagnosticsGetProperties(phTestSuites[suiteIndex], &suiteProps) != ${X}_RESULT_SUCCESS)
21512160
next_loop(suiteIndex)
21522161
output("Diagnostic test suite %s:", suiteProps.name)

scripts/sysman/common.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ members:
206206
desc: "[in] type of this structure"
207207
- type: "void*"
208208
name: pNext
209-
desc: "[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
209+
desc: "[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
210210
init: nullptr
211211
--- #--------------------------------------------------------------------------
212212
type: struct
@@ -218,7 +218,7 @@ members:
218218
desc: "[in] type of this structure"
219219
- type: "const void*"
220220
name: pNext
221-
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
221+
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
222222
init: nullptr
223223
--- #--------------------------------------------------------------------------
224224
type: struct
@@ -230,7 +230,7 @@ members:
230230
desc: "[in] type of this structure"
231231
- type: "const void*"
232232
name: pNext
233-
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
233+
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
234234
init: nullptr
235235
--- #--------------------------------------------------------------------------
236236
type: struct
@@ -242,7 +242,7 @@ members:
242242
desc: "[in] type of this structure"
243243
- type: "const void*"
244244
name: pNext
245-
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
245+
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
246246
init: nullptr
247247
--- #--------------------------------------------------------------------------
248248
type: struct
@@ -254,5 +254,5 @@ members:
254254
desc: "[in] type of this structure"
255255
- type: "const void*"
256256
name: pNext
257-
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains sType and pNext)."
257+
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
258258
init: nullptr

scripts/tools/PROG.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ The following pseudo-code demonstrates a basic usage of API tracing:
143143
void TracingExample( ... )
144144
{
145145
my_tracer_data_t tracer_data = {};
146-
${t}_tracer_exp_desc_t tracer_desc;
146+
${t}_tracer_exp_desc_t tracer_desc {};
147147
tracer_desc.stype = ${T}_STRUCTURE_TYPE_TRACER_EXP_DESC;
148148
tracer_desc.pUserData = &tracer_data;
149149
${t}_tracer_exp_handle_t hTracer;
@@ -292,7 +292,8 @@ measurements.
292292
for( i = 0; i < metricGroupCount; i++ )
293293
{
294294
// Get metric group under index 'i' and its properties
295-
${t}_metric_group_properties_t metricGroupProperties;
295+
${t}_metric_group_properties_t metricGroupProperties {};
296+
metricGroupProperties.stype = ${T}_STRUCTURE_TYPE_METRIC_GROUP_PROPERTIES;
296297
${t}MetricGroupGetProperties( phMetricGroups[i], &metricGroupProperties );
297298
298299
printf("Metric Group: %s\n", metricGroupProperties.name);
@@ -437,12 +438,12 @@ The following pseudo-code demonstrates a basic sequence for query-based collecti
437438
{
438439
${t}_metric_group_handle_t hMetricGroup = nullptr;
439440
${x}_event_handle_t hCompletionEvent = nullptr;
440-
${x}_event_pool_desc_t eventPoolDesc = {${X}_STRUCTURE_TYPE_EVENT_POOL_DESC};
441-
${x}_event_desc_t eventDesc = {${X}_STRUCTURE_TYPE_EVENT_DESC};
441+
${x}_event_pool_desc_t eventPoolDesc = {${X}_STRUCTURE_TYPE_EVENT_POOL_DESC, nullptr};
442+
${x}_event_desc_t eventDesc = {${X}_STRUCTURE_TYPE_EVENT_DESC, nullptr};
442443
${x}_event_pool_handle_t hEventPool = nullptr;
443444
${t}_metric_query_pool_handle_t hMetricQueryPool = nullptr;
444445
${t}_metric_query_handle_t hMetricQuery = nullptr;
445-
${t}_metric_query_pool_desc_t queryPoolDesc = {${T}_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC};
446+
${t}_metric_query_pool_desc_t queryPoolDesc = {${T}_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC, nullptr};
446447
447448
// Find a "ComputeBasic" metric group suitable for Event Based collection
448449
FindMetricGroup( hDevice, "ComputeBasic", ${T}_METRIC_GROUP_SAMPLING_TYPE_FLAG_EVENT_BASED, &hMetricGroup );
@@ -533,7 +534,8 @@ The following pseudo-code demonstrates a basic sequence for metric calculation a
533534
{
534535
${t}_typed_value_t data = metricValues[report * metricCount + metric];
535536
536-
${t}_metric_properties_t metricProperties;
537+
${t}_metric_properties_t metricProperties {};
538+
metricProperties.stype = ${T}_STRUCTURE_TYPE_METRIC_PROPERTIES;
537539
${t}MetricGetProperties( phMetrics[ metric ], &metricProperties );
538540
539541
printf("Metric: %s\n", metricProperties.name );
@@ -675,7 +677,8 @@ Support for attaching debuggers is indicated by the ${T}_DEVICE_DEBUG_PROPERTY_F
675677

676678
.. parsed-literal::
677679
678-
${t}_device_debug_properties_t props;
680+
${t}_device_debug_properties_t props {};
681+
props.stype = ${T}_STRUCTURE_TYPE_DEVICE_DEBUG_PROPERTIES;
679682
${t}DeviceGetDebugProperties(hDevice, &props);
680683
681684
if (${T}_DEVICE_DEBUG_PROPERTY_FLAG_ATTACH & props.flags == 0)

scripts/tools/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ members:
121121
desc: "[in] type of this structure"
122122
- type: "void*"
123123
name: pNext
124-
desc: "[in,out][optional] pointer to extension-specific structure"
124+
desc: "[in,out][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
125125
init: nullptr
126126
--- #--------------------------------------------------------------------------
127127
type: struct
@@ -133,7 +133,7 @@ members:
133133
desc: "[in] type of this structure"
134134
- type: "const void*"
135135
name: pNext
136-
desc: "[in][optional] pointer to extension-specific structure"
136+
desc: "[in][optional] must be null or a pointer to an extension-specific structure (i.e. contains stype and pNext)."
137137
init: nullptr
138138
--- #--------------------------------------------------------------------------
139139
type: enum

0 commit comments

Comments
 (0)