microsoft / microsoft/DirectXShaderCompiler

[Validation] Add an assert to make sure no dxil opcodes are left unvalidated.

Open
#5,436 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement tech-debt validation
Dominant language
C++
Stars
3.7k
Forks
900
Avg merge
2d 11h
Merged PRs (30d)
44

Description

Is your feature request related to a problem? Please describe.
ValidateDxilOperationCallInProfile and ValidateHandleArgsForInstruction inside of DxilValidation.cpp only list a subset of opcodes in the switch statement that determines how to validate a specific opcode. The default case (if no opcodes are matched) is empty, and there's no indication that an opcode isn't being validated by the function.

Describe the solution you'd like
Both of these functions should have a DXAssert in the default case of these switch statements to alert the user when an opcode that should be validated isn't being validated.

Describe alternatives you've considered
It may not be necessary to implement a statement for the default case if we can logically prove that these functions will never be called for certain intrinsics (e.g., ValidateHandleArgsForInstruction shouldn't be called on an intrinsic that doesn't have some *Handle argument). In this case, a comment should be left that explains why there is nothing in the default case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in DxilValidation.cpp by reading ValidateDxilOperationCallInProfile and ValidateHandleArgsForInstruction, especially their opcode switch statements and default cases. Determine whether each default can be reached for an opcode requiring validation. Done means both cases either assert on an unvalidated opcode or contain a comment explaining why no validation is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.