Merge remote-tracking branch 'ms/dxil-v1.0' into integration

This commit is contained in:
Tex Riddell 2017-02-01 15:43:43 -08:00
Родитель 797548781c 3c7734c7da
Коммит c18ed9133e
219 изменённых файлов: 1304 добавлений и 520 удалений

Просмотреть файл

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) 2016 Microsoft
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Просмотреть файл

@ -87,9 +87,9 @@ You can find documentation for this project in the `docs` directory. These conta
## License ## License
DirectX Shader Compiler is distributed under the terms of the MIT license. DirectX Shader Compiler is distributed under the terms of the University of Illinois Open Source License.
See LICENSE-MIT and COPYRIGHT for details. See LICENSE.txt and ThirdPartyNotices.txt for details.
## Code of Conduct ## Code of Conduct

Просмотреть файл

@ -1,13 +1,3 @@
DirectX Shader Compiler is copyright 2016, Microsoft Corporation.
Licensed under the MIT license (see LICENSE-MIT). All files in the project
carrying such notice may not be copied, modified, or distributed except
according to those terms.
DirectX Shader Compiler includes packages written by third parties. The
following third party packages are included, and carry their own copyright
notices and license terms:
* LLVM * LLVM
============================================================================== ==============================================================================

Просмотреть файл

@ -242,18 +242,19 @@ tree. The standard header looks like this:
.. code-block:: c++ .. code-block:: c++
//===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===// //===-- llvm/Instruction.h - Instruction class definition -------*- C++ -*-===//
/////////////////////////////////////////////////////////////////////////////// //
// // // The LLVM Compiler Infrastructure
// Instruction.h // //
// Copyright (C) Microsoft Corporation. All rights reserved. // // This file is distributed under the University of Illinois Open Source
// Licensed under the MIT license. See COPYRIGHT in the project root for // // License. See LICENSE.TXT for details.
// full license information. // //
// // //===----------------------------------------------------------------------===//
// \file // ///
// This file contains the declaration of the Instruction class, which is the // /// \file
// base class for all of the VM instructions. // /// This file contains the declaration of the Instruction class, which is the
// // /// base class for all of the VM instructions.
/////////////////////////////////////////////////////////////////////////////// ///
//===----------------------------------------------------------------------===//
A few things to note about this particular format: The "``-*- C++ -*-``" string A few things to note about this particular format: The "``-*- C++ -*-``" string
on the first line is there to tell Emacs that the source file is a C++ file, not on the first line is there to tell Emacs that the source file is a C++ file, not

Просмотреть файл

@ -2176,6 +2176,7 @@ INSTR.SAMPLERMODEFORSAMPLE sample/_l/_d/_cl_s/gather instruction requ
INSTR.SAMPLERMODEFORSAMPLEC sample_c_*/gather_c instructions require sampler declared in comparison mode INSTR.SAMPLERMODEFORSAMPLEC sample_c_*/gather_c instructions require sampler declared in comparison mode
INSTR.STRUCTBITCAST Bitcast on struct types is not allowed INSTR.STRUCTBITCAST Bitcast on struct types is not allowed
INSTR.TEXTUREOFFSET offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7 INSTR.TEXTUREOFFSET offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
INSTR.TGSMRACECOND Race condition writing to shared memory detected, consider making this write conditional
INSTR.UNDEFRESULTFORGETDIMENSION GetDimensions used undef dimension %0 on %1 INSTR.UNDEFRESULTFORGETDIMENSION GetDimensions used undef dimension %0 on %1
INSTR.WRITEMASKFORTYPEDUAVSTORE store on typed uav must write to all four components of the UAV INSTR.WRITEMASKFORTYPEDUAVSTORE store on typed uav must write to all four components of the UAV
INSTR.WRITEMASKMATCHVALUEFORUAVSTORE uav store write mask must match store value mask, write mask is %0 and store value mask is %1 INSTR.WRITEMASKMATCHVALUEFORUAVSTORE uav store write mask must match store value mask, write mask is %0 and store value mask is %1

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DXIL.h // // DXIL.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Main public header for DXIL. // // Main public header for DXIL. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilCBuffer.h // // DxilCBuffer.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL constant buffer (cbuffer). // // Representation of HLSL constant buffer (cbuffer). //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilCompType.h // // DxilCompType.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Represenation of HLSL component type. // // Represenation of HLSL component type. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilConstants.h // // DxilConstants.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Essential DXIL constants. // // Essential DXIL constants. //
// // // //
@ -624,6 +624,11 @@ namespace DXIL {
// DomainLocation. // DomainLocation.
const unsigned kDomainLocationColOpIdx = 1; const unsigned kDomainLocationColOpIdx = 1;
// BufferLoad.
const unsigned kBufferLoadHandleOpIdx = 1;
const unsigned kBufferLoadCoord0OpIdx = 2;
const unsigned kBufferLoadCoord1OpIdx = 3;
// BufferStore. // BufferStore.
const unsigned kBufferStoreHandleOpIdx = 1; const unsigned kBufferStoreHandleOpIdx = 1;
const unsigned kBufferStoreCoord0OpIdx = 2; const unsigned kBufferStoreCoord0OpIdx = 2;

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilContainer.h // // DxilContainer.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides declarations for the DXIL container format. // // Provides declarations for the DXIL container format. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilGenerationPass.h // // DxilGenerationPass.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file provides a DXIL Generation pass. // // This file provides a DXIL Generation pass. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilInstructions.h // // DxilInstructions.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file provides a library of instruction helper classes. // // This file provides a library of instruction helper classes. //
// MUCH WORK YET TO BE DONE - EXPECT THIS WILL CHANGE - GENERATED FILE // // MUCH WORK YET TO BE DONE - EXPECT THIS WILL CHANGE - GENERATED FILE //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilInterpolationMode.h // // DxilInterpolationMode.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL interpolation mode. // // Representation of HLSL interpolation mode. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilMetadataHelper.h // // DxilMetadataHelper.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Helper to serialize/desialize metadata for DxilModule. // // Helper to serialize/desialize metadata for DxilModule. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilModule.h // // DxilModule.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// The main class to work with DXIL, similar to LLVM module. // // The main class to work with DXIL, similar to LLVM module. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilOperations.h // // DxilOperations.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Implementation of DXIL operation tables. // // Implementation of DXIL operation tables. //
// // // //
@ -37,6 +37,7 @@ public:
OP(llvm::LLVMContext &Ctx, llvm::Module *pModule); OP(llvm::LLVMContext &Ctx, llvm::Module *pModule);
llvm::Function *GetOpFunc(OpCode OpCode, llvm::Type *pOverloadType); llvm::Function *GetOpFunc(OpCode OpCode, llvm::Type *pOverloadType);
llvm::Type *GetOverloadType(OpCode OpCode, llvm::Function *F);
llvm::LLVMContext &GetCtx() { return m_Ctx; } llvm::LLVMContext &GetCtx() { return m_Ctx; }
llvm::Type *GetHandleType() const; llvm::Type *GetHandleType() const;
llvm::Type *GetDimensionsType() const; llvm::Type *GetDimensionsType() const;

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilPipelineStateValidation.h // // DxilPipelineStateValidation.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Defines data used by the D3D runtime for PSO validation. // // Defines data used by the D3D runtime for PSO validation. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilResource.h // // DxilResource.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL SRVs and UAVs. // // Representation of HLSL SRVs and UAVs. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilResourceBase.h // // DxilResourceBase.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Base class to represent DXIL SRVs, UAVs, CBuffers, and Samplers. // // Base class to represent DXIL SRVs, UAVs, CBuffers, and Samplers. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilRootSignature.h // // DxilRootSignature.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// HLSL root signature parsing. // // HLSL root signature parsing. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSampler.h // // DxilSampler.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL sampler state. // // Representation of HLSL sampler state. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSemantic.h // // DxilSemantic.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL parameter semantics. // // Representation of HLSL parameter semantics. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilShaderModel.h // // DxilShaderModel.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL shader models. // // Representation of HLSL shader models. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSigPoint.h // // DxilSigPoint.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL signature points. // // Representation of HLSL signature points. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSignature.h // // DxilSignature.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL shader signature. // // Representation of HLSL shader signature. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSignatureAllocation.h // // DxilSignatureAllocation.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Classes used for allocating signature elements. // // Classes used for allocating signature elements. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSignatureElement.h // // DxilSignatureElement.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL signature element. // // Representation of HLSL signature element. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSpanAllocator.h // // DxilSpanAllocator.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Allocator for resources or other things that span a range of space // // Allocator for resources or other things that span a range of space //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilTypeSystem.h // // DxilTypeSystem.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// DXIL extension to LLVM type system. // // DXIL extension to LLVM type system. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilValidation.h // // DxilValidation.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file provides support for validating DXIL shaders. // // This file provides support for validating DXIL shaders. //
// // // //
@ -96,6 +96,7 @@ enum class ValidationRule : unsigned {
InstrSamplerModeForSample, // sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode InstrSamplerModeForSample, // sample/_l/_d/_cl_s/gather instruction requires sampler declared in default mode
InstrSamplerModeForSampleC, // sample_c_*/gather_c instructions require sampler declared in comparison mode InstrSamplerModeForSampleC, // sample_c_*/gather_c instructions require sampler declared in comparison mode
InstrStructBitCast, // Bitcast on struct types is not allowed InstrStructBitCast, // Bitcast on struct types is not allowed
InstrTGSMRaceCond, // Race condition writing to shared memory detected, consider making this write conditional
InstrTextureOffset, // offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7 InstrTextureOffset, // offset texture instructions must take offset which can resolve to integer literal in the range -8 to 7
InstrUndefResultForGetDimension, // GetDimensions used undef dimension %0 on %1 InstrUndefResultForGetDimension, // GetDimensions used undef dimension %0 on %1
InstrWriteMaskForTypedUAVStore, // store on typed uav must write to all four components of the UAV InstrWriteMaskForTypedUAVStore, // store on typed uav must write to all four components of the UAV

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLMatrixLowerHelper.h // // HLMatrixLowerHelper.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file provides helper functions to lower high level matrix. // // This file provides helper functions to lower high level matrix. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLMatrixLowerPass.h // // HLMatrixLowerPass.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file provides a high level matrix lower pass. // // This file provides a high level matrix lower pass. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLModule.h // // HLModule.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// HighLevel DX IR module. // // HighLevel DX IR module. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLOperationLower.h // // HLOperationLower.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Lower functions to lower HL operations to DXIL operations. // // Lower functions to lower HL operations to DXIL operations. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLOperationLowerExtension.h // // HLOperationLowerExtension.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Functions to lower HL operations coming from HLSL extensions to DXIL // // Functions to lower HL operations coming from HLSL extensions to DXIL //
// operations. // // operations. //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLOperations.h // // HLOperations.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Implentation of High Level DXIL operations. // // Implentation of High Level DXIL operations. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLResource.h // // HLResource.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL SRVs and UAVs in high-level DX IR. // // Representation of HLSL SRVs and UAVs in high-level DX IR. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLSLExtensionsCodegenHelper.h // // HLSLExtensionsCodegenHelper.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Codegen support for hlsl extensions. // // Codegen support for hlsl extensions. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// ReducibilityAnalysis.h // // ReducibilityAnalysis.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Implements reducibility analysis pass. // // Implements reducibility analysis pass. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HlslIntrinsicOp.h // // HlslIntrinsicOp.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Enumeration for HLSL intrinsics operations. // // Enumeration for HLSL intrinsics operations. //
// // // //

Просмотреть файл

@ -1,5 +1,5 @@
# Copyright (C) Microsoft Corporation. All rights reserved. # Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information. # This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
# TableGen HLSL options. # TableGen HLSL options.
set(LLVM_TARGET_DEFINITIONS HLSLOptions.td) set(LLVM_TARGET_DEFINITIONS HLSLOptions.td)
tablegen(LLVM HLSLOptions.inc -gen-opt-parser-defs) tablegen(LLVM HLSLOptions.inc -gen-opt-parser-defs)

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxcLangExtensionsHelper.h // // DxcLangExtensionsHelper.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides a helper class to implement language extensions to HLSL. // // Provides a helper class to implement language extensions to HLSL. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// ErrorCodes.h // // ErrorCodes.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides error code values for the DirectX compiler and tools. // // Provides error code values for the DirectX compiler and tools. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// FileIOHelper.h // // FileIOHelper.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides utitlity functions to work with files. // // Provides utitlity functions to work with files. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// Global.h // // Global.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides important declarations global to all DX Compiler code. // // Provides important declarations global to all DX Compiler code. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLSLOptions.h // // HLSLOptions.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Support for command-line-style option parsing. // // Support for command-line-style option parsing. //
// // // //

Просмотреть файл

@ -3,8 +3,8 @@
// // // //
// HLSLOptions.td // // HLSLOptions.td //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file defines the options accepted by HLSL. // // This file defines the options accepted by HLSL. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// Unicode.h // // Unicode.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides utitlity functions to work with Unicode and other encodings. // // Provides utitlity functions to work with Unicode and other encodings. //
// // // //

Просмотреть файл

@ -3,8 +3,8 @@
// // // //
// WinIncludes.h // // WinIncludes.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxcapi.impl.h // // dxcapi.impl.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for DXC API implementations. // // Provides support for DXC API implementations. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxcapi.use.h // // dxcapi.use.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for DXC API users. // // Provides support for DXC API users. //
// // // //

Просмотреть файл

@ -3,8 +3,8 @@
// // // //
// exception.h // // exception.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// microcom.h // // microcom.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for basic COM-like constructs. // // Provides support for basic COM-like constructs. //
// // // //

Просмотреть файл

@ -1,5 +1,5 @@
# Copyright (C) Microsoft Corporation. All rights reserved. # Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information. # This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
# Generate ETW instrumentation. # Generate ETW instrumentation.
# Create the header in a temporary file and only update when necessary, # Create the header in a temporary file and only update when necessary,

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxcapi.h // // dxcapi.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides declarations for the DirectX Compiler API entry point. // // Provides declarations for the DirectX Compiler API entry point. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxcapi.internal.h // // dxcapi.internal.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides non-public declarations for the DirectX Compiler component. // // Provides non-public declarations for the DirectX Compiler component. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxcisense.h // // dxcisense.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides declarations for the DirectX Compiler IntelliSense component. // // Provides declarations for the DirectX Compiler IntelliSense component. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxctools.h // // dxctools.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides declarations for the DirectX Compiler tooling components. // // Provides declarations for the DirectX Compiler tooling components. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// MSFileSystem.h // // MSFileSystem.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides error code values for the DirectX compiler. // // Provides error code values for the DirectX compiler. //
// // // //

Просмотреть файл

@ -3,8 +3,8 @@
// // // //
// OacrIgnoreCond.h // // OacrIgnoreCond.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// assert.h // // assert.h //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Defines custom assert macro for clang/llvm. // // Defines custom assert macro for clang/llvm. //
// // // //

Просмотреть файл

@ -1,5 +1,5 @@
# Copyright (C) Microsoft Corporation. All rights reserved. # Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information. # This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
add_llvm_library(LLVMDxcSupport add_llvm_library(LLVMDxcSupport
dxcapi.use.cpp dxcapi.use.cpp
FileIOHelper.cpp FileIOHelper.cpp

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// FileIOHelper.cpp // // FileIOHelper.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// Global.cpp // // Global.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// // // //

Просмотреть файл

@ -3,8 +3,8 @@
// // // //
// HLSLOptions.cpp // // HLSLOptions.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// Unicode.cpp // // Unicode.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides utitlity functions to work with Unicode and other encodings. // // Provides utitlity functions to work with Unicode and other encodings. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// dxcapi.use.cpp // // dxcapi.use.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for DXC API users. // // Provides support for DXC API users. //
// // // //

Просмотреть файл

@ -1,5 +1,5 @@
# Copyright (C) Microsoft Corporation. All rights reserved. # Copyright (C) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license. See COPYRIGHT in the project root for full license information. # This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
add_llvm_library(LLVMHLSL add_llvm_library(LLVMHLSL
DxilCBuffer.cpp DxilCBuffer.cpp
DxilCompType.cpp DxilCompType.cpp

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxcOptimizer.cpp // // DxcOptimizer.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides an IDxcOptimizer implementation. // // Provides an IDxcOptimizer implementation. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilCBuffer.cpp // // DxilCBuffer.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilCompType.cpp // // DxilCompType.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilCondenseResources.cpp // // DxilCondenseResources.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides a pass to make resource IDs zero-based and dense. // // Provides a pass to make resource IDs zero-based and dense. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilContainer.cpp // // DxilContainer.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for manipulating DXIL container structures. // // Provides support for manipulating DXIL container structures. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilContainerAssembler.cpp // // DxilContainerAssembler.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for serializing a module into DXIL container structures. // // Provides support for serializing a module into DXIL container structures. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilContainerReflection.cpp // // DxilContainerReflection.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for reading DXIL container structures. // // Provides support for reading DXIL container structures. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilGenerationPass.cpp // // DxilGenerationPass.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// DxilGenerationPass implementation. // // DxilGenerationPass implementation. //
// // // //
@ -1199,7 +1199,6 @@ void DxilGenerationPass::GenerateDxilInputsOutputs(bool bInput) {
if (!GV->getType()->isPointerTy()) { if (!GV->getType()->isPointerTy()) {
DXASSERT(bInput, "direct parameter must be input"); DXASSERT(bInput, "direct parameter must be input");
Value *vertexID = undefVertexIdx; Value *vertexID = undefVertexIdx;
Constant *OpArg = hlslOP->GetU32Const((unsigned)opcode);
Value *args[] = {OpArg, ID, /*rowIdx*/constZero, /*colIdx*/nullptr, vertexID}; Value *args[] = {OpArg, ID, /*rowIdx*/constZero, /*colIdx*/nullptr, vertexID};
replaceDirectInputParameter(GV, dxilFunc, cols, args, bI1Cast, hlslOP, EntryBuilder); replaceDirectInputParameter(GV, dxilFunc, cols, args, bI1Cast, hlslOP, EntryBuilder);
continue; continue;
@ -1222,7 +1221,6 @@ void DxilGenerationPass::GenerateDxilInputsOutputs(bool bInput) {
} }
if (LoadInst *ldInst = dyn_cast<LoadInst>(info.user)) { if (LoadInst *ldInst = dyn_cast<LoadInst>(info.user)) {
Constant *OpArg = hlslOP->GetU32Const((unsigned)opcode);
Value *args[] = {OpArg, ID, idxVal, info.vectorIdx, vertexID}; Value *args[] = {OpArg, ID, idxVal, info.vectorIdx, vertexID};
replaceLdWithLdInput(dxilFunc, ldInst, cols, args, bI1Cast, hlslOP); replaceLdWithLdInput(dxilFunc, ldInst, cols, args, bI1Cast, hlslOP);
} }
@ -1230,10 +1228,47 @@ void DxilGenerationPass::GenerateDxilInputsOutputs(bool bInput) {
if (bInput) { if (bInput) {
DXASSERT_LOCALVAR(bIsInout, bIsInout, "input should not have store use."); DXASSERT_LOCALVAR(bIsInout, bIsInout, "input should not have store use.");
} else { } else {
DXASSERT(!info.vectorIdx, if (!info.vectorIdx) {
"not implement vector indexing on output yet.");
replaceStWithStOutput(dxilFunc, stInst, opcode, ID, idxVal, cols, replaceStWithStOutput(dxilFunc, stInst, opcode, ID, idxVal, cols,
bI1Cast, hlslOP); bI1Cast, hlslOP);
} else {
Value *V = stInst->getValueOperand();
Type *Ty = V->getType();
DXASSERT(Ty == Ty->getScalarType() && !Ty->isAggregateType(),
"only support scalar here");
if (ConstantInt *ColIdx = dyn_cast<ConstantInt>(info.vectorIdx)) {
IRBuilder<> Builder(stInst);
Value *args[] = {OpArg, ID, idxVal, ColIdx, V};
GenerateStOutput(dxilFunc, args, Builder, bI1Cast);
} else {
BasicBlock *BB = stInst->getParent();
BasicBlock *EndBB = BB->splitBasicBlock(stInst);
TerminatorInst *TI = BB->getTerminator();
IRBuilder<> SwitchBuilder(TI);
LLVMContext &Ctx = m_pHLModule->GetCtx();
SwitchInst *Switch =
SwitchBuilder.CreateSwitch(info.vectorIdx, EndBB, cols);
TI->eraseFromParent();
Function *F = EndBB->getParent();
for (unsigned i = 0; i < cols; i++) {
BasicBlock *CaseBB = BasicBlock::Create(Ctx, "case", F, EndBB);
Switch->addCase(SwitchBuilder.getInt32(i), CaseBB);
IRBuilder<> CaseBuilder(CaseBB);
ConstantInt *CaseIdx = SwitchBuilder.getInt8(i);
Value *args[] = {OpArg, ID, idxVal, CaseIdx, V};
GenerateStOutput(dxilFunc, args, CaseBuilder, bI1Cast);
CaseBuilder.CreateBr(EndBB);
}
}
// remove stInst
stInst->eraseFromParent();
}
} }
} else if (CallInst *CI = dyn_cast<CallInst>(info.user)) { } else if (CallInst *CI = dyn_cast<CallInst>(info.user)) {
HLOpcodeGroup group = GetHLOpcodeGroupByName(CI->getCalledFunction()); HLOpcodeGroup group = GetHLOpcodeGroupByName(CI->getCalledFunction());
@ -2054,7 +2089,10 @@ void DxilGenerationPass::GenerateDxilCBufferHandles(std::unordered_map<Instructi
for (auto U : GV->users()) { for (auto U : GV->users()) {
// Must CBufferSubscript. // Must CBufferSubscript.
CallInst *CI = cast<CallInst>((U)); CallInst *CI = cast<CallInst>((U));
IRBuilder<> Builder(CI); // Put createHandle to entry block.
auto InsertPt =
CI->getParent()->getParent()->getEntryBlock().getFirstInsertionPt();
IRBuilder<> Builder(InsertPt);
CallInst *handle = Builder.CreateCall(createHandle, args, handleName); CallInst *handle = Builder.CreateCall(createHandle, args, handleName);
if (m_HasDbgInfo) { if (m_HasDbgInfo) {
@ -2068,8 +2106,17 @@ void DxilGenerationPass::GenerateDxilCBufferHandles(std::unordered_map<Instructi
// Must CBufferSubscript. // Must CBufferSubscript.
CallInst *CI = cast<CallInst>(U); CallInst *CI = cast<CallInst>(U);
IRBuilder<> Builder(CI); IRBuilder<> Builder(CI);
Value *CBIndex = CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx);
args[DXIL::OperandIndex::kCreateHandleResIndexOpIdx] = args[DXIL::OperandIndex::kCreateHandleResIndexOpIdx] =
CI->getArgOperand(HLOperandIndex::kSubscriptIndexOpIdx); CBIndex;
if (isa<ConstantInt>(CBIndex)) {
// Put createHandle to entry block for const index.
auto InsertPt = CI->getParent()
->getParent()
->getEntryBlock()
.getFirstInsertionPt();
Builder.SetInsertPoint(InsertPt);
}
CallInst *handle = Builder.CreateCall(createHandle, args, handleName); CallInst *handle = Builder.CreateCall(createHandle, args, handleName);
handleMap[CI] = handle; handleMap[CI] = handle;
} }
@ -2712,6 +2759,9 @@ static void PropagatePreciseAttributeOnOperand(Value *V, DxilTypeSystem &typeSys
// Clear fast math. // Clear fast math.
I->copyFastMathFlags(FastMathFlags()); I->copyFastMathFlags(FastMathFlags());
// Fast math not work on call, use metadata.
if (CallInst *CI = dyn_cast<CallInst>(I))
HLModule::MarkPreciseAttributeWithMetadata(CI);
PropagatePreciseAttribute(I, typeSys); PropagatePreciseAttribute(I, typeSys);
} }

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilInterpolationMode.cpp // // DxilInterpolationMode.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilMetadataHelper.cpp // // DxilMetadataHelper.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilModule.cpp // // DxilModule.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilOperations.cpp // // DxilOperations.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Implementation of DXIL operation tables. // // Implementation of DXIL operation tables. //
// // // //
@ -684,6 +684,111 @@ Function *OP::GetOpFunc(OpCode OpCode, Type *pOverloadType) {
return F; return F;
} }
llvm::Type *OP::GetOverloadType(OpCode OpCode, llvm::Function *F) {
DXASSERT(F, "not work on nullptr");
Type *Ty = F->getReturnType();
FunctionType *FT = F->getFunctionType();
/* <py::lines('OPCODE-OLOAD-TYPES')>hctdb_instrhelp.get_funcs_oload_type()</py>*/
switch (OpCode) { // return OpCode
// OPCODE-OLOAD-TYPES:BEGIN
case OpCode::IsNaN:
case OpCode::IsInf:
case OpCode::IsFinite:
case OpCode::IsNormal:
case OpCode::Countbits:
case OpCode::FirstbitLo:
case OpCode::FirstbitHi:
case OpCode::FirstbitSHi:
case OpCode::IMul:
case OpCode::UMul:
case OpCode::UDiv:
case OpCode::IAddc:
case OpCode::UAddc:
case OpCode::ISubc:
case OpCode::USubc:
case OpCode::WaveActiveAllEqual:
return FT->getParamType(1);
case OpCode::TempRegStore:
return FT->getParamType(2);
case OpCode::MinPrecXRegStore:
case OpCode::StoreOutput:
case OpCode::BufferStore:
case OpCode::StorePatchConstant:
return FT->getParamType(4);
case OpCode::TextureStore:
return FT->getParamType(5);
case OpCode::MakeDouble:
case OpCode::SplitDouble:
return Type::getDoubleTy(m_Ctx);
case OpCode::CheckAccessFullyMapped:
case OpCode::AtomicBinOp:
case OpCode::AtomicCompareExchange:
case OpCode::SampleIndex:
case OpCode::Coverage:
case OpCode::InnerCoverage:
case OpCode::ThreadId:
case OpCode::GroupId:
case OpCode::ThreadIdInGroup:
case OpCode::FlattenedThreadIdInGroup:
case OpCode::GSInstanceID:
case OpCode::OutputControlPointID:
case OpCode::PrimitiveID:
return IntegerType::get(m_Ctx, 32);
case OpCode::CalculateLOD:
case OpCode::DomainLocation:
return Type::getFloatTy(m_Ctx);
case OpCode::CreateHandle:
case OpCode::BufferUpdateCounter:
case OpCode::GetDimensions:
case OpCode::Texture2DMSGetSamplePosition:
case OpCode::RenderTargetGetSamplePosition:
case OpCode::RenderTargetGetSampleCount:
case OpCode::Barrier:
case OpCode::Discard:
case OpCode::EmitStream:
case OpCode::CutStream:
case OpCode::EmitThenCutStream:
case OpCode::CycleCounterLegacy:
case OpCode::WaveIsFirstLane:
case OpCode::WaveGetLaneIndex:
case OpCode::WaveGetLaneCount:
case OpCode::WaveAnyTrue:
case OpCode::WaveAllTrue:
case OpCode::WaveActiveBallot:
case OpCode::BitcastI16toF16:
case OpCode::BitcastF16toI16:
case OpCode::BitcastI32toF32:
case OpCode::BitcastF32toI32:
case OpCode::BitcastI64toF64:
case OpCode::BitcastF64toI64:
case OpCode::LegacyF32ToF16:
case OpCode::LegacyF16ToF32:
case OpCode::LegacyDoubleToFloat:
case OpCode::LegacyDoubleToSInt32:
case OpCode::LegacyDoubleToUInt32:
case OpCode::WaveAllBitCount:
case OpCode::WavePrefixBitCount:
return Type::getVoidTy(m_Ctx);
case OpCode::CBufferLoadLegacy:
case OpCode::Sample:
case OpCode::SampleBias:
case OpCode::SampleLevel:
case OpCode::SampleGrad:
case OpCode::SampleCmp:
case OpCode::SampleCmpLevelZero:
case OpCode::TextureLoad:
case OpCode::BufferLoad:
case OpCode::TextureGather:
case OpCode::TextureGatherCmp:
{
StructType *ST = cast<StructType>(Ty);
return ST->getElementType(0);
}
// OPCODE-OLOAD-TYPES:END
default: return Ty;
}
}
Type *OP::GetHandleType() const { Type *OP::GetHandleType() const {
return m_pHandleType; return m_pHandleType;
} }

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilResource.cpp // // DxilResource.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilResourceBase.cpp // // DxilResourceBase.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilRootSignature.cpp // // DxilRootSignature.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Provides support for manipulating root signature structures. // // Provides support for manipulating root signature structures. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSampler.cpp // // DxilSampler.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSemantic.cpp // // DxilSemantic.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilShaderModel.cpp // // DxilShaderModel.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSigPoint.cpp // // DxilSigPoint.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSignature.cpp // // DxilSignature.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSignature.cpp // // DxilSignature.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilSignatureElement.cpp // // DxilSignatureElement.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Representation of HLSL signature element. // // Representation of HLSL signature element. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilTypeSystem.cpp // // DxilTypeSystem.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// DxilValidation.cpp // // DxilValidation.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// This file provides support for validating DXIL shaders. // // This file provides support for validating DXIL shaders. //
// // // //
@ -25,6 +25,7 @@
#include "llvm/IR/LLVMContext.h" #include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "llvm/IR/Type.h" #include "llvm/IR/Type.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Instructions.h" #include "llvm/IR/Instructions.h"
#include "llvm/IR/InstIterator.h" #include "llvm/IR/InstIterator.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
@ -36,6 +37,7 @@
#include <unordered_set> #include <unordered_set>
#include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/Dominators.h" #include "llvm/IR/Dominators.h"
#include "llvm/Analysis/PostDominators.h"
#include "dxc/HLSL/DxilSpanAllocator.h" #include "dxc/HLSL/DxilSpanAllocator.h"
#include "dxc/HLSL/DxilSignatureAllocator.h" #include "dxc/HLSL/DxilSignatureAllocator.h"
#include <algorithm> #include <algorithm>
@ -158,6 +160,7 @@ const char *hlsl::GetValidationRuleText(ValidationRule value) {
case hlsl::ValidationRule::InstrCBufferClassForCBufferHandle: return "Expect Cbuffer for CBufferLoad handle"; case hlsl::ValidationRule::InstrCBufferClassForCBufferHandle: return "Expect Cbuffer for CBufferLoad handle";
case hlsl::ValidationRule::InstrFailToResloveTGSMPointer: return "TGSM pointers must originate from an unambiguous TGSM global variable."; case hlsl::ValidationRule::InstrFailToResloveTGSMPointer: return "TGSM pointers must originate from an unambiguous TGSM global variable.";
case hlsl::ValidationRule::InstrExtractValue: return "ExtractValue should only be used on dxil struct types and cmpxchg"; case hlsl::ValidationRule::InstrExtractValue: return "ExtractValue should only be used on dxil struct types and cmpxchg";
case hlsl::ValidationRule::InstrTGSMRaceCond: return "Race condition writing to shared memory detected, consider making this write conditional";
case hlsl::ValidationRule::TypesNoVector: return "Vector type '%0' is not allowed"; case hlsl::ValidationRule::TypesNoVector: return "Vector type '%0' is not allowed";
case hlsl::ValidationRule::TypesDefined: return "Type '%0' is not defined on DXIL primitives"; case hlsl::ValidationRule::TypesDefined: return "Type '%0' is not defined on DXIL primitives";
case hlsl::ValidationRule::TypesIntWidth: return "Int type '%0' has an invalid width"; case hlsl::ValidationRule::TypesIntWidth: return "Int type '%0' has an invalid width";
@ -1774,76 +1777,6 @@ static void ValidateDxilOperationCallInProfile(CallInst *CI,
} }
static Type *GetOverloadTyForDxilOperation(CallInst *CI, DXIL::OpCode opcode) {
Type *Ty = CI->getType();
if (Ty->isVoidTy()) {
switch (opcode) {
case DXIL::OpCode::StoreOutput:
case DXIL::OpCode::StorePatchConstant:
if (CI->getNumArgOperands() < DXIL::OperandIndex::kStoreOutputValOpIdx) {
// Will emit error later when cannot find valid dxil function.
return CI->getType();
}
return CI->getArgOperand(DXIL::OperandIndex::kStoreOutputValOpIdx)->getType();
case DXIL::OpCode::BufferStore:
return CI->getArgOperand(DXIL::OperandIndex::kBufferStoreVal0OpIdx)->getType();
case DXIL::OpCode::TextureStore:
return CI->getArgOperand(DXIL::OperandIndex::kTextureStoreVal0OpIdx)->getType();
default:
return Ty;
}
} else if (Ty->isAggregateType()) {
switch (opcode) {
case DXIL::OpCode::CreateHandle:
case DXIL::OpCode::GetDimensions:
case DXIL::OpCode::Texture2DMSGetSamplePosition:
case DXIL::OpCode::RenderTargetGetSamplePosition:
return Type::getVoidTy(CI->getContext());
case DXIL::OpCode::CBufferLoadLegacy:
case DXIL::OpCode::BufferLoad:
case DXIL::OpCode::TextureLoad:
case DXIL::OpCode::Sample:
case DXIL::OpCode::SampleBias:
case DXIL::OpCode::SampleCmp:
case DXIL::OpCode::SampleCmpLevelZero:
case DXIL::OpCode::SampleGrad:
case DXIL::OpCode::SampleLevel:
case DXIL::OpCode::TextureGather:
case DXIL::OpCode::TextureGatherCmp:
{
StructType *ST = cast<StructType>(CI->getType());
return ST->getElementType(0);
}
case DXIL::OpCode::SplitDouble:
return CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx)->getType();
default:
return Ty;
}
} else
switch (opcode) {
case DXIL::OpCode::BufferUpdateCounter:
case DXIL::OpCode::RenderTargetGetSampleCount:
return Type::getVoidTy(CI->getContext());
case DXIL::OpCode::CheckAccessFullyMapped:
return Type::getInt32Ty(CI->getContext());
case DXIL::OpCode::IsFinite:
case DXIL::OpCode::IsInf:
case DXIL::OpCode::IsNaN:
case DXIL::OpCode::IsNormal:
return CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx)->getType();
case DXIL::OpCode::WaveActiveAllEqual:
// TODO: build this whole function from hctdb.py
return CI->getArgOperand(1)->getType()->getScalarType();
case DXIL::OpCode::Countbits:
case DXIL::OpCode::FirstbitLo:
case DXIL::OpCode::FirstbitHi:
case DXIL::OpCode::FirstbitSHi:
return CI->getArgOperand(DXIL::OperandIndex::kUnarySrc0OpIdx)->getType()->getScalarType();
default:
return Ty;
}
}
static bool IsDxilFunction(llvm::Function *F) { static bool IsDxilFunction(llvm::Function *F) {
unsigned argSize = F->getArgumentList().size(); unsigned argSize = F->getArgumentList().size();
if (argSize < 1) { if (argSize < 1) {
@ -1896,7 +1829,7 @@ static void ValidateExternalFunction(Function *F, ValidationContext &ValCtx) {
dxilFunc = hlslOP->GetOpFunc(dxilOpcode, voidTy); dxilFunc = hlslOP->GetOpFunc(dxilOpcode, voidTy);
} }
else { else {
Type *Ty = GetOverloadTyForDxilOperation(CI, dxilOpcode); Type *Ty = hlslOP->GetOverloadType(dxilOpcode, CI->getCalledFunction());
try { try {
if (!hlslOP->IsOverloadLegal(dxilOpcode, Ty)) { if (!hlslOP->IsOverloadLegal(dxilOpcode, Ty)) {
ValCtx.EmitInstrError(CI, ValidationRule::InstrOload); ValCtx.EmitInstrError(CI, ValidationRule::InstrOload);
@ -2001,8 +1934,10 @@ static bool ValidateType(Type *Ty, ValidationContext &ValCtx) {
StringRef Name = ST->getName(); StringRef Name = ST->getName();
if (Name.startswith("dx.")) { if (Name.startswith("dx.")) {
hlsl::OP *hlslOP = ValCtx.DxilMod.GetOP(); hlsl::OP *hlslOP = ValCtx.DxilMod.GetOP();
if (IsDxilBuiltinStructType(ST, hlslOP)) if (IsDxilBuiltinStructType(ST, hlslOP)) {
return true; ValCtx.EmitTypeError(Ty, ValidationRule::InstrDxilStructUser);
result = false;
}
ValCtx.EmitTypeError(Ty, ValidationRule::DeclDxilNsReserved); ValCtx.EmitTypeError(Ty, ValidationRule::DeclDxilNsReserved);
result = false; result = false;
@ -2619,15 +2554,59 @@ static void ValidateGlobalVariable(GlobalVariable &GV,
} }
} }
static void
CollectFixAddressAccess(Value *V, std::vector<Instruction *> &fixAddrTGSMList) {
for (User *U : V->users()) {
if (GEPOperator *GEP = dyn_cast<GEPOperator>(U)) {
if (isa<ConstantExpr>(GEP) || GEP->hasAllConstantIndices()) {
CollectFixAddressAccess(GEP, fixAddrTGSMList);
}
} else if (isa<StoreInst>(U)) {
fixAddrTGSMList.emplace_back(cast<Instruction>(U));
}
}
}
static void
ValidateTGSMRaceCondition(std::vector<Instruction *> &fixAddrTGSMList,
ValidationContext &ValCtx) {
std::unordered_set<Function *> fixAddrTGSMFuncSet;
for (Instruction *I : fixAddrTGSMList) {
BasicBlock *BB = I->getParent();
fixAddrTGSMFuncSet.insert(BB->getParent());
}
for (auto &F : ValCtx.DxilMod.GetModule()->functions()) {
if (F.isDeclaration() || !fixAddrTGSMFuncSet.count(&F))
continue;
PostDominatorTree PDT;
PDT.runOnFunction(F);
BasicBlock *Entry = &F.getEntryBlock();
for (Instruction *I : fixAddrTGSMList) {
BasicBlock *BB = I->getParent();
if (BB->getParent() == &F) {
if (PDT.dominates(BB, Entry)) {
ValCtx.EmitInstrError(I, ValidationRule::InstrTGSMRaceCond);
}
}
}
}
}
static void ValidateGlobalVariables(ValidationContext &ValCtx) { static void ValidateGlobalVariables(ValidationContext &ValCtx) {
DxilModule &M = ValCtx.DxilMod; DxilModule &M = ValCtx.DxilMod;
unsigned TGSMSize = 0; unsigned TGSMSize = 0;
std::vector<Instruction*> fixAddrTGSMList;
const DataLayout &DL = M.GetModule()->getDataLayout(); const DataLayout &DL = M.GetModule()->getDataLayout();
for (GlobalVariable &GV : M.GetModule()->globals()) { for (GlobalVariable &GV : M.GetModule()->globals()) {
ValidateGlobalVariable(GV, ValCtx); ValidateGlobalVariable(GV, ValCtx);
if (GV.getType()->getAddressSpace() == DXIL::kTGSMAddrSpace) { if (GV.getType()->getAddressSpace() == DXIL::kTGSMAddrSpace) {
TGSMSize += DL.getTypeAllocSize(GV.getType()->getElementType()); TGSMSize += DL.getTypeAllocSize(GV.getType()->getElementType());
CollectFixAddressAccess(&GV, fixAddrTGSMList);
} }
} }
@ -2636,6 +2615,9 @@ static void ValidateGlobalVariables(ValidationContext &ValCtx) {
{std::to_string(TGSMSize).c_str(), {std::to_string(TGSMSize).c_str(),
std::to_string(DXIL::kMaxTGSMSize).c_str()}); std::to_string(DXIL::kMaxTGSMSize).c_str()});
} }
if (!fixAddrTGSMList.empty()) {
ValidateTGSMRaceCondition(fixAddrTGSMList, ValCtx);
}
} }
static void ValidateValidatorVersion(ValidationContext &ValCtx) { static void ValidateValidatorVersion(ValidationContext &ValCtx) {

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLMatrixLowerPass.cpp // // HLMatrixLowerPass.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// HLMatrixLowerPass implementation. // // HLMatrixLowerPass implementation. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLModule.cpp // // HLModule.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// HighLevel DX IR module. // // HighLevel DX IR module. //
// // // //
@ -985,7 +985,8 @@ bool HLModule::HasPreciseAttributeWithMetadata(Instruction *I) {
void HLModule::MarkPreciseAttributeWithMetadata(Instruction *I) { void HLModule::MarkPreciseAttributeWithMetadata(Instruction *I) {
LLVMContext &Ctx = I->getContext(); LLVMContext &Ctx = I->getContext();
MDNode *preciseNode = MDNode::get( MDNode *preciseNode = MDNode::get(
Ctx, {MDString::get(Ctx, DxilMDHelper::kDxilPreciseAttributeMDName)}); Ctx,
{ConstantAsMetadata::get(ConstantInt::get(Type::getInt32Ty(Ctx), 1))});
I->setMetadata(DxilMDHelper::kDxilPreciseAttributeMDName, preciseNode); I->setMetadata(DxilMDHelper::kDxilPreciseAttributeMDName, preciseNode);
} }

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLOperationLower.cpp // // HLOperationLower.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Lower functions to lower HL operations to DXIL operations. // // Lower functions to lower HL operations to DXIL operations. //
// // // //
@ -354,6 +354,54 @@ Value *TranslateD3DColorToUByte4(CallInst *CI, IntrinsicOp IOP,
return Builder.CreateBitCast(byte4, CI->getType()); return Builder.CreateBitCast(byte4, CI->getType());
} }
Value *TranslateAddUint64(CallInst *CI, IntrinsicOp IOP,
OP::OpCode opcode,
HLOperationLowerHelper &helper, HLObjectOperationLowerHelper *pObjHelper, bool &Translated) {
hlsl::OP *hlslOP = &helper.hlslOP;
IRBuilder<> Builder(CI);
Value *val = CI->getArgOperand(HLOperandIndex::kUnaryOpSrc0Idx);
Type *Ty = val->getType();
VectorType *VT = dyn_cast<VectorType>(Ty);
if (!VT) {
CI->getContext().emitError(
CI, "AddUint64 can only be applied to uint2 and uint4 operands");
return UndefValue::get(Ty);
}
unsigned size = VT->getNumElements();
if (size != 2 && size != 4) {
CI->getContext().emitError(
CI, "AddUint64 can only be applied to uint2 and uint4 operands");
return UndefValue::get(Ty);
}
Value *op0 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc0Idx);
Value *op1 = CI->getArgOperand(HLOperandIndex::kBinaryOpSrc1Idx);
Value *RetVal = UndefValue::get(Ty);
Function *AddC = hlslOP->GetOpFunc(DXIL::OpCode::UAddc, helper.i32Ty);
Value *opArg = Builder.getInt32(static_cast<unsigned>(DXIL::OpCode::UAddc));
for (unsigned i=0; i<size; i+=2) {
Value *low0 = Builder.CreateExtractElement(op0, i);
Value *low1 = Builder.CreateExtractElement(op1, i);
Value *lowWithC = Builder.CreateCall(AddC, { opArg, low0, low1});
Value *low = Builder.CreateExtractValue(lowWithC, 0);
RetVal = Builder.CreateInsertElement(RetVal, low, i);
Value *carry = Builder.CreateExtractValue(lowWithC, 1);
// Ext i1 to i32
carry = Builder.CreateZExt(carry, helper.i32Ty);
Value *hi0 = Builder.CreateExtractElement(op0, i+1);
Value *hi1 = Builder.CreateExtractElement(op1, i+1);
Value *hi = Builder.CreateAdd(hi0, hi1);
hi = Builder.CreateAdd(hi, carry);
RetVal = Builder.CreateInsertElement(RetVal, hi, i+1);
}
return RetVal;
}
CallInst *ValidateLoadInput(Value *V) { CallInst *ValidateLoadInput(Value *V) {
// Must be load input. // Must be load input.
CallInst *CI = cast<CallInst>(V); CallInst *CI = cast<CallInst>(V);
@ -3041,14 +3089,14 @@ void TranslateAtomicCmpXChg(AtomicHelper &helper, IRBuilder<> &Builder,
_Analysis_assume_(vectorNumElements <= 3); _Analysis_assume_(vectorNumElements <= 3);
for (unsigned i = 0; i < vectorNumElements; i++) { for (unsigned i = 0; i < vectorNumElements; i++) {
Value *Elt = Builder.CreateExtractElement(addr, i); Value *Elt = Builder.CreateExtractElement(addr, i);
args[DXIL::OperandIndex::kAtomicBinOpCoord0OpIdx + i] = Elt; args[DXIL::OperandIndex::kAtomicCmpExchangeCoord0OpIdx + i] = Elt;
} }
} else } else
args[DXIL::OperandIndex::kAtomicBinOpCoord0OpIdx] = addr; args[DXIL::OperandIndex::kAtomicCmpExchangeCoord0OpIdx] = addr;
// Set offset for structured buffer. // Set offset for structured buffer.
if (helper.offset) if (helper.offset)
args[DXIL::OperandIndex::kAtomicBinOpCoord1OpIdx] = helper.offset; args[DXIL::OperandIndex::kAtomicCmpExchangeCoord1OpIdx] = helper.offset;
Value *origVal = Builder.CreateCall(dxilAtomic, args); Value *origVal = Builder.CreateCall(dxilAtomic, args);
if (helper.originalValue) { if (helper.originalValue) {
@ -3637,7 +3685,7 @@ Value *StreamOutputLower(CallInst *CI, IntrinsicOp IOP, DXIL::OpCode opcode,
} }
IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] = { IntrinsicLower gLowerTable[static_cast<unsigned>(IntrinsicOp::Num_Intrinsics)] = {
{IntrinsicOp::IOP_AddUint64, EmptyLower, DXIL::OpCode::NumOpCodes}, {IntrinsicOp::IOP_AddUint64, TranslateAddUint64, DXIL::OpCode::UAddc},
{IntrinsicOp::IOP_AllMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier}, {IntrinsicOp::IOP_AllMemoryBarrier, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_AllMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier}, {IntrinsicOp::IOP_AllMemoryBarrierWithGroupSync, TrivialBarrier, DXIL::OpCode::Barrier},
{IntrinsicOp::IOP_CheckAccessFullyMapped, TrivialUnaryOperation, DXIL::OpCode::CheckAccessFullyMapped}, {IntrinsicOp::IOP_CheckAccessFullyMapped, TrivialUnaryOperation, DXIL::OpCode::CheckAccessFullyMapped},
@ -5629,10 +5677,43 @@ void TranslateHLSubscript(CallInst *CI, HLSubscriptOpcode opcode,
Value *handle = pObjHelper->handleMap[ptrInst]; Value *handle = pObjHelper->handleMap[ptrInst];
DXIL::ResourceKind RK = pObjHelper->GetRK(ptrInst->getType()); DXIL::ResourceKind RK = pObjHelper->GetRK(ptrInst->getType());
Translated = true; Translated = true;
if (RK == DxilResource::Kind::StructuredBuffer) Type *ObjTy = ptrInst->getType();
TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP, helper.legacyDataLayout); Type *RetTy = ObjTy->getStructElementType(0);
else if (RK == DxilResource::Kind::StructuredBuffer) {
TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP,
helper.legacyDataLayout);
} else if (RetTy->isAggregateType() &&
RK == DxilResource::Kind::TypedBuffer) {
TranslateStructBufSubscript(CI, handle, /*status*/ nullptr, hlslOP,
helper.legacyDataLayout);
// Clear offset for typed buf.
for (auto User : handle->users()) {
CallInst *CI = cast<CallInst>(User);
switch (hlslOP->GetDxilOpFuncCallInst(CI)) {
case DXIL::OpCode::BufferLoad: {
CI->setArgOperand(DXIL::OperandIndex::kBufferLoadCoord1OpIdx,
UndefValue::get(helper.i32Ty));
} break;
case DXIL::OpCode::BufferStore: {
CI->setArgOperand(DXIL::OperandIndex::kBufferStoreCoord1OpIdx,
UndefValue::get(helper.i32Ty));
} break;
case DXIL::OpCode::AtomicBinOp: {
CI->setArgOperand(DXIL::OperandIndex::kAtomicBinOpCoord1OpIdx,
UndefValue::get(helper.i32Ty));
} break;
case DXIL::OpCode::AtomicCompareExchange: {
CI->setArgOperand(DXIL::OperandIndex::kAtomicCmpExchangeCoord1OpIdx,
UndefValue::get(helper.i32Ty));
} break;
default:
DXASSERT(0, "Invalid operation on resource handle");
break;
}
}
} else {
TranslateDefaultSubscript(CI, helper, pObjHelper, Translated); TranslateDefaultSubscript(CI, helper, pObjHelper, Translated);
}
return; return;
} }
} }

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLOperationLowerExtension.cpp // // HLOperationLowerExtension.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLOperations.cpp // // HLOperations.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
// Implementation of DXIL operations. // // Implementation of DXIL operations. //
// // // //

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// HLResource.cpp // // HLResource.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -1,5 +1,5 @@
; Copyright (C) Microsoft Corporation. All rights reserved. ; Copyright (C) Microsoft Corporation. All rights reserved.
; Licensed under the MIT license. See COPYRIGHT in the project root for full license information. ; This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details.
; ;
; This is an LLVMBuild description file for the components in this subdirectory. ; This is an LLVMBuild description file for the components in this subdirectory.
; ;

Просмотреть файл

@ -2,8 +2,8 @@
// // // //
// ReducibilityAnalysis.cpp // // ReducibilityAnalysis.cpp //
// Copyright (C) Microsoft Corporation. All rights reserved. // // Copyright (C) Microsoft Corporation. All rights reserved. //
// Licensed under the MIT license. See COPYRIGHT in the project root for // // This file is distributed under the University of Illinois Open Source //
// full license information. // // License. See LICENSE.TXT for details. //
// // // //
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше