Skip to content

Validator/Dxil version error improvements#3623

Merged
tex3d merged 1 commit intomicrosoft:masterfrom
tex3d:val-version-error
Mar 25, 2021
Merged

Validator/Dxil version error improvements#3623
tex3d merged 1 commit intomicrosoft:masterfrom
tex3d:val-version-error

Conversation

@tex3d
Copy link
Copy Markdown
Contributor

@tex3d tex3d commented Mar 25, 2021

  • Move validator/dxil version checks up-front
    These should fail first rather than side effects of trying to validate
    details of a version we don't support.
  • Improve message for unsupported validator or dxil version
    These errors are most likely if compiling separately from validation
    and failing to override the validator version properly, or running on
    an external validator that doesn't support a newer dxil.
  • Use dxil version from metadata for DxilModule when loading,
    rather than just setting it to minimum based on shader model.
  • Remove TODO from validator messages that shouldn't be there

- Move validator/dxil version checks up-front
  These should fail first rather than side effects of trying to validate
  details of a version we don't support.
- Improve message for unsupported validator or dxil version
  These errors are most likely if compiling separately from validation
  and failing to override the validator version properly, or running on
  an external validator that doesn't support a newer dxil.
- Use dxil version from metadata for DxilModule when loading,
  rather than just setting it to minimum based on shader model.
- Remove TODO from validator messages that shouldn't be there
@tex3d tex3d requested a review from pow2clk March 25, 2021 00:45
@tex3d
Copy link
Copy Markdown
Contributor Author

tex3d commented Mar 25, 2021

Note: I'd like to get these into release because currently, if you compile normally and then validate separately with DXIL.dll, and the highest version supported by the compiler is not the same as for DXIL.dll, you will get an unhelpful TODO - ... error message, instead of something useful. The -validator-version option has to be used on the compiler so you match the DXIL.dll version for this scenario, and the new error message will make it clear what's wrong when you don't use that.

Copy link
Copy Markdown
Collaborator

@pow2clk pow2clk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Nice to clean up the errors here as we've run into this a few times.

I do have one suggested addition that might be as easy as I think.

Comment thread utils/hct/hctdb.py
self.add_valrule("Meta.Used", "All metadata must be used by dxil.")
self.add_valrule_msg("Meta.Target", "Target triple must be 'dxil-ms-dx'", "Unknown target triple '%0'.")
self.add_valrule("Meta.WellFormed", "TODO - Metadata must be well-formed in operand count and types.")
self.add_valrule("Meta.WellFormed", "Metadata must be well-formed in operand count and types.") # TODO: add string arg for what metadata is malformed (this is emitted from a lot of places and provides no context whatsoever)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really more complicated than uncommenting this call at 3930 of DxilValidation.cpp?

  //ValCtx.EmitMetaError(pNode, ValidationRule::MetaWellFormed);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh Hmm. It seems I added that commented out line (#2938). I sure don't remember why I didn't enable it. Probably best to leave it off for now

@AppVeyorBot
Copy link
Copy Markdown

@tex3d tex3d merged commit 6244ab8 into microsoft:master Mar 25, 2021
@tex3d tex3d deleted the val-version-error branch March 25, 2021 21:04
tex3d added a commit to tex3d/DirectXShaderCompiler that referenced this pull request Mar 25, 2021
- Move validator/dxil version checks up-front
  These should fail first rather than side effects of trying to validate
  details of a version we don't support.
- Improve message for unsupported validator or dxil version
  These errors are most likely if compiling separately from validation
  and failing to override the validator version properly, or running on
  an external validator that doesn't support a newer dxil.
- Use dxil version from metadata for DxilModule when loading,
  rather than just setting it to minimum based on shader model.
- Remove TODO from validator messages that shouldn't be there

(cherry picked from commit 6244ab8)
tex3d added a commit that referenced this pull request Mar 26, 2021
- Move validator/dxil version checks up-front
  These should fail first rather than side effects of trying to validate
  details of a version we don't support.
- Improve message for unsupported validator or dxil version
  These errors are most likely if compiling separately from validation
  and failing to override the validator version properly, or running on
  an external validator that doesn't support a newer dxil.
- Use dxil version from metadata for DxilModule when loading,
  rather than just setting it to minimum based on shader model.
- Remove TODO from validator messages that shouldn't be there

(cherry picked from commit 6244ab8)
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