Files
metal2vulkan/docs
Anees Iqbal 59fc85ea83 SEMANTICS 2133 / RUNTIME 2425: OpenCL mode: a 1D image bound to a real 1D texture reads it, through a variant
An OpenCL-mode kernel declares each image1d_t / image1d_array_t slot as the 2D texture of
height 1 Apple's OpenCL binds (canon::opencl::entry, canon::opencl_1d). A real 1D or 1D array
texture is a VK_IMAGE_TYPE_1D image, which takes only 1D views (Table 18,
VUID-VkImageViewCreateInfo-subResourceRange-01021), and a 1D view cannot sit in the slot's
Dim 2D descriptor (VUID-vkCmdDispatch-viewType-07752). So the binder wrote the declared 2D
type's neutral (PlanDiagnostic::IncompatibleBinding) and every read answered zero, outside
both measured answers (Radeon Pro 5300M: the 1D values; UHD 630: layer 0 of the array).

Now a per-slot variant keyed by the bound texture's type:
- air: Entry::open_cl_1d_images records the texture indices of an OpenCL-mode kernel's 1D
  images; SpecRequest::open_cl_lines names those a 1D texture is bound for, whose parameter
  keeps its texture1d type (opencl::entry) and whose operations stay 1D (opencl_1d::expand
  skips a call whose texture operand is that parameter).
- The kernel states RuntimeFact::OpenClLineTexture { slot } (Mechanism::Variant) per 1D image,
  in the base and the variant alike; nothing else states it.
- The compute plan puts such a slot in VariantKey::open_cl_lines where the shape binds a
  Type1D (Type1DArray) texture at a 1D (array) image read by the kernel
  (bind::plan::slots::open_cl_line_variant). VariantKey::lowering_inputs carries it to
  LoweringInputs::open_cl_lines, the specialized-entry cache key and SpecRequest. The variant's
  interface states the slot Type1D / Type1DArray, so its plan binds the 1D view and states the
  same key. The answer is the 5300M's.

With the set empty (Apple's 2D bindings) canon, the SPIR-V and the VariantKey are as before;
the base artifact gains only the OpenClLineTexture facts. The reflection still states the 2D
types. No runtime source changes.

Tests: canon::tests::opencl::opencl_1d_images_bound_to_1d_textures_keep_their_1d_operations,
engine_opencl_mode::an_opencl_mode_kernel_reads_real_1d_textures_through_its_variant and
a_plain_2d_texture_slot_given_a_1d_texture_binds_the_neutral; the runtime's
opencl_mode_1d_images_read_real_1d_textures (the repro).

SEMANTICS_VERSION 2133. api_signatures blessed (5 records); REFUSALS unchanged; docs/API.md's
OpenCL images paragraph.

Also e1aba1ad67 (the repro test), 9f3b309b65 and 8f2677c0ae (compile fixes: an Idx import; every SpecRequest literal names open_cl_lines).

Verified in the lane at 8f2677c0ae: lavapipe (m3-max-35393) OpenCL-mode runtime tests 19/19, the
new opencl_mode_1d_images_read_real_1d_textures among them (it failed at e1aba1ad67, m3-max-35348:
[0,0,0,0] for [10,11,12,13]); the 2D height-1 read and write tests pass at both. air OpenCL tests
9/9 (m3-max-35386). Still running when landed: the translator's engine_opencl_mode and api tests,
clippy x3, rustdoc, executor parity (runtime_lane::executions, runtime_run), the probe comparing
the guest 2D path's SPIR-V, facts and plan at base and tip, the PHOENIX run.

RUNTIME 2425 because the runtime's variant choice moves (bind::plan::slots); no runtime source
changed. New Degradation kinds: none.
2026-11-15 23:13:43 -08:00
..