Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a script to check for orphan definitions in the XML #730

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kpet
Copy link
Contributor

@kpet kpet commented Nov 25, 2021

Signed-off-by: Kevin Petit kevin.petit@arm.com
Change-Id: I041e48869da1ffd261ff6292819ed308136a7afd

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Change-Id: I041e48869da1ffd261ff6292819ed308136a7afd
@kpet
Copy link
Contributor Author

kpet commented Nov 25, 2021

Currently produces the following output:

Looking for orphan definitions in xml/cl.xml
Enum 'CL_HALF_DIG' is defined but not used in any core version or extension!
Enum 'CL_HALF_MANT_DIG' is defined but not used in any core version or extension!
Enum 'CL_HALF_MAX_10_EXP' is defined but not used in any core version or extension!
Enum 'CL_HALF_MAX_EXP' is defined but not used in any core version or extension!
Enum 'CL_HALF_MIN_10_EXP' is defined but not used in any core version or extension!
Enum 'CL_HALF_MIN_EXP' is defined but not used in any core version or extension!
Enum 'CL_HALF_RADIX' is defined but not used in any core version or extension!
Enum 'CL_HALF_MAX' is defined but not used in any core version or extension!
Enum 'CL_HALF_MIN' is defined but not used in any core version or extension!
Enum 'CL_HALF_EPSILON' is defined but not used in any core version or extension!
Enum 'CL_M_E' is defined but not used in any core version or extension!
Enum 'CL_M_LOG2E' is defined but not used in any core version or extension!
Enum 'CL_M_LOG10E' is defined but not used in any core version or extension!
Enum 'CL_M_LN2' is defined but not used in any core version or extension!
Enum 'CL_M_LN10' is defined but not used in any core version or extension!
Enum 'CL_M_PI' is defined but not used in any core version or extension!
Enum 'CL_M_PI_2' is defined but not used in any core version or extension!
Enum 'CL_M_PI_4' is defined but not used in any core version or extension!
Enum 'CL_M_1_PI' is defined but not used in any core version or extension!
Enum 'CL_M_2_PI' is defined but not used in any core version or extension!
Enum 'CL_M_2_SQRTPI' is defined but not used in any core version or extension!
Enum 'CL_M_SQRT2' is defined but not used in any core version or extension!
Enum 'CL_M_SQRT1_2' is defined but not used in any core version or extension!
Enum 'CL_M_E_F' is defined but not used in any core version or extension!
Enum 'CL_M_LOG2E_F' is defined but not used in any core version or extension!
Enum 'CL_M_LOG10E_F' is defined but not used in any core version or extension!
Enum 'CL_M_LN2_F' is defined but not used in any core version or extension!
Enum 'CL_M_LN10_F' is defined but not used in any core version or extension!
Enum 'CL_M_PI_F' is defined but not used in any core version or extension!
Enum 'CL_M_PI_2_F' is defined but not used in any core version or extension!
Enum 'CL_M_PI_4_F' is defined but not used in any core version or extension!
Enum 'CL_M_1_PI_F' is defined but not used in any core version or extension!
Enum 'CL_M_2_PI_F' is defined but not used in any core version or extension!
Enum 'CL_M_2_SQRTPI_F' is defined but not used in any core version or extension!
Enum 'CL_M_SQRT2_F' is defined but not used in any core version or extension!
Enum 'CL_M_SQRT1_2_F' is defined but not used in any core version or extension!
Enum 'CL_PIPE_FULL_INTEL' is defined but not used in any core version or extension!
Enum 'CL_PIPE_EMPTY_INTEL' is defined but not used in any core version or extension!
Enum 'CL_ERROR_RESERVED0_IMG' is defined but not used in any core version or extension!
Enum 'CL_ERROR_RESERVED1_IMG' is defined but not used in any core version or extension!
Enum 'CL_ERROR_RESERVED2_IMG' is defined but not used in any core version or extension!
Enum 'CL_ERROR_RESERVED3_IMG' is defined but not used in any core version or extension!
Enum 'CL_QUEUE_RESERVED_QCOM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED21_INTEL' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED22_INTEL' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED0_ARM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED1_ARM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED2_ARM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED3_ARM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED4_ARM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED0_QCOM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED1_QCOM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED2_QCOM' is defined but not used in any core version or extension!
Enum 'CL_MEM_RESERVED3_QCOM' is defined but not used in any core version or extension!
Enum 'CL_KHRONOS_VENDOR_ID_CODEPLAY' is defined but not used in any core version or extension!
Enum 'CL_KHRONOS_VENDOR_ID_POCL' is defined but not used in any core version or extension!
Enum 'CL_COMMAND_ACQUIRE_D3D9_OBJECTS_INTEL' is defined but not used in any core version or extension!
Enum 'CL_COMMAND_RELEASE_D3D9_OBJECTS_INTEL' is defined but not used in any core version or extension!
Enum 'CL_NV21' is defined but not used in any core version or extension!
Enum 'CL_YV12' is defined but not used in any core version or extension!
Enum 'CL_RESERVED0_IMG' is defined but not used in any core version or extension!
Enum 'CL_RESERVED1_IMG' is defined but not used in any core version or extension!
Enum 'CL_RESERVED2_IMG' is defined but not used in any core version or extension!
Enum 'CL_DEVICE_JOB_SLOTS_ARM' is defined but not used in any core version or extension!
Enum 'CL_QUEUE_JOB_SLOT_ARM' is defined but not used in any core version or extension!
Enum 'CL_KERNEL_ARG_HOST_ACCESSIBLE_PIPE_INTEL' is defined but not used in any core version or extension!
Enum 'CL_DEVICE_MAX_HOST_READ_PIPES_INTEL' is defined but not used in any core version or extension!
Enum 'CL_DEVICE_MAX_HOST_WRITE_PIPES_INTEL' is defined but not used in any core version or extension!
Type 'stdint' is defined but not used in any core version or extension!
Type 'd3d9.h' is defined but not used in any core version or extension!
Type 'd3d9types.h' is defined but not used in any core version or extension!
Type 'dxgiformat.h' is defined but not used in any core version or extension!
Type 'dxvahd.h' is defined but not used in any core version or extension!
Type 'wtypes.h' is defined but not used in any core version or extension!
Type 'ID3D10Buffer' is defined but not used in any core version or extension!
Type 'ID3D10Texture2D' is defined but not used in any core version or extension!
Type 'ID3D10Texture3D' is defined but not used in any core version or extension!
Type 'ID3D11Buffer' is defined but not used in any core version or extension!
Type 'ID3D11Texture2D' is defined but not used in any core version or extension!
Type 'ID3D11Texture3D' is defined but not used in any core version or extension!
Type 'IDirect3DSurface9' is defined but not used in any core version or extension!
Type 'D3DFORMAT' is defined but not used in any core version or extension!
Type 'HANDLE' is defined but not used in any core version or extension!
Type 'DXGI_FORMAT' is defined but not used in any core version or extension!
Type 'UINT' is defined but not used in any core version or extension!
Type 'va/va.h' is defined but not used in any core version or extension!
Type 'VASurfaceID' is defined but not used in any core version or extension!
Type 'VAImageFormat' is defined but not used in any core version or extension!
Type 'CL/cl_gl.h' is defined but not used in any core version or extension!
Type 'void' is defined but not used in any core version or extension!
Type 'char' is defined but not used in any core version or extension!
Type 'int' is defined but not used in any core version or extension!
Type 'unsigned char' is defined but not used in any core version or extension!
Type 'unsigned int' is defined but not used in any core version or extension!
Type 'intptr_t' is defined but not used in any core version or extension!
Type 'size_t' is defined but not used in any core version or extension!
Type 'float' is defined but not used in any core version or extension!
Type 'double' is defined but not used in any core version or extension!
Type 'int8_t' is defined but not used in any core version or extension!
Type 'int16_t' is defined but not used in any core version or extension!
Type 'int32_t' is defined but not used in any core version or extension!
Type 'int64_t' is defined but not used in any core version or extension!
Type 'uint8_t' is defined but not used in any core version or extension!
Type 'uint16_t' is defined but not used in any core version or extension!
Type 'uint32_t' is defined but not used in any core version or extension!
Type 'uint64_t' is defined but not used in any core version or extension!
Type 'cl_double' is defined but not used in any core version or extension!
Type 'cl_float' is defined but not used in any core version or extension!
Type 'cl_short' is defined but not used in any core version or extension!
Type 'cl_int' is defined but not used in any core version or extension!
Type 'cl_long' is defined but not used in any core version or extension!
Type 'cl_char' is defined but not used in any core version or extension!
Type 'cl_uchar' is defined but not used in any core version or extension!
Type 'cl_half' is defined but not used in any core version or extension!
Type 'cl_ushort' is defined but not used in any core version or extension!
Type 'cl_uint' is defined but not used in any core version or extension!
Type 'cl_ulong' is defined but not used in any core version or extension!
Type 'cl_GLint' is defined but not used in any core version or extension!
Type 'cl_GLenum' is defined but not used in any core version or extension!
Type 'cl_GLuint' is defined but not used in any core version or extension!
Type 'cl_properties' is defined but not used in any core version or extension!
Type 'cl_mem_alloc_flags_img' is defined but not used in any core version or extension!
Type 'cl_icd_dispatch' is defined but not used in any core version or extension!

