PyTorch with Vulcan backend

username: nirs
cooked: <p>I found docs for building Vulcan backend:</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://docs.pytorch.org/tutorials/prototype/vulkan_workflow.html">
  <header class="source">

      <a href="https://docs.pytorch.org/tutorials/prototype/vulkan_workflow.html" target="_blank" rel="noopener nofollow ugc">docs.pytorch.org</a>
  </header>

  <article class="onebox-body">
    

<h3><a href="https://docs.pytorch.org/tutorials/prototype/vulkan_workflow.html" target="_blank" rel="noopener nofollow ugc">PyTorch Vulkan Backend User Workflow — PyTorch Tutorials 2.7.0+cu126...</a></h3>



  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>I want to use this to play with PyTorch in minikube krunkit driver on macOS:</p><aside class="onebox githubpullrequest" data-onebox-src="https://github.com/kubernetes/minikube/pull/20826">
  <header class="source">

      <a href="https://github.com/kubernetes/minikube/pull/20826" target="_blank" rel="noopener nofollow ugc">github.com/kubernetes/minikube</a>
  </header>

  <article class="onebox-body">
    <div class="github-row" data-github-private-repo="false">



    <div class="github-icon-container" title="Pull Request">
      <svg width="60" height="60" class="github-icon" viewBox="0 0 12 16" aria-hidden="true"><path fill-rule="evenodd" d="M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z"></path></svg>
    </div>

  <div class="github-info-container">



      <h4>
        <a href="https://github.com/kubernetes/minikube/pull/20826" target="_blank" rel="noopener nofollow ugc">WIP: krunkit driver</a>
      </h4>

    <div class="branches">
      <code>master</code> ← <code>nirs:krunkit</code>
    </div>

      <div class="github-info">
        <div class="date">
          opened <span class="discourse-local-date" data-format="ll" data-date="2025-05-23" data-time="19:11:24" data-timezone="UTC">07:11PM - 23 May 25 UTC</span>
        </div>

        <div class="user">
          <a href="https://github.com/nirs" target="_blank" rel="noopener nofollow ugc">
            <img alt="" src="https://avatars.githubusercontent.com/u/395026?v=4" class="onebox-avatar-inline" width="20" height="20">
            nirs
          </a>
        </div>

        <div class="lines" title="9 commits changed 25 files with 1074 additions and 886 deletions">
          <a href="https://github.com/kubernetes/minikube/pull/20826/files" target="_blank" rel="noopener nofollow ugc">
            <span class="added">+1074</span>
            <span class="removed">-886</span>
          </a>
        </div>
      </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">krunkit is a tool to launch configurable virtual machines using the libkrun plat<span class="show-more-container"><a href="https://github.com/kubernetes/minikube/pull/20826" target="_blank" rel="noopener nofollow ugc" class="show-more">…</a></span><span class="excerpt hidden">form, optimized for GPU accelerated virtual machines and AI workloads on Apple silicon.
    
It is mostly compatible with vfkit; the driver is a simplified copy of the vfkit driver.

To get accelerated gpu the arch iso was updated to longterm kernel 6.6.92 and Virtio GPU was enabled.

Limitations:

- Only one machine can be created since we use the same port for krunkit
  --restful-uri. This should be fix to use an unused port or use unix socket when supported[1]

[1] https://github.com/containers/krunkit/issues/47

Status:

- ✅ The machine boots
- ✅ Networking with vment-helper works
- ✅ /dev/dri/ is available
- ❌ qemu does does not boot with kernel 6.6

Based on these PRs for testing:
- #20832 
- #20831

Fixes #20803</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>It seems that I need to build it in a container, and copy the build results to a demo container. I wonder if the built artifacts are contained and easy to copy.</p>
<p>Or maybe we already have an example how to create a container with pythorch that I can reuse?</p>