Commit graph

73124 commits

Author SHA1 Message Date
Tomeu Vizoso
f06b4dbe33 gallium: add ml_device_destroy callback to pipe_ml_device
Add a destroy callback so that standalone ML devices created via
*_ml_device_create() can properly free their resources.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40578>
2026-03-27 09:35:40 +01:00
Tomeu Vizoso
f0e4ccf664 ethosu: handle NULL bias tensor in convolution
PyTorch Conv2d without explicit bias produces a NULL bias_tensor
in the Gallium pipe_ml_operation. Guard against NULL dereferences
in two places:

- ethosu_lower.c: pass NULL to fill_coefs when bias_tensor is NULL
- ethosu_coefs.c: treat missing biases as zero

Fixes crashes when running Conv2d models without bias through the
Ethos-U NPU backend.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40578>
2026-03-27 09:33:52 +01:00
Tomeu Vizoso
e0b401aa87 ethosu: implement ml_subgraph_deserialize()
Add ethosu_ml_subgraph_deserialize() which reconstructs a subgraph
from a serialized byte buffer. Parses the header (cmdstream size,
coefs size, io size, tensors size), restores the tensor array,
cmdstream, and coefficient buffers.

DRM buffer object creation is deferred to prepare_for_submission()
which is called lazily on first invoke.

Wire pctx->ml_subgraph_deserialize in ethosu_create_context().

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40578>
2026-03-27 09:33:52 +01:00
Tomeu Vizoso
6bae0b55d0 gallium: add pipe_context::ml_subgraph_deserialize()
Add ml_subgraph_deserialize() to pipe_context for reconstructing
a previously-serialized ML subgraph at runtime. This complements
ml_subgraph_serialize() on pipe_ml_device and allows the runtime
to load pre-compiled subgraphs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40578>
2026-03-27 09:33:52 +01:00
Tomeu Vizoso
aff92add98 ethosu: Specifying SRAM size in pipe_ml_device ID
The spec format is now GEN-MACS-SRAM, e.g. "65-256-4096".

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40578>
2026-03-27 09:07:12 +01:00
Tomeu Vizoso
fc0770d5e3 ethosu: parse optional SRAM size from device spec string
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The spec format is now GEN-MACS[-SRAM], e.g. "65-256-4096" or
"85-256". When the SRAM parameter is omitted it defaults to 0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40647>
2026-03-26 16:13:23 +00:00
Tomeu Vizoso
abd681c169 ethosu: add U85-256 support to ethosu_ml_device_create()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40647>
2026-03-26 16:13:23 +00:00
Tomeu Vizoso
3b68c5b4bc ethosu: move hardware description from ethosu_screen to ethosu_ml_device
Move target-specific fields (is_u65, ifm_ublock, ofm_ublock,
max_concurrent_blocks, sram_size) from ethosu_screen into
ethosu_ml_device. This decouples the compilation phase from the DRM
file descriptor and pipe_screen, allowing ahead-of-time compilation
where the target NPU is not present on the compilation host.

The ethosu_device_screen() helper is retained only for runtime paths
that need the DRM fd (buffer allocation, job submission, destroy).

Compilation code now accesses hardware parameters through
ethosu_ml_device() cast of pipe_ml_device, which can be created
either from a DRM-backed screen or standalone via
ethosu_ml_device_create() with a target string like "65-256".

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40647>
2026-03-26 16:13:23 +00:00
Qiang Yu
00b1d77176 radeonsi: advertise GL_NV_timeline_semaphore
Set max_timeline_semaphore_difference = UINT64_MAX when timeline syncobj
is supported and GFX uses the kernel queue path (not userq). The GL
state tracker auto-enables GL_NV_timeline_semaphore when this cap is
non-zero.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/15113
Author: Claude Opus 4.6 <noreply@anthropic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40526>
2026-03-26 14:26:56 +00:00
Qiang Yu
26418f0f58 radeonsi: add timeline semaphore support to fence operations
Thread timeline_point through si_add_fence_dependency and
si_add_syncobj_signal to the winsys. Remove the assert(!value)
guards in si_fence_server_sync and si_fence_server_signal so that
non-zero timeline point values are passed through to the winsys
fence dependency and signal lists.

