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

DxilValidation: add ShaderCompatInfo call graph checking #16

Closed
wants to merge 9 commits into from

Conversation

tex3d
Copy link
Owner

@tex3d tex3d commented Feb 16, 2024

ShaderCompatInfo identifies compatibility for functions that could be called from an entry point.
Currently, this checking detects compatibility problems between entry points and internal function calls that the validator otherwise misses.

This change adds a check for ShaderCompatInfo, recursing into called functions looking for a source of conflict when not compatible with the current entry point properties.
Errors are emitted for the entry point and at one source of each type of conflict that ShaderCompatInfo detects.
A function is considered the source of a conflict when it has the conflict but none of the functions called from this function have this conflict.

Removed early exit for ShaderFlags validation when module is a library, since these flags should be validated for libraries, and running CollectShaderFlagsForModule fills in the ShaderCompatInfo data we need for validation.

Addresses part of microsoft#6256
Fixes microsoft#6292

…rdPtrAndUpdateUsers (microsoft#6314)

In EmitGetNodeRecordPtrAndUpdateUsers, the type will be mutated. And the
GEP user of the RecordPtr will be merged at same time. This make things
complex because the GEP index need to be updated since type is mutated.

To make things easier, merge the GepUse after mutate type.

Fixes microsoft#6223
This will allow lit test check dxil version to avoid running on
unsupported dxil.dll.
@tex3d
Copy link
Owner Author

tex3d commented Feb 16, 2024

This is a draft on top of PR microsoft#6291. It will be turned into a real PR against main after that one merges.

tex3d and others added 7 commits February 16, 2024 23:16
…on (microsoft#6320)

In validator version 1.7 and below, the RaytracingTier1_1 module flag
was set on every function if any StateObjectConfig subobject had the
AllowStateObjectAdditions flag set. This was incorrect, as the
requirement is validated in the runtime based on the use of the
subobject instead. Subobjects are removed from the module and placed in
RDAT during container serialization, so the requirement would be lost
when recomputing the flags in validation. This didn't break validation
because flag validation was completely disabled for libraries!

This change fixes this problem, and allows DxilValidation to validate
ShaderFlags because they will no longer mismatch due to this issue.
Running CollectShaderFlagsForModule is also necessary for collecting
per-function shader flags which will be used by call graph validation in
a subsequent change, so enabling flag validation unblocks that as well.

Fixes microsoft#6321
There was a typo in dxcpdbutils where the normalized file path wasn't
actually being used. This change fixes that and adds thorough testing
for the DxcPdbUtils path normalization. Also fixed another case where
`/dir/my_file` gets normalized to `.\\dir\my_file`.
…ity info (microsoft#6291)

Fix barrier allowed ops and flags by shader kind

New barrier operations lacked validation and for RDAT info: had
incorrect min target and shader stage flags.

- Identify barrier DXIL operations with new `is_barrier` in `hctdb.py`
and generated `OP::IsDxilOpBarrier`.
- Identify when a barrier op requires shader stage with group
(compute-like stage), or when it requires node memory.
- Add new `OptFeatureInfo_RequiresGroup` to identify function only
compatible with a shader stage with a visible group for access to
groupshared memory or use of group sync.
- Translate to original `BarrierMode` when compatible; adds
`BarrierMode::Invalid` to identify invalid cases.
- Account for `DXIL::MemoryTypeFlags::AllMemory` being allowed and
auto-masked by driver.
- Properly set min shader model and compatible shader stage flags.
- Validate barrier for shader stage.
- Added new barriers to counters which were missing.

Adressing parts of: microsoft#6256 and microsoft#6292
Fixes microsoft#6266
Replace assert on illegal DXIL op with return illegal value. Check the
illegal cases in validation.

Fixes microsoft#6168
ShaderCompatInfo identifies compatibility for functions that could be called from an entry point.
Currently, this checking detects compatibility problems between entry points and internal function calls that the validator otherwise misses.

This change adds a check for ShaderCompatInfo, recursing into called functions looking for a source of conflict when not compatible with the current entry point properties.
Errors are emitted for the entry point and at one source of each type of conflict that ShaderCompatInfo detects.
A function is considered the source of a conflict when it has the conflict but none of the functions called from this function have this conflict.

Removed early exit for ShaderFlags validation when module is a library, since these flags should be validated for libraries, and running CollectShaderFlagsForModule fills in the ShaderCompatInfo data we need for validation.
- Plus, replace unrecognized MaxOutputRecords attribute usage with MaxRecords
@tex3d tex3d closed this Feb 20, 2024
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.

3 participants