Found 0 orphan commands.
Found 68 orphan enums.
Found 55 orphan types.

Some of these are obvious issues and should be fixed, others may require special casing in the checking script. I'm proposing we resolve all of these util the script reports zero and then make sure it is routinely run as part of the spec generation and CI.

@bashbaug
Copy link
Contributor

Neat!

I'm proposing we resolve all of these util the script reports zero and then make sure it is routinely run as part of the spec generation and CI.

This seems reasonable. Are you planning to fix most of these?

Some initial triage:

  • All of the CL_HALF_XXX enums could be treated analogous to the CL_FLT_XXX enums, which are currently assigned to core OpenCL 1.0 and listed in cl_platform.h.
  • All of the CL_M_XXX enums could also be assigned to core OpenCL 1.0 (they're also in cl_platform.h).
  • Most of the listed basic types are also in cl_platform.h. I guess we could assign them to core OpenCL 1.0 also? Do we want a separate XML section for platform enums and types?
  • Most of the other types are for extensions and we'll just need to assign them to the right extension.
  • I'll follow up regarding the Intel pipe enums.
    • Enum 'CL_PIPE_FULL_INTEL' is defined but not used in any core version or extension!
    • Enum 'CL_PIPE_EMPTY_INTEL' is defined but not used in any core version or extension!
    • Enum 'CL_KERNEL_ARG_HOST_ACCESSIBLE_PIPE_INTEL' is defined but not used in any core version or extension!
    • Enum 'CL_DEVICE_MAX_HOST_READ_PIPES_INTEL' is defined but not used in any core version or extension!
    • Enum 'CL_DEVICE_MAX_HOST_WRITE_PIPES_INTEL' is defined but not used in any core version or extension!
  • The correct names for these enums is DX9_OBJECTS, not D3D9_OBJECTS. The correct enums are already in the XML file so these can simply be removed:
    • Enum 'CL_COMMAND_ACQUIRE_D3D9_OBJECTS_INTEL' is defined but not used in any core version or extension!
    • Enum 'CL_COMMAND_RELEASE_D3D9_OBJECTS_INTEL' is defined but not used in any core version or extension!

@kpet
Copy link
Contributor Author

kpet commented Nov 30, 2021

Are you planning to fix most of these?

Can do but I'll need a bit of help with vendor extensions.

All of the CL_HALF_XXX enums could be treated analogous to the CL_FLT_XXX enums, which are currently assigned to core OpenCL 1.0 and listed in cl_platform.h.

Not sure I agree. These are currently provided by cl_khr_fp16. We still don't have FP16 support in core. This makes me wonder whether we should move them to cl_ext.h or maybe even cl_half.h. I note there are two sets of identical definitions for two compiler families as well.

All of the CL_M_XXX enums could also be assigned to core OpenCL 1.0 (they're also in cl_platform.h).
Most of the listed basic types are also in cl_platform.h. I guess we could assign them to core OpenCL 1.0 also?

That sounds reasonable. I'll double check they all were in 1.0.

Do we want a separate XML section for platform enums and types?

Maybe, could become useful as we move toward more generation.

Most of the other types are for extensions and we'll just need to assign them to the right extension.

We'll need a way of dealing with reserved enums as well. I'm thinking we could add a subtree similar to feature or extensions.

I'll follow up regarding the Intel pipe enums.

Thanks! Feel free to open a separate PR. I don't mind rebasing that one until the output is clean.

The correct names for these enums is DX9_OBJECTS, not D3D9_OBJECTS. The correct enums are already in the XML file so these can simply be removed:

Ok. I note there also seems to be an NVidia version of these using D3D9_OBJECTS that's commented out.

@bashbaug
Copy link
Contributor

All of the CL_HALF_XXX enums could be treated analogous to the CL_FLT_XXX enums, which are currently assigned to core OpenCL 1.0 and listed in cl_platform.h.

Not sure I agree. These are currently provided by cl_khr_fp16. We still don't have FP16 support in core. This makes me wonder whether we should move them to cl_ext.h or maybe even cl_half.h. I note there are two sets of identical definitions for two compiler families as well.

I think there's really two questions here:

  1. What should we do in the XML file to reflect what is currently in the headers? Since the CL_HALF_XXX enums are currently in cl_platform.h alongside the CL_FLT_XXX and CL_DBL_XXX enums I think it would make sense to treat them the same for now at least.
  2. Where do we want these enums moving forward, and is there a way to de-duplicate the values that are the same for all compilers?

We can do (1) to clean up the XML file while we're trying to figure out what to do for (2).

alycm added a commit to alycm/OpenCL-Docs that referenced this pull request Dec 8, 2021
@alycm
Copy link
Contributor

alycm commented Dec 8, 2021

Enum 'CL_KHRONOS_VENDOR_ID_CODEPLAY' is defined but not used in any core version or extension!
Enum 'CL_KHRONOS_VENDOR_ID_POCL' is defined but not used in any core version or extension!

I've handled these here: #737

Otherwise I don't really have anything to add beyond the existing comments. I support the principal of having the XML clean and kept so by CI.

Co-authored-by: Alastair Murray <alastair.murray@codeplay.com>
bashbaug pushed a commit that referenced this pull request Apr 29, 2022
* Link `cl_khronos_vendor_id` to OpenCL 3.0 in cl.xml

See script to check for orphans in #730

* Attach assigned vendor IDs to OpenCL 1.0

This is so that they can clearly be used for any OpenCL version.

* Move the cl_khronos_vendor_id type back to OpenCL 3.0

This was the version that introduced the type.
@kpet
Copy link
Contributor Author

kpet commented Aug 9, 2023

#960 adds uses for all types and enums except vendor definitions and reservations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants