Code Monkey home page Code Monkey logo

Comments (5)

Sarbojit2019 avatar Sarbojit2019 commented on June 3, 2024

@pvelesko, Sycl defers lz queue creation until any work gets submitted to the device hence "get_nativesycl::backend::level_zero();" is returning nullptr in samples/sycl_hip_interop. I modified the sample to add dummy task before query Native handle, what that I could see non-zero queue handle for "get_nativesycl::backend::level_zero();". Please take a look at the attached modified sample.

However this fix exposed a bug in the CHIP-SPV runtime teardown case for which I have raised a fix in PR#280
sycl_chip_interop.cpp.txt

from chipstar.

Sarbojit2019 avatar Sarbojit2019 commented on June 3, 2024

Closing it as "not a bug" feel free to re-open in case you feel it is otherwise.

from chipstar.

pvelesko avatar pvelesko commented on June 3, 2024

@Sarbojit2019 Queue handle is not being used.

void CHIPBackendLevel0::initializeFromNative(const uintptr_t *NativeHandles,
                                             int NumHandles) {
  logTrace("CHIPBackendLevel0 InitializeNative");
  MinQueuePriority_ = ZE_COMMAND_QUEUE_PRIORITY_PRIORITY_HIGH;

  ze_driver_handle_t Drv = (ze_driver_handle_t)NativeHandles[0];
  ze_device_handle_t Dev = (ze_device_handle_t)NativeHandles[1];
  ze_context_handle_t Ctx = (ze_context_handle_t)NativeHandles[2];

  CHIPContextLevel0 *ChipCtx = new CHIPContextLevel0(Drv, Ctx);
  ChipCtx->setZeContextOwnership(false);
  addContext(ChipCtx);

  CHIPDeviceLevel0 *ChipDev = CHIPDeviceLevel0::create(Dev, ChipCtx, 0);
  ChipCtx->setDevice(ChipDev);

  LOCK(Backend->BackendMtx); // CHIPBackendLevel0::StaleEventMonitor
  ChipDev->LegacyDefaultQueue = ChipDev->createQueue(NativeHandles, NumHandles);

  StaleEventMonitor_ =
      (CHIPStaleEventMonitorLevel0 *)Backend->createStaleEventMonitor_();
  CallbackEventMonitor_ =
      (CHIPCallbackEventMonitorLevel0 *)Backend->createCallbackEventMonitor_();
  setActiveDevice(ChipDev);
}

from chipstar.

Sarbojit2019 avatar Sarbojit2019 commented on June 3, 2024

@pvelesko
CHIP-SPV does use native queue handle passed, check the below code.

CHIPQueue *CHIPDeviceLevel0::createQueue(const uintptr_t *NativeHandles,
                                         int NumHandles) {
  ze_command_queue_handle_t CmdQ = (ze_command_queue_handle_t)NativeHandles[3];
  CHIPQueueLevel0 *NewQ;
  if (!CmdQ) {
    logWarn("initializeFromNative: native queue pointer is null. Creating a "
            "new queue");
    NewQ = new CHIPQueueLevel0(this, 0, 0);
  } else {
    NewQ = new CHIPQueueLevel0(this, CmdQ);
    // In this case CHIP does not own the queue hence setting right ownership
    if (NewQ != nullptr) {
      NewQ->setCmdQueueOwnership(false);
    }
  }

  return NewQ;
}

from chipstar.

pvelesko avatar pvelesko commented on June 3, 2024

oh my bad

from chipstar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.