oneapi-src / oneapi-src/level-zero

Convenience method for error processing

Open
#134 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi!

More often than not, error handling by the returned value takes the form of some macro checks that emit an exception or similar. E.g.,

#define L0_SAFE_CALL(call)                     \
  {                                            \
    auto status = (call);                      \
    if (status) {                              \
      throw some_exception(to_string(status)); \
    }                                          \
  }

To create a meaningful message it would be convenient to have a method in the loader that would take a single parameter - an error code - and return a string with the failure name. Even exposing the already-existing to_string function (https://github.com/oneapi-src/level-zero/blob/master/source/loader/ze_loader.cpp#L23) would be nice. This will make consumers not replicate it and avoid potential mismatches in case of any changes in the future.

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.

Research direction

Start in source/loader/ze_loader.cpp around the existing to_string function linked in the issue, then inspect how loader-facing error handling is exposed. Done means consumers can obtain a meaningful string for an error code without duplicating the failure-name mapping.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.