api-query: Continue device initialization when a backend fails#1032
api-query: Continue device initialization when a backend fails#1032
Conversation
f4cbd80 to
de099b0
Compare
de099b0 to
d9b6e6a
Compare
|
LGTM |
d9b6e6a to
0fe8047
Compare
|
A few things:
|
0fe8047 to
1d5330c
Compare
Yup, the original claim that
@bogner just to make sure we're talking about the same commit message:
This explains why something is wrong together with an example case of when that has an effect (Vulkan init on MacOS), followed by how it was fixed (using Is that still too much? |
8a379ad to
68112e4
Compare
lib/API/Device.cpp
Outdated
| llvm::Expected<llvm::SmallVector<std::unique_ptr<Device>>> | ||
| offloadtest::initializeDevices(const DeviceConfig Config) { | ||
| llvm::SmallVector<std::unique_ptr<Device>> Devices; | ||
| llvm::Error Result = llvm::Error::success(); |
There was a problem hiding this comment.
I find the name Result a little confusing here, since it's just the error case of the result. Maybe Err would be a better name for this.
There was a problem hiding this comment.
The reason Err isn't chosen is because those are already used inside the if blocks to join into this Result. Perhaps we can rename those to E to allow this to become Err?
I was looking in the wrong place (this was before our other conversation about PR desciptions matching commit messages). This does look much better. I do still find this a little verbose where it goes into listing the specific APIs that its using, but that's mostly a matter of taste. |
Device::initialize() returns early when any backend fails to initialize, preventing subsequent backends from being discovered. For example, a Vulkan initialization failure (e.g. VK_ERROR_INCOMPATIBLE_DRIVER when MoltenVK is not installed) blocks Metal device discovery on macOS. Collect backend initialization errors with joinErrors() and return them together instead. Also make lit.cfg.py resilient to an empty device list from api-query. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Would dropping |
68112e4 to
53ead32
Compare
Device::initialize()returns early when any backend fails to initialize, preventing subsequent backends from being discovered. For example, a Vulkan initialization failure (e.g.VK_ERROR_INCOMPATIBLE_DRIVERwhen MoltenVK is not installed) blocks Metal device discovery on macOS.Collect backend initialization errors with
joinErrors()and return them together instead. Also makelit.cfg.pyresilient to an empty device list from api-query.Test plan
api-queryoutputs Metal device when Vulkan init fails (no MoltenVK)check-hlslruns Metal tests successfully with this change🤖 Generated with Claude Code