Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXIL Validation: Stop setting EnableRawAndStructuredBuffers in DXC and Validator #7003

Open
tex3d opened this issue Nov 7, 2024 · 0 comments
Labels
bug Bug, regression, crash validation Related to validation or signing
Milestone

Comments

@tex3d
Copy link
Contributor

tex3d commented Nov 7, 2024

Description
DxilModule::CollectShaderFlagsForModule sets shader flag EnableRawAndStructuredBuffers when an SRV of RawBuffer or StructuredBuffer is present in the resources list.

Flags.SetEnableRawAndStructuredBuffers(hasRawAndStructuredBuffer);

This flag was originally added to mirror the DXBC global flag enableRawAndStructuredBuffers, or D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS as the value, when doing conversion from DXBC to DXIL in DxilConv. Originally this made sense when we were keeping the shader model and all the flags from the converted shader, but later we upgraded all shaders to shader model 6.0.

This global flag was only set by FXC when the shader was ps_4_0 or ps_4_1 because this was an added feature at that time. It was never used for shader model 5.0 or above, or for compute stage (which was also supported in shader model 4.0+).

There is no reason to set this flag for DXIL, since there's no optional feature exposure here. There should be no regression risk in drivers because converted DXBC wouldn't have set this flag in many scenarios, including ones with indistinguishable DXIL from ones that do set the flag other than this flag setting. In other words, the same shader would produce same DXIL except the flag set or clear depending on whether the DXBC was ps_4_0 or ps_5_0.

Right now, since this flag is set in DxilModule::CollectShaderFlagsForModule, it is also checked by DXIL validation, impacting what we must output from the new clang compiler. We should stop setting this flag, so we don't have to keep carrying this unneeded flag into the future in the new compiler.

Steps to Reproduce
https://godbolt.org/z/7xesd8388

Note metadata:

!dx.entryPoints = !{!27}
...
!27 = !{void ()* @main, !"main", !28, !20, !33}
...
!33 = !{i32 0, i64 16}

i64 16 is the EnableRawAndStructuredBuffers flag we should stop setting.

Environment

  • DXC version: any
  • Host Operating System: any
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug, regression, crash validation Related to validation or signing
Projects
Status: Triaged
Development

No branches or pull requests

2 participants