Ewan Crawford commited on
Commit
5db8b21
·
1 Parent(s): b5c106e

sycl: Support sycl_ext_oneapi_limited_graph (llama/12873)

Browse files

The current usage of the SYCL-Graph extension checks for
the `sycl_ext_oneapi_graph` device aspect. However, it is also
possible to support `sycl_ext_oneapi_limied_graph` devices that
don't support update

Files changed (1) hide show
  1. ggml/src/ggml-sycl/ggml-sycl.cpp +6 -3
ggml/src/ggml-sycl/ggml-sycl.cpp CHANGED
@@ -3653,7 +3653,8 @@ static ggml_status ggml_backend_sycl_graph_compute(ggml_backend_t backend, ggml_
3653
 
3654
  #ifdef GGML_SYCL_GRAPH
3655
  if (!g_ggml_sycl_disable_graph) {
3656
- if (!sycl_ctx->exec_graph && !dpct::get_device(sycl_ctx->device).has(sycl::aspect::ext_oneapi_graph)) {
 
3657
  GGML_SYCL_DEBUG("[SYCL-GRAPH] can not use graphs on device:%d\n", sycl_ctx->device);
3658
  ggml_backend_sycl_graph_compute_impl(sycl_ctx, cgraph);
3659
  return GGML_STATUS_SUCCESS;
@@ -3664,8 +3665,10 @@ static ggml_status ggml_backend_sycl_graph_compute(ggml_backend_t backend, ggml_
3664
  ggml_backend_sycl_graph_compute_impl(sycl_ctx, cgraph);
3665
  model_sycl_graph.end_recording();
3666
 
3667
- if (!sycl_ctx->exec_graph) {
3668
- auto exec_graph = model_sycl_graph.finalize({sycl_ex::property::graph::updatable{}});
 
 
3669
  sycl_ctx->exec_graph = std::make_unique<
3670
  sycl_ex::command_graph<sycl_ex::graph_state::executable>>(exec_graph);
3671
  } else {
 
3653
 
3654
  #ifdef GGML_SYCL_GRAPH
3655
  if (!g_ggml_sycl_disable_graph) {
3656
+ const bool graph_support = dpct::get_device(sycl_ctx->device).has(sycl::aspect::ext_oneapi_limited_graph);
3657
+ if (!graph_support) {
3658
  GGML_SYCL_DEBUG("[SYCL-GRAPH] can not use graphs on device:%d\n", sycl_ctx->device);
3659
  ggml_backend_sycl_graph_compute_impl(sycl_ctx, cgraph);
3660
  return GGML_STATUS_SUCCESS;
 
3665
  ggml_backend_sycl_graph_compute_impl(sycl_ctx, cgraph);
3666
  model_sycl_graph.end_recording();
3667
 
3668
+ const bool graph_update_support = dpct::get_device(sycl_ctx->device).has(sycl::aspect::ext_oneapi_graph);
3669
+ if (!sycl_ctx->exec_graph || !graph_update_support) {
3670
+ auto exec_graph = graph_update_support ? model_sycl_graph.finalize(sycl_ex::property::graph::updatable{}) :
3671
+ model_sycl_graph.finalize();
3672
  sycl_ctx->exec_graph = std::make_unique<
3673
  sycl_ex::command_graph<sycl_ex::graph_state::executable>>(exec_graph);
3674
  } else {