src/runtime/directx/directx_module.cc
// invoke the function with void arguments
invoke the function with void arguments
invoke the function with void arguments
void DirectXWrappedFunc::operator()(TVMArgs args, TVMRetValue* rv, void** void_args) const {
  ThreadWorkLoad wl = launch_param_config_.Extract(args);
  auto dxdev = m_->workspace_->GetDefaultDirectXDevice();
  auto dev = m_->workspace_->GetDefaultDevice();
  std::vector<std::shared_ptr<DirectBuffer>> bufs;
  for (size_t i = 0; i < num_buffers_; i++) {
    auto ptr = (void*)args[i];
    bufs.push_back(m_->workspace_->RetrieveDataSpace(dev, ptr));
  }
  std::vector<uint32_t> block = {(uint32_t)wl.grid_dim(0), (uint32_t)wl.grid_dim(1),
                                 (uint32_t)wl.grid_dim(2)};
  std::vector<uint32_t> thread = {(uint32_t)wl.block_dim(0), (uint32_t)wl.block_dim(1),
                                  (uint32_t)wl.block_dim(2)};
  dxdev->dispatch(m_->compute_kernel_, bufs, func_name_, block, thread, false);
}
void DirectXWrappedFunc :: operator () ( TVMArgs args , TVMRetValue * rv , void * * void_args ) const { ThreadWorkLoad wl = launch_param_config_ . Extract ( args ) ; auto dxdev = m_ -> workspace_ -> GetDefaultDirectXDevice ( ) ; auto dev = m_ -> workspace_ -> GetDefaultDevice ( ) ; std :: vector < std :: shared_ptr < DirectBuffer > > bufs ; for ( size_t i = 0 ; i < num_buffers_ ; i ++ ) { auto ptr = ( void * ) args [ i ] ; bufs . push_back ( m_ -> workspace_ -> RetrieveDataSpace ( dev , ptr ) ) ; } std :: vector < uint32_t > block = { ( uint32_t ) wl . grid_dim ( 0 ) , ( uint32_t ) wl . grid_dim ( 1 ) , ( uint32_t ) wl . grid_dim ( 2 ) } ; std :: vector < uint32_t > thread = { ( uint32_t ) wl . block_dim ( 0 ) , ( uint32_t ) wl . block_dim ( 1 ) , ( uint32_t ) wl . block_dim ( 2 ) } ; dxdev -> dispatch ( m_ -> compute_kernel_ , bufs , func_name_ , block , thread , false ) ; }
invoke the function with void arguments
invoke the function with void arguments
// DirectX kernels: //    - Same arguments in one hlsl file, even different function; //    - No use of return value; //    - The pointer to memory is actually the index for buffer in workspace; // Launch the kernel with sync