﻿# Embree SYCL geometry buffers: keep explicit host and device views synchronized

Manage Embree shared geometry on Intel GPU workers with explicit host/device pointers, valid view layout and application-owned synchronization rather than assuming shared means coherent.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-embree-sycl-explicit-host-device-buffer-coherence/
Language: en

## Identify the actual memory model

A renderer ported from CPU execution can assume that a geometry pointer is visible wherever traversal runs. That assumption needs review on a discrete GPU. The [Embree SYCL guide](https://github.com/RenderKit/embree/blob/423865d4a0b7ab6cf9bcf8e5df9cab31bcbfc1c6/doc/src/api.md) documents Intel GPU execution and the relationship between host setup and device tracing. Check the installed release's supported memory paths before retaining an older unified-memory assumption or treating an ordinary host pointer as a device-accessible geometry resource.

## Bind an explicit view contract

The [host/device buffer reference](https://github.com/RenderKit/embree/blob/423865d4a0b7ab6cf9bcf8e5df9cab31bcbfc1c6/doc/src/api/rtcSetSharedGeometryBufferHostDevice.md) describes application-managed host and device pointers together with offset, stride, format and element count. These fields define a view rather than an arbitrary byte array. Preserve the intended geometry interpretation on both sides. A matching allocation size does not establish matching element layout, especially when imported vertex structs contain additional attributes or padding unused by the acceleration builder.

## Keep synchronization an application responsibility

The buffer contract explicitly assigns host/device synchronization to the application and requires host data to be updated before relevant scene commits. Changing only the device copy can leave host-side construction observing another version; changing only the host copy does not establish that tracing sees the intended device data. Maintain an explicit geometry version and completed-transfer boundary. Binding pointers is separate from proving that both allocations contain the same intended positions at the required stage.

## Preserve memory lifetime through use

The same reference requires user-managed storage to remain valid while the buffer can be used. Scene or geometry handle ownership does not automatically free or retain an unrelated application allocation. The [scene-commit documentation](https://github.com/RenderKit/embree/blob/423865d4a0b7ab6cf9bcf8e5df9cab31bcbfc1c6/doc/src/api/rtcCommitScene.md) also separates modification, commit and ray queries. Coordinate these phases before reusing geometry storage for another frame, and follow the selected commit variant's completion contract rather than assuming every operation has the same blocking behavior.

## Validate a visibly changed vertex buffer

Move a diagnostic surface, synchronize the intended geometry copies and compare CPU-side setup with device traversal results. Exercise buffer reuse after a completed frame and inspect more than the first static render. The guides to [renderer compatibility](/journal/gpu-llm-renderer-compatibility-matrix/) and [GPU BVH traversal](/journal/learn-gpu-bvh-traversal/) provide adjacent context. Accept the integration when view layout, version agreement and storage lifetime explain the geometry actually traversed, without relying on the word shared as a guarantee of coherence.