Add PIPE_FD_TYPE_TIMELINE_SEMAPHORE_VK handling in si_create_fence_fd,
importing the fd as a syncobj (the timeline point is applied at
wait/signal time, not at import time).

Author: Claude Opus 4.6 <noreply@anthropic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40526>
2026-03-26 14:26:56 +00:00
Qiang Yu
379bf43084 winsys/amdgpu: use timeline syncobj chunks in kernelq submission
When has_timeline_syncobj is available, use AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT
with drm_amdgpu_cs_chunk_syncobj for dependencies and
AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL for signals in kernelq submission.
This passes timeline point values from the fence lists through to the kernel.

Keep the existing binary SYNCOBJ_IN/SYNCOBJ_OUT path as fallback when
timeline syncobj is not available.

Author: Claude Opus 4.6 <noreply@anthropic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40526>
2026-03-26 14:26:56 +00:00
Qiang Yu
c4edd58a74 winsys/amdgpu: add timeline point support to fence lists
Add a parallel uint64_t *points array to amdgpu_fence_list to store
timeline semaphore point values alongside each fence. Point=0 means
binary semaphore (preserving existing behavior).

Update cs_add_fence_dependency and cs_add_syncobj_signal winsys
interfaces to accept a timeline_point parameter, and thread it
through to the fence lists. All existing callers pass 0.

Author: Claude Opus 4.6 <noreply@anthropic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40526>
2026-03-26 14:26:56 +00:00
Georg Lehmann
8470bb59f6 lavapipe: preserve fp_math_ctrl when lowering cmat alu
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40630>
2026-03-26 13:15:50 +00:00
Alyssa Milburn
a6992c7bbe nv50,nvc0: Avoid uninitialized cbuf reads in blits
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Overwrite the whole framebuffer cbuf rather than copying it from the
stack; fixes util_framebuffer_get_num_samples getting uninitialized
stack contents during validation.

Suggested-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Alyssa Milburn <amilburn@zall.org>
Fixes: 2eb45daa9c ("gallium: de-pointerize pipe_surface")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14082
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39138>
2026-03-25 17:48:43 +00:00
Tomeu Vizoso
16e15ee205 gallium: add pipe_ml_device, pipe_screen::get_ml_device()
For compiling models, we don't really need a context for a real device.

To support ML frameworks models in which compilation happens
ahead-of-time (AoT), add API for compilation that doesn't require a
pipe_context.

Add struct pipe_ml_device with function pointers for:
- ml_operation_supported: query operation support
- ml_subgraph_create: compile a subgraph
- ml_subgraph_serialize: serialize a compiled subgraph
- ml_subgraph_destroy: free subgraph resources

Move ml_operation_supported, ml_subgraph_create, and
ml_subgraph_destroy from pipe_context to pipe_ml_device.

Add pipe_screen::get_ml_device() to obtain the device.

Change pipe_ml_subgraph.context (pipe_context*) to
pipe_ml_subgraph.device (pipe_ml_device*).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40167>
2026-03-25 16:58:05 +00:00
Tomeu Vizoso
1d4d1fc61d gallium: replace padding_same with per-side padding
Replace the boolean padding_same field in pipe_ml_operation.conv
and .pooling with explicit per-side padding fields: padding_top,
padding_bottom, padding_left, padding_right.

Frontends always compute these from their own padding representation
(e.g. TFLite same/valid, PyTorch (pad_h, pad_w)). Drivers use
them directly, removing the need for drivers to derive padding.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40167>
2026-03-25 16:58:05 +00:00
Tomeu Vizoso
db866eca28 gallium: pipe_tensor.resource → pipe_tensor.data
Change the tensor backing storage from pipe_resource* to uint8_t*.

This simplifies tensor data management by using raw memory pointers
instead of pipe_resource objects. Frontends allocate tensor data with
malloc() and drivers access it directly, removing the need for
pipe_buffer_map/unmap for tensor data access.

We initially used resources thinking that the NPU would want to directly
access the data in those tensors. It is clear now that all NPUs will
need the data to be compressed and reformatted in some way, so let's
drop the incovenient resources and just use allocated memory.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40167>
2026-03-25 16:58:04 +00:00
Eric R. Smith
a2e61ee1b9 pan: change image2DMSArray lowering to use Z instead of Y
We used to lower multisampled arrays to 3D images by adjusting the
height and the Y coordinate so that addressing samples became
addressing into the new base image. This worked for gallium, but
was never implemented for vulkan, and also had the disadvantages
that (a) we handled arrays and non-arrays differently, and
(b) the image height was restricted to 4096.

Change this so that we lower samples into the Z coordinate instead,
adding new layers for each sample. This requires that we know the
number of samples (so we have to save a sysval for this in gallium)
but means that we handle arrays and non-arrays the same. More
importantly, we can fit 3 bits to indicate the number of samples
into the attribute descriptor in Vulkan, so this scheme works
there as well as in OpenGL.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40460>
2026-03-25 15:05:53 +00:00
Eric R. Smith
89288722e7 panfrost: add sysval for number of samples
Not really used yet, but we will need it later when we change how we
lower multisampled image arrays.

Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40460>
2026-03-25 15:05:53 +00:00
Pierre-Eric Pelloux-Prayer
2ff9fa8b72 gallium/u_blitter: add a new fs_color_clear variant
The referenced commit switched from a passthrough shader
to fs_clear_color[write_all_cbufs=0]. It shouldn't matter since
the shader isn't supposed to be executed - it's only setup to get
the first color output active.

On some chips (gfx8) it seems to cause issues (hangs or page fault)
for some piglit tests, eg:
  framebuffer-blit-levels draw stencil

To fix this, introduce a 3rd variant, where a constant buffer isn't
required and instead the color is hardcoded in the shader.

Fixes: ca09c173f6 ("gallium/u_blitter: remove UTIL_BLITTER_ATTRIB_COLOR, use a constant buffer")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40486>
2026-03-25 08:54:50 +00:00
Faith Ekstrand
3ea2e51c8b treewide: Enable lowering of primitive ID in a bunch of Vulkan drivers
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40512>
2026-03-25 03:11:56 +00:00
Valentine Burley
17d38c9668 zink/ci: Move zink-tu-a618 to sc7180-trogdor-kingoftown
The sc7180-trogdor-lazor-limozeen devices are having issues, so move the
job to a different device with available capacity.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40566>
2026-03-24 15:22:12 +00:00
Marek Olšák
dee99b38c5 radeonsi: fix an assertion failure for sampler descriptor loads with LLVM
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Pierre-Eric
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40589>
2026-03-24 01:05:29 +00:00
Marek Olšák
e1a845c042 radeonsi: fix compiler selection for fixed-func TCS
Reviewed-by: Pierre-Eric
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40589>
2026-03-24 01:05:29 +00:00
Marek Olšák
55f5253976 radeonsi: remove unnecessary ac_to_integer in si_llvm_ps_build_end
Reviewed-by: Pierre-Eric
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40589>
2026-03-24 01:05:29 +00:00
Marek Olšák
235e32d560 ac/llvm: remove almost duplicated ac_build_varying_gather_values
Reviewed-by: Pierre-Eric
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40589>
2026-03-24 01:05:29 +00:00
Marek Olšák
d692ce4b34 radeonsi/meson: don't use llvm variables when LLVM is disabled
also winsys doesn't use LLVM

Reviewed-by: Pierre-Eric
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40589>
2026-03-24 01:05:29 +00:00
Marek Olšák
8ea3d794fb radeonsi: recompute IO bases after optimizations
to fix an assertion added by the commit, reproduced by viewperf13/catia

Fixes: d06616063c - radeonsi: assert that IO bases don't have holes & the same base isn't used twice

Reviewed-by: Pierre-Eric
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40589>
2026-03-24 01:05:29 +00:00
Eric Engestrom
731e5e466a zink+lvp/ci: document recent flakes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40583>
2026-03-23 23:38:32 +00:00
Eric Engestrom
bb71c2dc34 zink+radv/ci: document recent flakes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40583>
2026-03-23 23:38:32 +00:00
Eric Engestrom
b729dfcc9e llvmpipe/ci: document regressions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40583>
2026-03-23 23:38:32 +00:00
Michel Dänzer
8f30e90fc1 winsys/amdgpu: Prefer render node FD for ac_drm_device_initialize
If the FD passed in isn't from a render node, try to determine the
corresponding render node and open it. If that succeeds, pass the
render node FD to ac_drm_device_initialize.

The existing code already detects when ac_drm_device_get_fd doesn't
return the FD passed in, and handles that case correctly.

This avoids issues with unauthenticated FDs from card nodes.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7289

v2:
* Always close render_fd after calling ac_drm_device_initialize for it.
  (Pierre-Eric Pelloux-Prayer)
* Formatting tweaks for logging when ac_drm_device_initialize fails for
  render_fd.
v3: (Pierre-Eric Pelloux-Prayer)
* Log render_device path when ac_drm_device_initialize fails for
  render_fd.
* Fix render_device string leak.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40519>
2026-03-23 21:51:52 +00:00
Pavel Ondračka
52d90752c2 r300/ci: update expectations
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40570>
2026-03-23 21:06:32 +00:00
Georg Lehmann
d664f6a1e4 gallivm: remove dead code in lp_build_add
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40520>
2026-03-23 17:58:32 +00:00
Georg Lehmann
284b4143f7 gallivm: don't optimize fadd(a, 0.0) with signed zero preserve
Fixes: 540e84bedb ("gallivm: Preserve -0 and nan")
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40520>
2026-03-23 17:58:32 +00:00
Mike Blumenkrantz
d6958a5e43 gallium: kill off pipe_surface::context
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:15 +00:00
Mike Blumenkrantz
9ffc4f43f9 svga: move surface context member onto internal surface type
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:15 +00:00
Mike Blumenkrantz
e8ced90aab gallium: add a pipe_context param to pipe_surface_reference()
this shouldn't be used anymore, but for anyone still using it there
needs to be a context passed

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:15 +00:00
Mike Blumenkrantz
169c140ec3 gallium: delete pipe_context surface hooks
no longer used

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:15 +00:00
Mike Blumenkrantz
0615a276ca gallium: add a destructor param to surface refcounting functions
these functions should no longer be used by serious drivers. for those that
do use them, they now need to pass their own destructor function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:15 +00:00
Mike Blumenkrantz
639c356894 r300: delete pipe_context surface hooks
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:14 +00:00
Mike Blumenkrantz
8c37145e61 r300: clean up some surface management
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:14 +00:00
Mike Blumenkrantz
0cafd100fa freedreno: delete pipe_context surface hooks
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
1af551ed9f tegra: delete pipe_context surface hooks
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
199eff7538 nouveau: delete unused surface hook
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
643d7b4b70 freedreno: clean up some surface management
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
f1b09f7760 tc: delete unused surface ref code
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
0115fc92c6 crocus: clean up surface management
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
a4c0f5ba6f svga: simplify some surface management
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:13 +00:00
Mike Blumenkrantz
17d9f1dc64 llvmpipe: delete pipe_context surface hooks
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40462>
2026-03-23 16:58:12 +00:00