Skip to content

code snippets do not set pNext to null ptr when not used.  #131

@matcabral

Description

@matcabral

I think is causing confusion among users making them not set it and having code segfault.

1. https://spec.oneapi.io/level-zero/latest/core/PROG.html#initialization-and-discovery
ze_device_properties_t device_properties {};
device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;

2. Command Queue Groups
ze_command_queue_group_properties_t* cmdqueueGroupProperties = (ze_command_queue_group_properties_t*)
allocate(cmdqueueGroupCount * sizeof(ze_command_queue_group_properties_t));

3. Sub-Device Support
// Query sub-device properties.
ze_device_properties_t subdeviceProps {};
subDeviceProps.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES;

4. Interoperability with Other APIs
ze_module_desc_t desc = {
ZE_MODULE_FORMAT_NATIVE,
clDeviceBinarySize, <---- THIS WILL SEGFAULT
clDeviceBinary
};

5. Enabling/Disabling and Destruction
zet_tracer_exp_desc_t tracer_desc;
tracer_desc.stype = ZET_STRUCTURE_TYPE_TRACER_EXP_DESC;

6. Enumeration
also missing stype
zet_metric_group_properties_t
metricGroupProperties;

7. Metric Streamer
ze_event_desc_t eventDesc = {ZE_STRUCTURE_TYPE_EVENT_DESC};
zet_metric_streamer_desc_t metricStreamerDesc = {ZET_STRUCTURE_TYPE_METRIC_STREAMER_DESC};

8. Metric Query
ze_event_pool_desc_t eventPoolDesc = {ZE_STRUCTURE_TYPE_EVENT_POOL_DESC};
ze_event_desc_t eventDesc = {ZE_STRUCTURE_TYPE_EVENT_DESC};
zet_metric_query_pool_desc_t queryPoolDesc = {ZET_STRUCTURE_TYPE_METRIC_QUERY_POOL_DESC};

9. Calculation
zet_metric_properties_t metricProperties;

10. Device Debug Properties
also missing stype
zet_device_debug_properties_t props;

11. https://spec.oneapi.io/level-zero/latest/tools/PROG.html#device-thread-identification
ze_device_properties_t properties {};

12. https://spec.oneapi.io/level-zero/latest/sysman/PROG.html#initialization
ze_device_properties_t device_properties {}
device_properties.stype = ZE_STRUCTURE_TYPE_DEVICE_PROPERTIES

13. Device component enumeration
also missing stype
zes_freq_properties_t props

14. Sub-device management
zes_freq_properties_t props

15. Global operations
zes_device_properties_t devProps {}
zes_pci_properties_t pciProps;

16. Operations on power domains
2 times
zes_power_properties_t props
zes_power_limit_ext_desc_t * allLimits =
twice: allocate(limitCount * sizeof(zes_power_limit_ext_desc_t))

17. Scheduler operations
zes_sched_timeout_properties_t props

18. Enabling/disabling ECC Config Dynamically
This will segfault
zes_device_ecc_properties_t props = {ZES_DEVICE_ECC_STATE_UNAVAILABLE, ZES_DEVICE_ECC_STATE_UNAVAILABLE, ZES_DEVICE_ACTION_NONE}
zes_device_ecc_desc_t newState = ZES_DEVICE_ECC_STATE_ENABLED

19. Operations on Fabric ports
also missing stype
zes_fabric_port_properties_t props

20. Operations on fans
also missing stype
zes_fan_properties_t fanprops

21. Querying RAS errors
also missing stype
zes_ras_properties_t props

22. Performing Diagnostics
also missing stype
zes_diag_properties_t suiteProps

23. Linkage Inspection
// Create a linkage inspection descriptor
ze_linkage_inspection_ext_desc_t inspectDesc = {
ZE_LINKAGE_INSPECTION_EXT_FLAG_IMPORTS | ZE_LINKAGE_INSPECTION_EXT_FLAG_UNRESOLVABLE_IMPORTS | ZE_LINKAGE_INSPECTION_EXT_FLAG_EXPORTS
};

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions