Skip to content

Conversation

@damyanp
Copy link
Member

@damyanp damyanp commented Apr 30, 2025

Merge was clean apart from one conflict in HLOperations.h where HitObject::FromRayQuery wasn't in the staging version and got added.

s-perron and others added 16 commits April 23, 2025 13:32
Update the submodules to the latest release candidate for the Vulkan
SDK.
* HLSL -> DXIL lowering
* ast, hlsl->dxil, dxilgen, and ScalarReplAggregatesHLSL tests

SER implementation tracker (microsoft#7214)
Validate:
 HitObject_GeometryIndex
 HitObject_HitKind
 HitObject_InstanceID
 HitObject_InstanceIndex
 HitObject_IsHit
 HitObject_IsMiss
 HitObject_IsNop
 HitObject_LoadLocalRootTableConstant
 HitObject_ObjectRayDirection
 HitObject_ObjectRayOrigin
 HitObject_ObjectToWorld3x4
 HitObject_PrimitiveIndex
 HitObject_RayFlags
 HitObject_RayTCurrent
 HitObject_RayTMin
 HitObject_SetShaderTableIndex
 HitObject_ShaderTableIndex
 HitObject_WorldRayDirection
 HitObject_WorldRayOrigin

Rules:
* No undef parameters (HitObject, RecordIndex, RootTableOffset)
* row/col/component indices are constant and in-bounds
* If constant, RootTableOffset % 4 == 0

SER implementation tracker:
microsoft#7214
Validate:
 HitObject_MakeMiss

Rules:
 No undef MissShaderIndex or RayFlags

SER implementation tracker: microsoft#7214
The first parameter of the HLSL_INTRINSIC record is actually a dummy
entry for the function name.
When builtin member function templates are instantiated, the 'this' ptr
is added as the first ParamVarDecl, which has the same index as the
first argument in the HLSL_INTRINSIC record.
This shifts the parameter names by one for static member functions, as
those do not have a 'this' pointer, as in:

```
| | | `-CXXMethodDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> used MakeMiss 'dx::HitObject (unsigned int, unsigned int, RayDesc)' static
| | |   |-TemplateArgument type 'dx::HitObject'
| | |   |-TemplateArgument type 'unsigned int'
| | |   |-TemplateArgument type 'unsigned int'
| | |   |-TemplateArgument type 'RayDesc'
| | |   |-ParmVarDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> MakeMiss 'unsigned int'
| | |   |-ParmVarDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> RayFlags 'unsigned int'
| | |   |-ParmVarDecl {{[^ ]+}} <<invalid sloc>> <invalid sloc> MissShaderIndex 'RayDesc'
```

The fix is the take the first actual parameter name of the
HLSL_INTRINSIC if a static member function template is declared.

Closes microsoft#7374
…ics (microsoft#7290) (microsoft#7381)

Authored-by: Anupama Chandrasekhar <anupamac@nvidia.com>

Implements
HLSL:
__builtin_MatVecMul
__builtin_MatVecMulAdd
__builtin_OuterProductAccumulate
__builtin_VectorAccumulate

Lowered to
DXIL:
@dx.op.matVecMul
@dx.op.matVecMulAdd
 @dx.op.outerProductAccumulate
 @dx.op.vectorAccumulate

---------

Co-authored-by: Anupama Chandrasekhar <anupamac@nvidia.com>
Co-authored-by: Simon Moll <smoll@nvidia.com>
(cherry picked from commit 1db8c5b)
The current implementation of OpExecutionModeId assumes that the
operands must be OpConstants. However, they could be the id of a
spec constant. The first step in allowing OpExecutionModeId is to modify
the internal representation of the instruction to hold general spirv
instructions.

Part of microsoft#5960
and microsoft#3092.
microsoft#7388)

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)

Cherrypick of
microsoft#7350

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…osoft#7390)

Validator did not recognize %dx.types.HitObject as an allowed type. This
lead to validation failures in -Od compiles where allocas, loads and
stores remain in the generated DXIL:

```
  dxc.exe -T lib_6_9 -Od \tools\clang\test\CodeGenDXIL\hlsl\intrinsics\maybereorder.hlsl
  error: validation errors
  error: Declaration '%dx.types.HitObject = type { i8* }' uses a reserved prefix.
```
Closes microsoft#7387
This PR changes the default validation behavior to use the internal
validator by default.
If no options are specified, the internal validator will be used, and if
it fails, then compilation fails.
The external validator can still be run but must be explicitly chosen.
Specifying internal works just as before.

There is plenty of testing and infrastructure that needs to be added to
verify this change, but that needs to be added in a separate change.
This change is step 1.

Addresses microsoft#7389
Add upcoming release section to the release notes.
@damyanp damyanp merged commit 98c9a93 into microsoft:staging-sm6.9 Apr 30, 2025
13 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants