intel / intel/llvm

Using get_backend on an event from a host task hits an assert

Open
#11,479 0 comments 0 reactions 0 assignees View on GitHub
bug confirmed
Dominant language
LLVM
Stars
1.5k
Forks
854
Avg merge
3d 17h
Merged PRs (30d)
137

Description

**Describe the bug**

Using `get_backend` on a SYCL event returned from a submission of a host task hits an assert.

**To Reproduce**

Build and run the following code sample:

```cpp
#include

int main()
{
sycl::queue q;

sycl::event e = q.submit([&](sycl::handler &cgh) { cgh.host_task([] {}); });

if (e.get_backend() == sycl::backend::ext_oneapi_cuda) {
printf("cuda\n");
}

return 0;
}

```

It will crash with:
```
% ./t
t: /home/nicolas/oneapi/llvm/sycl/source/detail/backend_impl.hpp:18: sycl::_V1::backend sycl::_V1::detail::getImplBackend(const T&) [with T = std::shared_ptr]: Assertion `!Impl->is_host() && "Cannot get the backend for host."' failed.
[1] 11525 IOT instruction (core dumped) ./t
```

Contributor guide

Open the contributing guide

Research direction

Start with the reproducer using a SYCL queue, host_task, and event.get_backend(), then inspect sycl/source/detail/backend_impl.hpp at the assertion in getImplBackend. Determine the intended behavior for a host event's backend query and verify that the sample no longer aborts while preserving backend reporting for non-host events.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.