Skip to content

[SYCL] Improve error message when no compatible device image is found#21749

Merged
KornevNikita merged 1 commit intosyclfrom
fix/improve-no-compatible-device-error
Apr 23, 2026
Merged

[SYCL] Improve error message when no compatible device image is found#21749
KornevNikita merged 1 commit intosyclfrom
fix/improve-no-compatible-device-error

Conversation

@kweronsx
Copy link
Copy Markdown
Contributor

ProgramManager::getDeviceImage previously threw the same "No kernel named X was found" error for two distinct situations:

  • the kernel name is genuinely unknown (not registered at all), and
  • the kernel is known but no binary image in the fat binary targets the device being used at runtime.

The second case is typically caused by compiling for a different device architecture than the one executing the binary, which is a common user mistake. Conflating it with an unknown kernel name made the error misleading and hard to diagnose.

Introduce a KernelFound flag to distinguish the two paths and emit a dedicated message for the no-compatible-image case.

Comment on lines +1355 to +1356
std::string(KernelName) +
". The program may not have been compiled for this device.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string(KernelName) +
". The program may not have been compiled for this device.");
std::string(KernelName);

Nitpick: I'd prefer to keep exception messages on the shorter side and have them be just a basic description of the problem. The last sentence here is likely to be accurate, but I don't think it provides much value, so I would drop it. Might be a matter of personal taste though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you may be right, it seems to be somewhat of a matter of personal taste, but actually I agree. As the old saying goes: "when a program has nothing surprising, interesting or useful to say, it should say nothing".

@kweronsx kweronsx force-pushed the fix/improve-no-compatible-device-error branch from eaa5eb9 to 3019b95 Compare April 14, 2026 07:08
@bratpiorka bratpiorka requested a review from Maetveis April 14, 2026 08:49
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
Copy link
Copy Markdown
Contributor

@Maetveis Maetveis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a nit. Thank you!

@kweronsx kweronsx force-pushed the fix/improve-no-compatible-device-error branch from 3019b95 to 45e1f6a Compare April 14, 2026 10:51
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
@github-actions
Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@kweronsx kweronsx marked this pull request as draft April 15, 2026 06:15
@kweronsx kweronsx marked this pull request as ready for review April 15, 2026 07:32
@kweronsx kweronsx requested a review from Maetveis April 15, 2026 07:32
Copy link
Copy Markdown
Contributor

@Maetveis Maetveis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, few more nits, sorry :)

Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
Comment thread sycl/source/detail/device_binary_image.cpp
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
@kweronsx kweronsx marked this pull request as draft April 15, 2026 07:55
@kweronsx kweronsx marked this pull request as ready for review April 15, 2026 08:54
@kweronsx kweronsx requested a review from Maetveis April 15, 2026 08:54
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
Comment thread sycl/source/detail/program_manager/program_manager.cpp Outdated
@kweronsx kweronsx marked this pull request as draft April 15, 2026 11:46
@kweronsx kweronsx marked this pull request as ready for review April 15, 2026 12:10
@kweronsx kweronsx requested a review from Maetveis April 15, 2026 12:10
@kweronsx kweronsx force-pushed the fix/improve-no-compatible-device-error branch 2 times, most recently from 8f5ed8e to fd8e6e4 Compare April 21, 2026 10:06
ProgramManager::getDeviceImage previously threw the same "No kernel
named X was found" error for two distinct situations:
- the kernel name is genuinely unknown (not registered at all), and
- the kernel is known but no binary image in the fat binary targets
  the device being used at runtime.

The second case is typically caused by compiling for a different device
architecture than the one executing the binary, which is a common user
mistake. Conflating it with an unknown kernel name made the error
misleading and hard to diagnose.

Introduce a KernelFound flag to distinguish the two paths and emit a
dedicated message for the no-compatible-image case.
@bratpiorka
Copy link
Copy Markdown
Contributor

@kswiecicki ready to merge

@github-actions
Copy link
Copy Markdown
Contributor

@intel/llvm-gatekeepers please consider merging

@KornevNikita KornevNikita merged commit fdf3278 into sycl Apr 23, 2026
32 checks passed
@kweronsx kweronsx deleted the fix/improve-no-compatible-device-error branch April 23, 2026 10:26
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.

5 participants