Open damyanp opened 2 months ago
@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.
Adding some notes:
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.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.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.
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.NOTE: Analysis to set the following Shader Flags is not done as it appears that they are not being set in DXC sources based on module content. Listing them for the record and potential reclassification as needed.
DisableMathRefactoring
ComputeShadersPlusRawAndStructuredBuffers
(Only set for SM 4.0)ROVs
SamplerFeedback
Milestones
Compile particle_life.hlsl (#20)
DXIL::Opcode::BufferLoad
, if present, in the candidate function - see hereCompile all DML shaders, and they pass the validator (#11)