Skip to content

Commit e0d2b7c

Browse files
author
devsh
committed
merge upstream from Microsoft
2 parents f565dbb + 206133c commit e0d2b7c

File tree

255 files changed

+7965
-1667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

255 files changed

+7965
-1667
lines changed

CMakeLists.txt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,18 +107,22 @@ option(DXC_DISABLE_ALLOCATOR_OVERRIDES "Disable usage of allocator overrides" OF
107107
mark_as_advanced(DXC_DISABLE_ALLOCATOR_OVERRIDES)
108108

109109
# adjust link option to enable debugging from kernel mode; not compatible with incremental linking
110-
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND WIN32 AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64EC")
110+
if(NOT CMAKE_VERSION VERSION_LESS "3.13" AND MSVC AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID STREQUAL "ARM64EC")
111111
add_link_options(/DEBUGTYPE:CV,FIXUP,PDATA /INCREMENTAL:NO)
112112
endif()
113113

114114
# enable control flow guard
115115
if(WIN32)
116-
add_compile_options(/guard:cf)
117-
add_link_options(/guard:cf)
116+
if(MSVC)
117+
add_compile_options(/guard:cf)
118+
add_link_options(/guard:cf)
119+
else()
120+
add_compile_options(-fcf-protection)
121+
endif()
118122
endif(WIN32)
119123

120124
# Enable CET Shadow Stack
121-
if(WIN32 AND NOT (CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*"))
125+
if(MSVC AND NOT (CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM.*"))
122126
add_link_options(/CETCOMPAT)
123127
endif()
124128

@@ -449,7 +453,7 @@ set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
449453
include(HandleLLVMOptions)
450454

451455
# Verify that we can find a Python 3 interpreter and force cmake to use it.
452-
find_package(PythonInterp 3 REQUIRED)
456+
find_package(Python3 REQUIRED)
453457

454458
######
455459
# LLVMBuild Integration
@@ -483,7 +487,7 @@ endif (LLVM_USE_OPROFILE)
483487
message(STATUS "Constructing LLVMBuild project information")
484488

485489
execute_process(
486-
COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
490+
COMMAND ${Python3_EXECUTABLE} ${LLVMBUILDTOOL}
487491
--native-target Unknown
488492
--enable-targets "${LLVM_TARGETS_TO_BUILD}"
489493
--enable-optional-components "${LLVMOPTIONALCOMPONENTS}"
@@ -647,6 +651,12 @@ endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
647651
# use export_executable_symbols(target).
648652
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
649653

654+
655+
# enable warnings as errors for debug build
656+
if (MSVC)
657+
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /WX")
658+
endif (MSVC)
659+
650660
include(AddLLVM)
651661
include(TableGen)
652662

@@ -758,7 +768,9 @@ if (LLVM_INCLUDE_DOCS)
758768
add_subdirectory(docs)
759769
endif()
760770

761-
add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change
771+
if (LLVM_BUILD_DOCS)
772+
add_hlsl_hctgen(DxilDocs OUTPUT docs/DXIL.rst CODE_TAG) # HLSL Change
773+
endif()
762774

763775
add_subdirectory(cmake/modules)
764776

cmake/modules/AddLLVM.cmake

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include(LLVMProcessSources)
22
include(LLVM-Config)
3+
find_package(Python3 REQUIRED)
34

45
function(llvm_update_compile_flags name)
56
get_property(sources TARGET ${name} PROPERTY SOURCES)
@@ -107,7 +108,7 @@ function(add_llvm_symbol_exports target_name export_file)
107108
set(native_export_file "${target_name}.def")
108109

109110
add_custom_command(OUTPUT ${native_export_file}
110-
COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print(''.join(['EXPORTS\\n']+sys.stdin.readlines(),))"
111+
COMMAND ${Python3_EXECUTABLE} -c "import sys;print(''.join(['EXPORTS\\n']+sys.stdin.readlines(),))"
111112
< ${export_file} > ${native_export_file}
112113
DEPENDS ${export_file}
113114
VERBATIM
@@ -244,14 +245,14 @@ endfunction()
244245
#
245246
function(add_windows_version_resource_file OUT_VAR)
246247
set(sources ${ARGN})
247-
if (MSVC)
248+
if (WIN32)
248249
set(resource_file ${LLVM_SOURCE_DIR}/resources/windows_version_resource.rc)
249250
if(EXISTS ${resource_file})
250251
set(sources ${sources} ${resource_file})
251252
source_group("Resource Files" ${resource_file})
252253
set(windows_resource_file ${resource_file} PARENT_SCOPE)
253254
endif()
254-
endif(MSVC)
255+
endif(WIN32)
255256

256257
set(${OUT_VAR} ${sources} PARENT_SCOPE)
257258
endfunction(add_windows_version_resource_file)
@@ -295,8 +296,10 @@ function(set_windows_version_resource_properties name resource_file)
295296
set(ARG_PRODUCT_NAME "LLVM")
296297
endif()
297298

299+
if (MSVC)
298300
set_property(SOURCE ${resource_file}
299301
PROPERTY COMPILE_FLAGS /nologo)
302+
endif()
300303
set_property(SOURCE ${resource_file}
301304
PROPERTY COMPILE_DEFINITIONS
302305
"RC_VERSION_FIELD_1=${ARG_VERSION_MAJOR}"
@@ -317,7 +320,7 @@ function(set_windows_version_resource_properties name resource_file)
317320
"INCLUDE_HLSL_VERSION_FILE=1")
318321
set_property(SOURCE ${resource_file}
319322
PROPERTY COMPILE_OPTIONS
320-
"/I" "${HLSL_VERSION_LOCATION}")
323+
"-I" "${HLSL_VERSION_LOCATION}")
321324
endif (DEFINED resource_file)
322325
endif(${HLSL_EMBED_VERSION})
323326
# HLSL change ends
@@ -867,7 +870,6 @@ function(configure_lit_site_cfg input output)
867870
# SHLIBDIR points the build tree.
868871
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} SHLIBDIR "${LLVM_SHLIB_OUTPUT_INTDIR}")
869872

870-
set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
871873
# FIXME: "ENABLE_SHARED" doesn't make sense, since it is used just for
872874
# plugins. We may rename it.
873875
if(LLVM_ENABLE_PLUGINS)
@@ -902,7 +904,7 @@ function(add_lit_target target comment)
902904
list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR})
903905
endif ()
904906
if (LLVM_MAIN_SRC_DIR)
905-
set (LIT_COMMAND ${PYTHON_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
907+
set (LIT_COMMAND ${Python3_EXECUTABLE} ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
906908
else()
907909
find_program(LIT_COMMAND llvm-lit)
908910
endif ()

cmake/modules/HCT.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function(add_hlsl_hctgen mode)
101101
endif()
102102

103103
add_custom_command(OUTPUT ${temp_output}
104-
COMMAND ${PYTHON_EXECUTABLE}
104+
COMMAND ${Python3_EXECUTABLE}
105105
${hctgen} ${force_lf}
106106
${mode} --output ${temp_output} ${input_flag}
107107
${format_cmd}

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,13 @@ if( LLVM_ENABLE_PIC )
195195
# Xcode has -mdynamic-no-pic on by default, which overrides -fPIC. I don't
196196
# know how to disable this, so just force ENABLE_PIC off for now.
197197
message(WARNING "-fPIC not supported with Xcode.")
198-
elseif( WIN32 OR CYGWIN)
199-
# On Windows all code is PIC. MinGW warns if -fPIC is used.
200198
else()
201-
add_flag_or_print_warning("-fPIC" FPIC)
199+
if( NOT WIN32 AND NOT CYGWIN )
200+
# On Windows all code is PIC. MinGW warns if -fPIC is used.
201+
add_flag_or_print_warning("-fPIC" FPIC)
202+
endif()
202203

203-
if( WIN32 OR CYGWIN)
204+
if( (MINGW AND NOT CLANG) OR CYGWIN )
204205
# MinGW warns if -fvisibility-inlines-hidden is used.
205206
else()
206207
check_cxx_compiler_flag("-fvisibility-inlines-hidden" SUPPORTS_FVISIBILITY_INLINES_HIDDEN_FLAG)
@@ -407,6 +408,15 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
407408
# Disable unknown pragma warnings because the output is just too long with them.
408409
append("-Wno-unknown-pragmas" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
409410

411+
if (MINGW)
412+
append("-Wno-implicit-fallthrough" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
413+
append("-Wno-missing-exception-spec" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
414+
append("-Wno-reorder-ctor" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
415+
append("-Wno-sign-compare" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
416+
append("-Wno-unused-const-variable" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
417+
append("-Wno-unused-function" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
418+
endif()
419+
410420
add_flag_if_supported("-Wno-unused-but-set-variable" UNUSED_BUT_SET_VARIABLE)
411421
add_flag_if_supported("-Wno-deprecated-copy" DEPRECATED_COPY)
412422

@@ -614,6 +624,15 @@ if(LLVM_ENABLE_EH AND NOT LLVM_ENABLE_RTTI)
614624
message(FATAL_ERROR "Exception handling requires RTTI. You must set LLVM_ENABLE_RTTI to ON")
615625
endif()
616626

627+
if (MINGW)
628+
if (LLVM_ENABLE_EH)
629+
append("-fexceptions" CMAKE_CXX_FLAGS)
630+
endif()
631+
if (LLVM_ENABLE_RTTI)
632+
append("-frtti" CMAKE_CXX_FLAGS)
633+
endif()
634+
endif()
635+
617636
# HLSL Change Begin
618637
option(LLVM_ENABLE_LTO "Enable building with LTO" ${HLSL_OFFICIAL_BUILD})
619638
if (LLVM_ENABLE_LTO)
@@ -624,7 +643,7 @@ if (LLVM_ENABLE_LTO)
624643
append("/GL" CMAKE_C_FLAGS${_SUFFIX} CMAKE_CXX_FLAGS${_SUFFIX})
625644
append("/LTCG" CMAKE_MODULE_LINKER_FLAGS${_SUFFIX} CMAKE_MODULE_LINKER_FLAGS${_SUFFIX} CMAKE_EXE_LINKER_FLAGS${_SUFFIX})
626645
else()
627-
add_flag_if_supported("-flto" SUPPORST_FLTO)
646+
add_flag_if_supported("-flto" SUPPORTS_FLTO)
628647
endif()
629648
endif()
630649
# HLSL Change End

docs/DXIL.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ Instead of DXBC labels/calls, DXIL supports functions and call instructions. Rec
261261

262262
The functions are regular LLVM functions. Parameters can be passed by-value or by-reference. The functions are to facilitate separate compilation for big, complex shaders. However, driver compilers are free to inline functions as they see fit.
263263

264+
In DXIL, only two string function attributes are permitted: 'waveops-include-helper-lanes' and 'fp32-denorm-mode'.
265+
266+
The attribute 'waveops-include-helper-lanes' is utilized to indicate that wave operations should consider helper lanes as active lanes.
267+
268+
'fp32-denorm-mode' is employed to define the denorm mode for the function. The possible values for this attribute can be 'any', 'preserve', or 'ftz'.
269+
264270
Identifiers
265271
-----------
266272

docs/ProgrammersManual.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,9 +1416,9 @@ llvm/IR/ValueMap.h
14161416
ValueMap is a wrapper around a :ref:`DenseMap <dss_densemap>` mapping
14171417
``Value*``\ s (or subclasses) to another type. When a Value is deleted or
14181418
RAUW'ed, ValueMap will update itself so the new version of the key is mapped to
1419-
the same value, just as if the key were a WeakVH. You can configure exactly how
1420-
this happens, and what else happens on these two events, by passing a ``Config``
1421-
parameter to the ValueMap template.
1419+
the same value, just as if the key were a WeakTrackingVH. You can configure
1420+
exactly how this happens, and what else happens on these two events, by passing
1421+
a ``Config`` parameter to the ValueMap template.
14221422

14231423
.. _dss_intervalmap:
14241424

docs/SPIR-V.rst

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ placed in the ``Uniform`` or ``UniformConstant`` storage class.
13611361
- Note that this modifier overrules ``static``; if both ``groupshared`` and
13621362
``static`` are applied to a variable, ``static`` will be ignored.
13631363

1364-
- ``uinform``
1364+
- ``uniform``
13651365

13661366
- This does not affect codegen. Variables will be treated like normal global
13671367
variables.
@@ -3826,8 +3826,8 @@ RayQuery Mapping to SPIR-V
38263826
|``.WorldRayOrigin` | ``OpRayQueryGetWorldRayOriginKHR`` |
38273827
+---------------------------------------------------+-------------------------------------------------------------------------+
38283828

3829-
Shader Model 6.0 Wave Intrinsics
3830-
================================
3829+
Shader Model 6.0+ Wave Intrinsics
3830+
=================================
38313831

38323832

38333833
Note that Wave intrinsics requires SPIR-V 1.3, which is supported by Vulkan 1.1.
@@ -3840,9 +3840,9 @@ loading from SPIR-V builtin variable ``SubgroupSize`` and
38403840
``SubgroupLocalInvocationId`` respectively, the rest are translated into SPIR-V
38413841
group operations with ``Subgroup`` scope according to the following chart:
38423842

3843-
============= ============================ =================================== ======================
3843+
============= ============================ =================================== ==============================
38443844
Wave Category Wave Intrinsics SPIR-V Opcode SPIR-V Group Operation
3845-
============= ============================ =================================== ======================
3845+
============= ============================ =================================== ==============================
38463846
Query ``WaveIsFirstLane()`` ``OpGroupNonUniformElect``
38473847
Vote ``WaveActiveAnyTrue()`` ``OpGroupNonUniformAny``
38483848
Vote ``WaveActiveAllTrue()`` ``OpGroupNonUniformAll``
@@ -3865,7 +3865,13 @@ Quad ``QuadReadAcrossX()`` ``OpGroupNonUniformQuadSwap``
38653865
Quad ``QuadReadAcrossY()`` ``OpGroupNonUniformQuadSwap``
38663866
Quad ``QuadReadAcrossDiagonal()`` ``OpGroupNonUniformQuadSwap``
38673867
Quad ``QuadReadLaneAt()`` ``OpGroupNonUniformQuadBroadcast``
3868-
============= ============================ =================================== ======================
3868+
N/A ``WaveMatch()`` ``OpGroupNonUniformPartitionNV``
3869+
Multiprefix ``WaveMultiPrefixSum()`` ``OpGroupNonUniform*Add`` ``PartitionedExclusiveScanNV``
3870+
Multiprefix ``WaveMultiPrefixProduct()`` ``OpGroupNonUniform*Mul`` ``PartitionedExclusiveScanNV``
3871+
Multiprefix ``WaveMultiPrefixBitAnd()`` ``OpGroupNonUniformLogicalAnd`` ``PartitionedExclusiveScanNV``
3872+
Multiprefix ``WaveMultiPrefixBitOr()`` ``OpGroupNonUniformLogicalOr`` ``PartitionedExclusiveScanNV``
3873+
Multiprefix ``WaveMultiPrefixBitXor()`` ``OpGroupNonUniformLogicalXor`` ``PartitionedExclusiveScanNV``
3874+
============= ============================ =================================== ==============================
38693875

38703876
The Implicit ``vk`` Namespace
38713877
=============================

include/dxc/Support/DxcOptToggles.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ enum {
3838
static const Toggle TOGGLE_GVN = {"gvn", DEFAULT_ON};
3939
static const Toggle TOGGLE_LICM = {"licm", DEFAULT_ON};
4040
static const Toggle TOGGLE_SINK = {"sink", DEFAULT_ON};
41+
static const Toggle TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION = {
42+
"aggressive-reassociation", DEFAULT_ON};
4143
static const Toggle TOGGLE_LIFETIME_MARKERS = {"lifetime-markers", DEFAULT_ON};
4244
static const Toggle TOGGLE_PARTIAL_LIFETIME_MARKERS = {
4345
"partial-lifetime-markers", DEFAULT_OFF};

include/dxc/Support/HLSLOptions.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ def fspv_preserve_interface : Flag<["-"], "fspv-preserve-interface">, Group<spir
412412
HelpText<"Preserves all interface variables in the entry point, even when those variables are unused">;
413413
def fvk_allow_rwstructuredbuffer_arrays: Flag<["-"], "fvk-allow-rwstructuredbuffer-arrays">, Group<spirv_Group>, Flags<[CoreOption, DriverOption, HelpHidden]>,
414414
HelpText<"Allow arrays of RWStructuredBuffers, AppendStructuredBuffers, and ConsumeStructuredBuffers. This is in development, and the option will be removed when the feature is complete.">;
415+
def fspv_max_id : MultiArg<["-"], "fspv-max-id", 1>, MetaVarName<"<shift> <space>">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
416+
HelpText<"Set the maximum value for an id in the SPIR-V binary. Default is 0x3FFFFF, which is the largest value all drivers must support.">;
415417
// SPIRV Change Ends
416418

417419
//////////////////////////////////////////////////////////////////////////////
@@ -498,8 +500,8 @@ def Qembed_debug : Flag<["-", "/"], "Qembed_debug">, Flags<[CoreOption]>, Group<
498500
HelpText<"Embed PDB in shader container (must be used with /Zi)">;
499501
def Qstrip_priv : Flag<["-", "/"], "Qstrip_priv">, Flags<[CoreOption, DriverOption]>, Group<hlslutil_Group>,
500502
HelpText<"Strip private data from shader bytecode (must be used with /Fo <file>)">;
501-
def Qsource_in_debug_module : Flag<["-", "/"], "Qsource_in_debug_module">, Flags<[CoreOption, HelpHidden]>, Group<hlslutil_Group>,
502-
HelpText<"Generate old PDB format.">;
503+
def Qsource_in_debug_module : Flag<["-", "/"], "Qsource_in_debug_module">, Flags<[CoreOption]>, Group<hlslutil_Group>,
504+
HelpText<"Embed source code in PDB">;
503505
def Qpdb_in_private : Flag<["-", "/"], "Qpdb_in_private">, Flags<[CoreOption, HelpHidden]>, Group<hlslutil_Group>,
504506
HelpText<"Store PDB in private user data.">;
505507

include/dxc/Support/SPIRVOptions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct SpirvCodeGenOptions {
8383
SpirvLayoutRule ampPayloadLayoutRule;
8484
llvm::StringRef stageIoOrder;
8585
llvm::StringRef targetEnv;
86+
uint32_t maxId;
8687
llvm::SmallVector<int32_t, 4> bShift;
8788
llvm::SmallVector<int32_t, 4> sShift;
8889
llvm::SmallVector<int32_t, 4> tShift;

0 commit comments

Comments
 (0)