Skip to content

xe: place small CPU-mapped VRAM BOs in the visible window on small-BAR devices - #1046

Open
joshuaswarren wants to merge 2 commits into
intel:masterfrom
joshuaswarren:xe-small-bar-visible-vram
Open

joshuaswarren wants to merge 2 commits into
intel:masterfrom
joshuaswarren:xe-small-bar-visible-vram

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 2, 2026 •

Copy link
Copy Markdown

Problem: on an Arc Pro B60 without resizable BAR (USB4 eGPU, aarch64 host), NEO dies with SIGBUS in DrmMemoryManager::copyMemoryToAllocationBanks. gdb shows the fault on the first byte store into a fresh GEM mmap, so the kernel could not back the page: the BO sits in VRAM outside the CPU-visible window.

The same fault later hits clCreateBuffer with a host pointer (copyHostPointer, 2 MiB BO).

Change: request DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM for VRAM-placed BOs up to 16 MiB. The xe uAPI documents the flag as a no-op on full-BAR devices. The size limit keeps large allocations from using up the visible window; it stands in for "CPU-mapped" because createGemExt does not know the mapping intent. A map-intent hint from the caller would be cleaner, if you prefer that.

Test: with this change plus two local aarch64 build fixes, clinfo lists the B60 and an online_test (clBuildProgram with IGC) prints ONLINE_BUILD_OK. Kernel execution then fails separately (clEnqueueNDRangeKernel returns -5); that is not part of this PR. I built and tested against an older pinned tree, not this master, and I did not run the unit tests.

…ll-BAR devices

On a device without resizable BAR, a VRAM BO that is not placed in the CPU-visible
window raises SIGBUS on the first CPU access. NEO hits this when it copies the SIP
kernel into its allocation and when clCreateBuffer copies a host pointer into a
VRAM BO. Request DRM_XE_GEM_CREATE_FLAG_NEEDS_VISIBLE_VRAM for VRAM-placed BOs up
to 16 MiB. The kernel treats the flag as a no-op on full-BAR devices.
@joshuaswarren

Copy link
Copy Markdown
Author

Pushed a second commit: the memory-info create path (the one that takes size and the region bitmask) had the same gap. With PrintBOCreateDestroyResult on a B60 run, every VRAM-placed BO now shows flags=0x4. The earlier run showed one 4 KiB VRAM BO with flags=0x0.

@joshuaswarren

Copy link
Copy Markdown
Author

On a 16-inch M1 Max, the patched runtime enumerated an Arc Pro B60 and built an OpenCL kernel. Kernel execution still returned CL_OUT_OF_RESOURCES, and the current PR head has not been runtime-tested. What additional test would help review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant