llvm / llvm/offload-test-suite

[MTL] Implement Samplers for the Metal backend

Open
#1,226 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
18
Forks
39
Avg merge
2d 18h
Merged PRs (30d)
40

Description

I have added the ability to define samplers in the YAML test, and the Vulkan backend is able to create and bind them. This issue tracks implementing sampler support in the Metal backend.Split from #664 (which now tracks the DirectX backend only).

---

## Work required (implementation plan)

Greenfield for the Metal backend. Reference implementations exist for Vulkan ([#650](https://github.com/llvm/offload-test-suite/pull/650)) and DirectX (#1042 / draft PR #1231). YAML sampler parsing already exists from the Vulkan work, so this is backend-only in `lib/API/MTL/MTLDevice.cpp`.

- [ ] Map YAML `Sampler` fields to an `MTLSamplerDescriptor`: address mode (S/T/R), min/mag filter, mip filter, LOD min/max clamp, and (for comparison samplers) the compare function.
- [ ] Create `MTLSamplerState` objects from those descriptors.
- [ ] Bind samplers to the pipeline (argument buffer / `setSamplerState`), keeping index alignment with the other resources in each descriptor set.
- [ ] Replace the current `"Samplers are not yet implemented for Metal."` error path in `MTLDevice.cpp` (three sites: root-signature build, resource create, and bind).
- [ ] Support `SamplerComparison` (compare function) — mirrors the DX/VK handling.
- [ ] Refine the Metal XFAILs on the sampler tests once passing; validate on macOS / Apple silicon (cannot run on Windows/CI-Linux).

**Status:** No Metal draft PR exists yet. The DirectX equivalent has been implemented and verified (draft PR #1231, see #1042/#664), and the Vulkan implementation (#650) is the closest reference; both can be followed to implement the Metal path. Validation requires macOS hardware.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/API/MTL/MTLDevice.cpp and compare the Vulkan implementation in #650 with the DirectX work in #1042 and draft PR #1231. Trace the three sampler error paths and the sampler tests, then implement descriptor mapping, state creation, and binding for the listed fields. Done means the Metal sampler tests pass with refined XFAILs on macOS or Apple silicon.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
57/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.