identity: texture slots sampled through runtime sampler slots from set 1's sampler arrays

Under the identity domains a kernel samples a texture slot through a runtime sampler slot. The
texture is its class's set-1 element at the index of its pushed gpuResourceID, as a read's is.
The sampler is the element of a set-1 sampler array at the index of the sampler slot's pushed
gpuResourceID (SlotGuestBase of the sampler slot), joined to the texture by OpSampledImage. The
array is picked by the use: binding 2 for a plain sample, 3 for a depth comparison, 4 for a
texture of an integer format; 4,000 SAMPLER descriptors each, PARTIALLY_BOUND |
UPDATE_AFTER_BIND | UPDATE_UNUSED_WHILE_PENDING, every stage, the same set 1 for every pipeline.
The sampler's word (pixel coordinates, a nearest pixel sampler) is read from the ID's high word,
so no specialization constant and no SamplerReduction, SamplerCoordinates, CubicSampler or
ConstantLanes fact remains; every precision note is static. An integer write to a storage slot
without a format saturates to the channel widths the consumer pushes
(PushField::TextureIntegerChannels, a u32), with no fact.

Still refused as Unsupported{IdentityDomains}: constexpr samplers (next change: a pushed index),
an argument buffer's sampler, arrays of samplers, bicubic and anisotropy emulation, a slot's
minimum level.

Translation output changes only under the identity domains (Device::from_queries). Device::new
output is unchanged: golden_hashes_match_the_table passes at this tip (job m3-max-42189), with no
"changed under an unchanged key" and no "profile changed:" line.

For the runtime's side (the planner's three facts):
a. The runtime must dedupe device samplers by create info across the three arrays' uses.
   Exhausting maxSamplerAllocationCount (4,000 on the 2080, 3090 and UHD 630; 32,768 on
   lavapipe; 65,536 on the others) must be a typed refusal, with a fill-past-capacity test.
b. The update-after-bind limits for 65,536 sampled images, 4,096 storage images and 12,000
   samplers hold on all nine profiles (the smallest is lavapipe's 1,015,808); the floor must
   check them by query.
c. The count of cubic sampler descriptors is asked of the replay lane; if any exist it goes back
   to the planner before step 5 closes.

SEMANTICS_VERSION 2161: identity-domain modules of sampling kernels and integer writes change.

Verified:
- m3-max-42094 (msi), this change on cd5a76a757: clippy -p metal2vulkan --all-targets
  --all-features and rustdoc -D warnings green; nextest all() of metal2vulkan and metal2vulkan-rt,
  3,719 of 3,723 passed. The four failures were development's own (the new pad_simd_shape and
  vector_word_phases fixtures had no table rows), re-blessed at 74669c0552.
- m3-max-42096 (msi): clippy --cfg m2v_gpu and --cfg m2v_cpu_icd green.
- m3-max-42189 (msi), this tip on 58891b9ce5: golden_hashes_match_the_table,
  public_fixtures_engine inventory and llvm_as part 8, and air_input's engine golden printouts
  pass.
- engine_identity: sample_down links and passes L3 on every profile and on moltenvk-m3 without
  robustImageAccess2, with set 1 bindings 0, 1 and 2 used, no spec constant but LocalSize, and no
  sampler fact; an integer write of (300, 70000, 5, 2^31) stores (255, 255, 5, 255) under the
  RGBA8Uint word and the raw lanes under word 0, on the CPU interpreter.
This commit is contained in:
Anees Iqbal committed 2026-11-17 12:46:10 -08:00
1 parent 58891b9ce5
commit 445b720f78
13 files changed
+460 -63

No files matched your search

+13 -6
View File
@@ -127,12 +127,19 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
slot and a member of one class index one array. No binder chooses a variant there: a
texture reads through the plain form whatever texture its ID names, its `float` or `half` reads
take the device's sRGB decode with `PrecisionNote::SrgbTexelDecode`, and no texture is sparse
(the consumer refuses a sparse texture). So far they lower a kernel that reaches memory through
its buffer slots and reads, writes, sizes or tests for nil its texture slots and its argument
buffers' textures. Any other function is refused as `Unsupported{IdentityDomains}`: one that
samples, uses a texture buffer, a slot's levels or swizzle, a two-plane, extended-range or
sRGB-twin form, reads an argument buffer's texture through another numeric type or as raw
texels, or uses any other state of a texture beyond its ID.
(the consumer refuses a sparse texture). A texture slot sampled through a runtime sampler slot
samples set 1's element of the sampler arrays at the index of the sampler's pushed
`gpuResourceID`, joined to the texture's element by `OpSampledImage`, and reads the sampler's
word from that ID. An integer write to a storage slot without a format saturates to the channel
widths the consumer pushes (`PushField::TextureIntegerChannels`). Every precision note is
static there: no constant or binder decides one. So far they lower a kernel that reaches memory
through its buffer slots and reads, writes, sizes or tests for nil its texture slots and its
argument buffers' textures, and samples its texture slots through its runtime sampler slots.
Any other function is refused as `Unsupported{IdentityDomains}`: one that samples through a
constexpr or an argument buffer's sampler or samples an argument buffer's texture, emulates a
sampler's anisotropy or bicubic filter, uses a texture buffer, a slot's levels or swizzle, a
two-plane, extended-range or sRGB-twin form, reads an argument buffer's texture through another
numeric type or as raw texels, or uses any other state of a texture or sampler beyond its ID.
- **The model's linear sample of planes read in place** (`YCbCrInPlacePolicy::Model`, the
default; changes emitted code). On an integrated GPU or a CPU device a function that only
samples, gathers or sizes a `YCBCR8_420_2P` or `YCBCR10_420_2P` texture reads its planes' codes