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

[Sema] Not report error when invalid intrinsic call is not used. #6140

Merged
merged 18 commits into from
Jan 24, 2024

Conversation

python3kgae
Copy link
Contributor

@python3kgae python3kgae commented Jan 9, 2024

Added DiagnoseUsedHLSLMethodCall which only report error when the MethodCall is used.
DiagnoseUsedHLSLMethodCall is used in DiagnoseTranslationUnit.
In DiagnoseTranslationUnit, traverse all visited functions in call graph, diagnose illegal intrinsic call inside these functions.

Shader kind is also checked in DiagnoseUsedHLSLMethodCall.

Fixes #5855

Move check for CalculateLevelOfDetail into DiagnoseTranslationUnit where call graph is available.
Traverse all visited functions in call graph, diagnose illegal intrinsic call inside these functions.

Fixes microsoft#5855
@bob80905
Copy link
Collaborator

bob80905 commented Jan 9, 2024

From reading the changes, I don't think the title of the PR matches what's being done. You are separating out the logic for identifying an error, and actually emitting a diagnostic. Maybe a better title would be:
"Separate diagnostic detection logic from diagnostic emission in Sema for invalid method calls."

@python3kgae python3kgae changed the title [Sema] Not report error when illegal intrinsic call is not used. [Sema] Not report error when invalid intrinsic call is not used. Jan 9, 2024
@python3kgae
Copy link
Contributor Author

From reading the changes, I don't think the title of the PR matches what's being done. You are separating out the logic for identifying an error, and actually emitting a diagnostic. Maybe a better title would be: "Separate diagnostic detection logic from diagnostic emission in Sema for invalid method calls."

The implementation is updated.
Let me know if the title still needs to be change.

Copy link
Collaborator

@bob80905 bob80905 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@llvm-beanz llvm-beanz left a comment

Choose a reason for hiding this comment

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

We should also probably add a test that verifies the -Wno-error= flag functionality (if it works). I don't think we have any tests running in tree that exercise that since we don't support the C++ tests.

@python3kgae
Copy link
Contributor Author

We should also probably add a test that verifies the -Wno-error= flag functionality (if it works). I don't think we have any tests running in tree that exercise that since we don't support the C++ tests.

-Wno-error= not work :(

@llvm-beanz
Copy link
Collaborator

-Wno-error= not work :(

Can you file an issue for that?

@python3kgae
Copy link
Contributor Author

-Wno-error= not work :(

Can you file an issue for that?

It works. Thought it does not work when hit lit test fail.
Added test for -Wno-error.

Copy link
Contributor

github-actions bot commented Jan 17, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@python3kgae python3kgae enabled auto-merge (squash) January 19, 2024 22:30
Copy link
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

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

I think we'll want to eventually move the derivatives requirements checks into a separate function, to simplify DiagnoseUsedHLSLMethodCall when more checks are needed, but this is fine for now.

@python3kgae python3kgae merged commit 79a290e into microsoft:main Jan 24, 2024
12 checks passed
@python3kgae python3kgae deleted the check_call_graph branch January 24, 2024 03:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SemaHLSL diag for CalculateLevelOfDetail too strict when code requiring SM 6.8 is unreachable
4 participants