Skip to content

hk: keep shader object binaries independent of depthClipControl - #279

Merged
DjDeveloperr merged 1 commit into
aurora-wipfrom
so1/shader-object-binary-features
Nov 13, 2026
Merged

DjDeveloperr merged 1 commit into
aurora-wipfrom
so1/shader-object-binary-features

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 13, 2026 •

Copy link
Copy Markdown

Problem

On G17P, a shader object binary depended on whether its device enabled depthClipControl:

  • every serialized shader recorded the enabled feature in its flags byte;
  • the last pre-rasterization stage applied agx_nir_lower_clip_m1_1 only on such a device.

dEQP-VK.shader_object.binary.device_features.* and binary.query.*.device_no_exts_features compare the binaries of one shader created on devices with different enabled features. All 352 + 11 of those cases failed on G17P. M5 doesn't advertise the feature and passes them.

Change

  • A shader object, which common Mesa compiles without features, now always applies the lowering where the device supports depthClipControl. Internal shaders, which also compile without features, do the same. The clip z coefficient is 0 unless negativeOneToOne is set.
  • With coefficient 0, agx_nir_lower_clip_m1_1 now keeps z bit for bit by selecting on the coefficient. Before, its lerp turned -0 into +0 and gave NaN for an infinite w on every G17P device that enabled the feature, CTS default devices included. A host check over special z × w pairs: with 0, z is returned exactly in all 196 (the old lerp differed in 46); with 1/2 the result is unchanged.
  • The flags byte now records whether the shader applied the lowering, and a shader created from the device's binary cache keeps it. Any device with the feature accepts a binary that has it; only a device that did not enable the feature accepts one without it.
  • Pipelines and mesh shaders still decide by the enabled feature, as before.

Testing

  • Neo (J700, G17P), kernel 7.3.0-neo.final: build f3 = 9c11f24199c (this change 8013652 and agx: keep fp32 ffma fused under DenormPreserve #280 on aurora-wip 8f013bf; the same patches as this branch, git range-diff identical) against the base build 8f013bf:
    • the 24 dEQP-VK.spirv_assembly.instruction.compute.opfma.fp32.*.denorm_preserve.* cases, one process each: base 20 Fail / 4 Pass, f3 24 Pass;
    • dEQP-VK.shader_object.binary.*: 437 / 437 Pass, the 363 base failures fixed, 0 regressions;
    • every spirv_assembly float_controls case plus the opfma group, 13,836 cases: 8,463 Pass, 5,373 NotSupported, 0 Fail; 20 fixed, 0 regressions;
    • no kernel GPU messages during the run.
  • The fast merge gate runs on the batch composite of aurora-wip 164341f with this branch.
  • test-clip-m1-1.cpp is updated for the select. The asahi gtests are to run on the merged tree.

🤖 Generated with Claude Code

A shader object binary depended on whether its device enabled
depthClipControl. Every serialized shader recorded the enabled feature
in its flags byte, and the last pre-rasterization stage applied
agx_nir_lower_clip_m1_1 only on such a device. On G17P this failed every
dEQP-VK.shader_object.binary.device_features.* case (352) and every
binary.query.*.device_no_exts_features case (11). Those tests compare
the binaries of one shader created on devices with different enabled
features.

A shader object, which compiles without features, now always applies the
lowering where the device supports depthClipControl. Internal shaders,
which also compile without features, do the same. The clip z coefficient
is 0 unless negativeOneToOne is set, and with 0 the lowering now keeps z
exactly. Before, its lerp turned -0 into +0 and gave NaN for an infinite
w. The flags byte now records whether the shader applied the lowering,
including for shaders from the device's binary cache. Any device with
the feature accepts a binary that has it; only a device that did not
enable the feature accepts one without it. Pipelines and mesh shaders
still decide by the enabled feature.

Signed-off-by: Diljit Singh <hey@djdev.me>
@DjDeveloperr

DjDeveloperr commented Nov 13, 2026 •

Copy link
Copy Markdown
Author

Gate evidence for merging #279 (batch1, step 5 of a tree-checked sequence):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant