Provide defines for build-time (header) version checks

Open
#111 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, cpp
Domain
api, build-system

Research direction

The requested change is centered on ze_api.h; start by reviewing the header's existing version information and the release process that updates it. Add build-time version defines usable by C/C++ consumers, and verify that older headers can be distinguished from the minimum version required by a program.

Written by the indexing model from the issue text.

Description

Currently building L0 programs give "mystery" errors if system L0 headers are not new enough.

It would be much user-friendlier if ze_api.h would include defines that can be used to check whether L0 headers are new enough, and which are (automatically) updated on every release.

E.g. with something like this:

#define L0_HEADER_MAJOR 1
#define L0_HEADER_MINOR 9
#define L0_HEADER_PATCHLEVEL 9
#define L0_HEADER_VERSION (L0_HEADER_MAJOR * 10000 + L0_HEADER_MINOR * 100  + L0_HEADER_PATCHLEVEL)

Code could then give much better error:

# if L0_HEADER_VERSION < 10909
#  error "At least version v1.9.9 of the L0 header(s) required"
#endif

(L0_HEADER_VERSION obviously assumes that project does not use more than 99 minor & patchlevel versions.)

PS. This is needed because doing package / pkg-config version check is not enough for all cases. Even if system would have new enough version installed from distro packages, code could e.g. be getting some older version from /usr/local/include. Or user could be directly compiling C/C++ files for self-contained L0 utilities.

Dominant language
C++
Stars
335
Forks
140
Avg merge
12h 32m
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from oneapi-src/level-zero

All issues in oneapi-src/level-zero

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.