[CoopVec] Add Linear Algebra common header with tests#7350
[CoopVec] Add Linear Algebra common header with tests#7350bob80905 merged 18 commits intomicrosoft:staging-sm6.9from
Conversation
damyanp
left a comment
There was a problem hiding this comment.
I expect we'll need to mark most of these checks as expected to fail.
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
aed847d to
0b32642
Compare
damyanp
left a comment
There was a problem hiding this comment.
A few comments / questions I'd like to get cleared up before approving.
damyanp
left a comment
There was a problem hiding this comment.
LGTM, assuming the test runs succeed.
If the proposal example doesn't get executed often then it'll rot. Is there anything we can do to move it somewhere where it runs? If not, then we've got the example in the proposal itself so I don't know if there's much value keeping another copy around in the DXC repo.
| @@ -0,0 +1,143 @@ | |||
| // RUN: %dxc -I %hlsl_headers -T lib_6_9 -enable-16bit-types %s | |||
There was a problem hiding this comment.
Does this actually get executed during the build?
There was a problem hiding this comment.
This location won't run it as a test. I do think it's kind of awkward to keep it given there's a copy in the proposal itself, so I'll just delete it.
…erifier tests, and mark preview todos
There was a problem hiding this comment.
This is a sema test right?
| @@ -0,0 +1,178 @@ | |||
| // Header for linear algebra APIs. | |||
|
|
|||
| #if ((__SHADER_TARGET_MAJOR > 6) || \ | |||
There was a problem hiding this comment.
Should we make this header error if it is included when targeting older shader models?
What about targeting SPIRV?
There was a problem hiding this comment.
I think it's fine to include the header when the shader is targeting older shader models. The user might have some preprocessor code to use these APIs if 6.9 is available, and to default to a fallback if not.
It is my understanding that whether we're targeting SPIRV or not doesn't matter, the builtins will be lowered to the correct IR regardless.
There was a problem hiding this comment.
This is only supported for d3d / dxil (which is why everything is / will be in the dx namespace)
There was a problem hiding this comment.
The SPIRV path doesn't generate IR in DXC, it goes straight from the AST to SPIRV, which would likely cause the compiler either to crash or to emit a less-than helpful diagnostic.
There was a problem hiding this comment.
Maybe we could add something like this to the top of the file?
#if __spirv__
#error "Cooperative matrix not (yet) supported for SPIRV"
#endif| // Header for linear algebra APIs. | ||
|
|
||
| #if __spirv__ | ||
| #error "Cooperative matrix/vectors not (yet) supported for SPIRV" |
There was a problem hiding this comment.
| #error "Cooperative matrix/vectors not (yet) supported for SPIRV" | |
| #error "Cooperative vectors not (yet) supported for SPIRV" |
Sorry for my bad suggestion. Cooperative matrix actually is supported in SPIRV, they have a separate header for it.
| // This is a copy of \tools\clang\test\CodeGenDXIL\hlsl\linalg\outerproductaccumulate.hlsl | ||
| // except that spirv is targeted | ||
|
|
||
| // expected-error@dx/linalg.h:4{{Cooperative matrix/vectors not (yet) supported for SPIRV}} |
There was a problem hiding this comment.
| // expected-error@dx/linalg.h:4{{Cooperative matrix/vectors not (yet) supported for SPIRV}} | |
| // expected-error@dx/linalg.h:4{{Cooperative vectors not (yet) supported for SPIRV}} |
There was a problem hiding this comment.
This file doesn't seem to belong here.
This PR introduces the linear algebra header file, and places it in a location that is by default included in all HLSL compilation. The builtins in the API aren't yet defined, and depend on the microsoft#7290 PR merging first. The tests that have been added have temporary diagnostic messages while 7290 is in progress. They will need to be updated. Open to feedback on better / suggested error messages, or whether there shouldn't be any sema-level validation for these errors. Fixes [microsoft#7304](microsoft#7304) --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR introduces the linear algebra header file, and places it in a location that is by default included in all HLSL compilation. The builtins in the API aren't yet defined, and depend on the #7290 PR merging first. The tests that have been added have temporary diagnostic messages while 7290 is in progress. They will need to be updated. Open to feedback on better / suggested error messages, or whether there shouldn't be any sema-level validation for these errors. Fixes [#7304](#7304) Cherrypick of #7350 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This PR introduces the linear algebra header file, and places it in a location that is by default included in all HLSL compilation.
The builtins in the API aren't yet defined, and depend on the #7290 PR merging first.
The tests that have been added have temporary diagnostic messages while 7290 is in progress. They will need to be updated.
Open to feedback on better / suggested error messages, or whether there shouldn't be any sema-level validation for these errors.
Fixes #7304