microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
2.98k stars 665 forks source link

Add header file to define cooperative matrices in spir-v #6720

Open s-perron opened 6 days ago

s-perron commented 6 days ago

This pr will introduce the HLSL standard header files. This will become the a way to add new extensions to HLSL without having to make modifications to the compiler.

This first example is a fairly complex example that demonstrates how to do a few different things:

  1. Trying to create a simple class interface that allows the compiler to naturally enforce the validation rules. In this case, we might be more strict than the spir-v validation, but I believe this is still usable.
  2. How to create a builtin that can be expanded by the spir-v backend. The OpCooperativeMatrixLengthKHR instruction does not have an interface that is natural in a language like HLSL. However, we can define a function that is, and have the backend, make small adjustments. These cases should be avoided as much as possible.
s-perron commented 5 days ago

@EpicJeanNoeMorissette FYI: You said you were interested in seeing this when it was ready to be made public. This will probably still go through some changes before it is merged, but this is the vision I have.

github-actions[bot] commented 2 days ago

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