microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
3.12k stars 699 forks source link

Missing validation for some intrinsic arguments that require literal #6289

Open tex3d opened 9 months ago

tex3d commented 9 months ago

Description In hctdb.py, some intrinsics have arguments marked is_const=True. These arguments require immediate literal values. Currently, DxilValidation doesn't enforce this in a general way. Some intrinsics may have specific checks, but others are missing. For instance, #6280 updates some intrinsics that were missing this property, and they are still lacking validation for this property.

In DxilValidation, we should implement general check for DXIL intrinsic arguments with is_const=True property to ensure they are always immediate values. We can add a generated function to DxilValidationImpl.inc to look up the property, and we could add code to check that the necessary arguments are constant to the generated DxilInst_ helpers in DxilInstructions.h.

Environment

pow2clk commented 9 months ago

Missing validation that is not a regression. It could be masking compiler flaws. If it is, it might be worth getting in with 6.8 as it's an opportunity to make validation updates.