Fix the clang issue due to empty structure in the Tracing Layer#432
Fix the clang issue due to empty structure in the Tracing Layer#432pratikbariintel wants to merge 3 commits intooneapi-src:masterfrom
Conversation
A dummy void pointer is added whenever the structure to be generated is empty. Related-To: NEO-17790 Signed-off-by: Pratik Bari <pratik.bari@intel.com>
A dummy void pointer is added whenever the structure to be generated is empty. Related-To: NEO-17790 Signed-off-by: Pratik Bari <pratik.bari@intel.com>
Use void* instead of empty zer_get_default_context_params_t structure for parameter-less callbacks to fix Clang compilation. Related-To: NEO-17790 Signed-off-by: Pratik Bari <pratik.bari@intel.com>
|
|
||
| typedef void (ZE_APICALL *zer_pfnGetDefaultContextCb_t)( | ||
| zer_get_default_context_params_t* params, | ||
| void* params, |
There was a problem hiding this comment.
Why do we need void * params.
If empty params, if possible, lets skip this member variable
There was a problem hiding this comment.
Currently all the callbacks defined have the same pattern. In case this field is not required we have to define a new callback pattern.
There was a problem hiding this comment.
So this data type is used in the exported function call:
ZE_APIEXPORT ze_result_t ZE_APICALL
zelTracerGetDefaultContextRegisterCallback(
zel_tracer_handle_t hTracer,
zel_tracer_reg_t callback_type,
zer_pfnGetDefaultContextCb_t pfnGetDefaultContextCb
);
So while it won't break immediate compilation or exported function ABI, the public struct type zer_pfnGetDefaultContextCb_t is changing in it's struct members. Thinking through this out loud.. The struct remains the same size, and void* also remains the same size.
The problem is the callback itself, the user must typecast it to match our callback data type, i.e. you see this yourself in the test content. It breaks how the user must define the actual callback API. This is my fear that, yes, this breaks ABI compatibility. Can instead of going this route, perhaps insert a placeholder void member; or something into the actual data structure, to avoid the clang warning?
There was a problem hiding this comment.
Can instead of going this route, perhaps insert a placeholder void member; or something into the actual data structure, to avoid the clang warning?
That would change the size of the structure ? Which might again be an ABI issue.
|
LGTM |
|
|
||
| typedef void (ZE_APICALL *zer_pfnGetDefaultContextCb_t)( | ||
| zer_get_default_context_params_t* params, | ||
| void* params, |
There was a problem hiding this comment.
The function pointer signature is changed in tracing header.
Just thinking about whether this breaks backward compatibility
Use void* instead of empty zer_get_default_context_params_t structure for parameter-less callbacks to fix Clang compilation.
Related-To: NEO-17790
Signed-off-by: Pratik Bari pratik.bari@intel.com