* Update PSV with ViewID data structures
* Update PSV with signature element data and gate PSV1 on SM 6.1
* Unwrap array on primitive when assigning semantic indexes
- fix semantic index assignment for matrix and primitives
- fix some tests
- disable two tests due to AssembleToContainer fail:
ValidationTest::SigOutOfRangeFail
ValidationTest::SimpleGs1Fail
unlike other system value semantics, pixel shader is allowed to declare at most two input attributes with SV_Barycentrics, with one declaration uses perspective interpolation type while other one uses noperspective interpolation type.
* Add documentation with source-level debugging with HLSL and DXIL.
* Fix trailing underscore in generate .rst documentation.
* Add container support for debug name part.
* Bump validator version to 1.1.
* Implement debug stripping in dxc, including /Fd dir-named behavior.
* Implement IDxcCompiler2 and CompileWithDebug.
1. Add ResourceToHandle pass to lower resource to handle.
2. Don't performPromotion in SROA_HLSL.
3. Add Option support for DynamicIndexingVectorToArray.
4. Fix bug in GetPassOption.
5. Replace GEP ptr, 0 with ptr in DynamicIndexingVectorToArray::ReplaceStaticIndexingOnVector.
6. Run mem2reg before DxilGenerationPass.
7.Legalize EvalOperations before change vector to array.
* [spirv] Add libclangSPIRV and skeleton FrontendAction for SPIR-V
* [spirv] Add -spirv into dxc for invoking EmitSPIRVAction
* [spirv] Build SPIR-V codegen conditionally
Added ENABLE_SPIRV_CODEGEN in CMake config to control the
building of SPIR-V component and wrap up SPIR-V code using it.
Also add -spirv to hctbuild to turn it on.
Currently the compiler crashes when we pass in matrix or vectors with reduced dimension from the original signature element for EvalAttribute functions. This change resolves this issue by replacing allocas before we translate these function calls from DXIR to DXIL and find LoadInputs to replace correctly.
Make DxcCreateInstance load validator from dxil.dll when available
Add DxcVersionInfoFlags_Internal flag to indicate internal validator
Add DxcValidatorFlags_ModuleOnly to indicate absense of full container for validation, requiring explicit use. This will not succeed when using dxil.dll validator.
Bump Validator version
Implement IDxcVersionInfo in DxcCompiler to indicate DXIL highest version supported and debug flag for compiler separately from validator
Refactor version detection code for tests, adding dxil and validator versions
Make SystemValueTest version aware
Add version check to AttributeAtVertex and SV_Barycentrics tests.
Fix line endings for HlslTestUtils.h
1. Adding SV_Barycentric and removing barycentric intrinsics/dxilops
2. GetAttributeAtVertex only thakes no_interpolation attribute
3. SV_Barycentric can take any interpolation modifier except nointerpolation
4. SV_Barycentric can only have float3 type
1. Try to propagate if the pointer is only write once by the memcpy.
2. Use correct size for memcpy created in AppendBuffer::Append.
3. Ignore unused Constant user of Matrix value.
4. Replace Constant with Inst on the Instruction version of Constant.
5. When match size of memcpy, go deeper if struct only has 1 element.
Doing this will leave memcpy be lowered at deeper level.
6. Do not replace when SimplePtrCopy, cannot decide replace is safe or not.
- Add SV_ViewID loaded from intrinsic in Dxil,
for input to all graphics shader stages
- hctdb: rename shader_models to shader_stages,
add shader_model for min required shader model
- Validator: validate dxil version required for shader model
- DxilModule: Add GetDxilVersion
- Set Barycentric intrinsics to SM 6.1
- Update SystemValueTest for SM 6.1
This change is the initial step to support Barycentric coordinates for shader model 6.1 / DXIL 1.1
- Add GetBarycentrics, GetAttributeAtVertex intrinsics and their corresponding dxil ops
- Lowering intrinsics to dxil ops
- Adding codegen tests for these operations
1. Keep major for matrix pointers.
2. Change matrix values to row major to match hlsl.
Only ColMatLoad, RowMatrixToColMatrix and col matrix value parameter for entry function are col major matrix value.
And should only used by ColMatStore and ColMatrixToRowMatrix.
1. Add resource attribute to FieldAnnotation.
2. Find resource arribute from Argument in FindCreateHandleResourceBase.
3. Remove limitation handle must be instruction.
4. Add HandleToResCast to help lower resource parameter to handle parameter.
1. Remove debug info when strip function parameter from entry function.
2. Set OptLevel to 0 for -Od.
3. If optimization is disabled, always load ReturnValue.
This commit adds placeholder hooks to support constant folding of
extensions. They are defined in a separate file to make it easy to merge
changes or link in other versions. There should be no upstream changes to
these definitions.
This commit adds the 'dxil' strategy for lowering extensions. This
strategy will change the extension call into a call to a dxil intrinsic.
This is useful for targeting dxil intrinsics that are not exposed in hlsl.
This commit adds a new pass to hoist arrays from local to global scope
when the array only contains constant values. A local array will use
alloca and stores for initialization, but a global array uses a global
variable with a constant initializer.
The idea is that a global array with constant initializer will allow the
backend compilers to produce better code because it is much easier to see
that the array is fully constant.
This change modifies dxil constant folding to use the opcode class when
deciding if a dxil function can be constant folded. We now require a
DxilModule to be available when constant folding dxil functions.
To ensure that the dxil module is available we add a new pass that loads a
dxil module from metadata if it does not exist. We use the new pass in the
dxopt tests for constant folding.
* Ensure the cached Function->OpCodeClass map is updated
The original goal of this change was to use opcode class for deciding when we
can perform constant folding on a function.
We maintain a mapping from Function* to OpCodeClass inside the OP class.
We wanted to use this map in constant folding to decide if we can constant
fold a function to avoid string comparison on the function names.
However, it turns out that the DxilModule is not always available during
constant folding of dxil calls so we cannot use the map inside of OP. The
change contains a few bug fixes and improvements that came out of trying
to get opcode class working inside constant folding.
1. Use opcode class in dxil constant folding where possible.
2. Make sure the opcode cache is refreshed properly.
3. Remove 64-bit test for bfi.
4. Add equality comparison for the ShaderModel class.
When switching to use the opcode class for constant folding, we discovered
that our test for 64-bit bfi is invalid. There is no 64-bit overload for
bfi in dxil, so the test we had written was not legal dxil. This change
removes the 64-bit test for bfi constant prop.
This commit adds the ability to constant fold dxil intrinsics when
all inputs are constant. We reuse the llvm constant folding
infrastructure and add special cases for calls to dxil intrinsics.
This patch changes codegen for firstbithigh and firstbitlow.
For firstbitlow we do not generate a select on the return value from the
intrinsic. The previous codegen would check if the value is 0 and return -1 if
it was. However, the FirstbitLo intrinsic will return -1 when the input is 0 so
the select is not needed. So regardless of the input value we can take the
result of the intrinsic. This would match the code produced by fxc.
For firstbithi we check the value returned from the intrinsic for -1. If
the value returned is -1 we return -1. We do this for both signed and
unsigned intrinsics. The old codegen would check the input value for
0 and so would produce wrong code when the input value was -1.
We also disable constant folding in the front end for these intrinsics.
There was a bug in the constant folding that would cause a crash and
we are adding constant folding for dxil intrinsics to the optimizer
so we should not need it explicitly in the frontend for these
intrinsics.
* Lower resource to createHandle at clang code gen.
1. A HL createHandle will have 1 or 2 parameters.
For uav/srv/sampler, 1 parameter. 1 is the resource load from resource ptr.
For cbuffer, 2 parameter. 1 is the same. 2 is for dynamic indexing on array of cbuffers.
uav/srv/sampler don't have 2 is because all the use of them is on builtin methods. Resource on methods is scalar.
createHandle function will have metadata to save the resource information like class/kind/type/...
2. Added 2 more passes DxilLegalizeResourceUsePass DxilLegalizeStaticResourceUsePass to remove load/store on local/static resource.
Also make sure HL createHandle don't have phi operand.
3. For DxilGenerationPass, Dxil createHandle will be generated after GenerateDxilOperations.
And HLObjectOperationLowerHelper now get RK/RC from MetadataAsValue argument of HL createHandle.