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

[HLSL] Implement availability diagnostic - Default and Relaxed modes #90095

Closed
Tracked by #87389
hekota opened this issue Apr 25, 2024 · 1 comment · Fixed by #92704
Closed
Tracked by #87389

[HLSL] Implement availability diagnostic - Default and Relaxed modes #90095

hekota opened this issue Apr 25, 2024 · 1 comment · Fixed by #92704
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support

Comments

@hekota
Copy link
Member

hekota commented Apr 25, 2024

Implement default and relaxed modes of the availability diagnostic.

The default diagnostic mode performs an AST traversal after the translation unit has been fully parsed, and requires construction of a call graph. An AST visitor will traverse to all CallExpr nodes that are reachable from exported functions (either library exports or entry functions). If the callee of a CallExpr has availability annotations that signify that the API is unavailable for the target shader model and stage the compiler emits an error.

The implementation of the relaxed diagnostic mode matches the default mode, except that when a CallExpr references an unavailable API, the compiler emits a warning. A user enables relaxed mode by passing -Wno-error=hlsl-availability.

See HLSL Availability Diagnostic spec for more details.

@hekota hekota changed the title Implement Default and Relaxed diagnostics modes [HLSL] Implement availability diagnostic - Default and Relaxed modes Apr 25, 2024
@EugeneZelenko EugeneZelenko added HLSL HLSL Language Support and removed new issue labels Apr 25, 2024
@hekota hekota self-assigned this Apr 25, 2024
hekota added a commit that referenced this issue May 30, 2024
Implements HLSL availability diagnostics' default and relaxed mode.

HLSL availability diagnostics emits errors or warning when unavailable
shader APIs are used. Unavailable shader APIs are APIs that are exposed
in HLSL code but are not available in the target shader stage or shader
model version.

In the default mode the compiler emits an error when an unavailable API
is found in a code that is reachable from the shader entry point
function. In the future this check will also extended to exported
library functions (#92073). The relaxed diagnostic mode is the same
except the compiler emits a warning. This mode is enabled by
``-Wno-error=hlsl-availability``.

See HLSL Availability Diagnostics design doc
[here](https://github.com/llvm/llvm-project/blob/main/clang/docs/HLSL/AvailabilityDiagnostics.rst)
for more details.

Fixes #90095
@EugeneZelenko EugeneZelenko added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label May 30, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 30, 2024

@llvm/issue-subscribers-clang-frontend

Author: Helena Kotas (hekota)

Implement default and relaxed modes of the availability diagnostic.

The default diagnostic mode performs an AST traversal after the translation unit has been fully parsed, and requires construction of a call graph. An AST visitor will traverse to all CallExpr nodes that are reachable from exported functions (either library exports or entry functions). If the callee of a CallExpr has availability annotations that signify that the API is unavailable for the target shader model and stage the compiler emits an error.

The implementation of the relaxed diagnostic mode matches the default mode, except that when a CallExpr references an unavailable API, the compiler emits a warning. A user enables relaxed mode by passing -Wno-error=hlsl-availability.

See HLSL Availability Diagnostic spec for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants