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

[workstream] DXIL Shader Flags #57

Open
1 of 10 tasks
damyanp opened this issue Sep 3, 2024 · 3 comments
Open
1 of 10 tasks

[workstream] DXIL Shader Flags #57

damyanp opened this issue Sep 3, 2024 · 3 comments
Assignees

Comments

@damyanp
Copy link
Collaborator

damyanp commented Sep 3, 2024

DXIL output contains various flags that tell the runtime about what optional features the shader might be using - for example, wave operations, doubles, 64-bit integers.

All shader flags specified in DXC output along with conditions that set each of them is catalogued here.

Support for appropriately setting the same set of flags in the clang-based HLSL Shader compiler needs to be implemented by enhancing the existing ShaderFlagsAnalysis pass in DXILShaderFlags.cpp. The existing Module pass needs to be extended to walk all constituent functions to collect shader flags for the candidate function. Results of the analysis pass is a map of shader functions to corresponding shader flags mask.

Milestones

Compile particle_life.hlsl (#20)

Compile all DML shaders, and they pass the validator (#11)

@damyanp
Copy link
Collaborator Author

damyanp commented Sep 4, 2024

@bharadwajy - first step of this is to do some investigation and figure out what's involved in the work so we can take something to refinement.

@bharadwajy
Copy link
Collaborator

bharadwajy commented Sep 6, 2024

Adding some notes:

  1. A library DXIL shader can specify more than one entry points - see here. As a result, ShaderFlagsAnalysis pass needs to collect ShaderFlags information for each of the entry functions, if the shader profile specified for compilation is lib_*. Currently, the ShaderFlagsAnalysis pass collects ShaderFlags value by inspecting all the instructions of all functions of module. Collecting ShaderFlags per entry will allow for correct specification of the value EntryShaderFlags in the tag-value pair of {ShaderFlagsTag, EntryShaderFlags} in the metadata for entries - both for lib_* and non-lib_* profiles.
  2. collectShaderFlgs() would serve as a guide to analyze entry functions to create the ShaderFlags mask. A potential mechanism to encode static shader flags information for some of the DXIL Ops is to encode them as attributes in DXIL.td and query for the values. This will still require walking all the instructions of a function for shader flags that require compile-time instruction information such as operand type.
  3. Shader Flags based on DXIL/SM versions, and compiler options - such as disabling optimizations etc., are also to be collected at compile-time.

@damyanp
Copy link
Collaborator Author

damyanp commented Sep 10, 2024

Discussed in refinement today: this needs to be broken down further and the acceptance criteria defined. Note that it is reasonable to create subtasks to cover the work required to find all the shader flags / write a proposal etc.

@damyanp damyanp changed the title DXIL Shader Flags [workstream] DXIL Shader Flags Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Designing
Development

No branches or pull requests

2 participants