Skip to content

Commit 16fc909

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/DirectXShaderCompiler into update_nbl_dxc_03_01_24
2 parents 3c5daf0 + 7d2f9c7 commit 16fc909

File tree

1,614 files changed

+47491
-20417
lines changed

Some content is hidden

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

1,614 files changed

+47491
-20417
lines changed

.github/workflows/clang-format-checker.yml

Lines changed: 82 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
name: "Check code formatting"
2-
on: pull_request_target
3-
permissions:
4-
pull-requests: write
2+
on:
3+
pull_request_target:
4+
types: [opened,synchronize]
5+
issue_comment:
6+
types: edited
57

68
jobs:
79
code_formatter:
10+
if: github.event_name == 'pull_request_target'
811
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write
914
steps:
1015
- name: Fetch LLVM sources
1116
uses: actions/checkout@v4
@@ -20,9 +25,10 @@ jobs:
2025
fetch_depth: 100 # Fetches only the last 10 commits
2126

2227
- name: "Listed files"
28+
env: LISTED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
2329
run: |
2430
echo "Formatting files:"
25-
echo "${{ steps.changed-files.outputs.all_changed_files }}"
31+
echo "$LISTED_FILES"
2632
2733
- name: Install clang-format
2834
uses: aminya/setup-cpp@v1
@@ -40,15 +46,86 @@ jobs:
4046
run: pip install -r utils/git/requirements_formatting.txt
4147

4248
- name: Run code formatter
49+
id: formatter
4350
env:
4451
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
4552
START_REV: ${{ github.event.pull_request.base.sha }}
4653
END_REV: ${{ github.event.pull_request.head.sha }}
4754
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
4855
run: |
49-
python utils/git/code-format-helper.py \
56+
python utils/git/code-format-helper.py \
5057
--token ${{ secrets.GITHUB_TOKEN }} \
5158
--issue-number $GITHUB_PR_NUMBER \
5259
--start-rev $START_REV \
5360
--end-rev $END_REV \
5461
--changed-files "$CHANGED_FILES"
62+
apply_diff:
63+
if: ${{ github.event_name == 'issue_comment' && endsWith(github.event.comment.body, '- [x] Check this box to apply formatting changes to this branch.') }}
64+
runs-on: ubuntu-latest
65+
env:
66+
TMP_DIFF_FILE: /tmp/diff.patch
67+
permissions:
68+
pull-requests: write
69+
contents: write
70+
steps:
71+
- uses: actions/github-script@v3
72+
id: get-pr
73+
with:
74+
script: |
75+
const request = {
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
pull_number: context.issue.number
79+
}
80+
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
81+
try {
82+
const result = await github.pulls.get(request)
83+
return result.data
84+
} catch (err) {
85+
core.setFailed(`Request failed with error ${err}`)
86+
}
87+
- name: Fetch LLVM sources
88+
uses: actions/checkout@v4
89+
with:
90+
fetch-depth: 2
91+
path: build/main_src
92+
93+
- name: Setup Python env
94+
uses: actions/setup-python@v4
95+
with:
96+
python-version: '3.11'
97+
cache: 'pip'
98+
cache-dependency-path: 'build/main_src/utils/git/requirements_formatting.txt'
99+
100+
- name: Install python dependencies
101+
run: pip install -r build/main_src/utils/git/requirements_formatting.txt
102+
103+
- name: Apply code diff
104+
env:
105+
GITHUB_PR_NUMBER: ${{ github.event.issue.number }}
106+
COMMENT_ID: ${{ github.event.comment.id }}
107+
run: |
108+
python build/main_src/utils/git/code-format-save-diff.py \
109+
--token ${{ secrets.GITHUB_TOKEN }} \
110+
--issue-number $GITHUB_PR_NUMBER \
111+
--tmp-diff-file $TMP_DIFF_FILE \
112+
--comment-id $COMMENT_ID
113+
114+
- name: Fetch LLVM sources for head
115+
uses: actions/checkout@v4
116+
with:
117+
fetch-depth: 2
118+
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
119+
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
120+
121+
- name: apply diff
122+
run: |
123+
git apply $TMP_DIFF_FILE
124+
git add .
125+
126+
- name: Commit & Push changes
127+
uses: actions-js/push@master
128+
with:
129+
branch: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
130+
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
131+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
[submodule "external/googletest"]
22
path = external/googletest
33
url = https://github.com/google/googletest
4-
[submodule "external/re2"]
5-
path = external/re2
6-
url = https://github.com/google/re2
7-
[submodule "external/effcee"]
8-
path = external/effcee
9-
url = https://github.com/google/effcee
104
[submodule "external/DirectX-Headers"]
115
path = external/DirectX-Headers
126
url = https://github.com/microsoft/DirectX-Headers.git

CMakeLists.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ endif()
3636

3737
project(LLVM)
3838

39-
# This requires a more recent version than CMake 3.4 but is a noop in prior versions. # HLSL Change
40-
set(VS_STARTUP_PROJECT "dndxc" CACHE STRING "VS startup project in solution") # HLSL Change
41-
4239
# The following only works with the Ninja generator in CMake >= 3.0.
4340
set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
4441
"Define the maximum number of concurrent compilation jobs.")
@@ -593,8 +590,10 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}
593590

594591
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
595592
if (APPLE)
596-
set(CMAKE_INSTALL_NAME_DIR "@rpath")
597-
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
593+
if(NOT DEFINED CMAKE_INSTALL_RPATH)
594+
set(CMAKE_INSTALL_NAME_DIR "@rpath")
595+
set(CMAKE_INSTALL_RPATH "@executable_path/../lib")
596+
endif(NOT DEFINED CMAKE_INSTALL_RPATH)
598597
else(UNIX)
599598
if(NOT DEFINED CMAKE_INSTALL_RPATH)
600599
set(CMAKE_INSTALL_RPATH "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}")

appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ test_script:
4747
- ps: utils\appveyor\appveyor_test.ps1
4848
- cmd: call utils\hct\hcttest -rel clang
4949
- sh: ./bin/dxc --help
50-
- sh: ./bin/dxc -T ps_6_0 ../tools/clang/test/CodeGenSPIRV_Lit/passthru-ps.hlsl2spv
51-
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.dxil ../tools/clang/test/CodeGenSPIRV_Lit/passthru-ps.hlsl2spv
52-
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.spv ../tools/clang/test/CodeGenSPIRV_Lit/passthru-ps.hlsl2spv -spirv
50+
- sh: ./bin/dxc -T ps_6_0 ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
51+
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.dxil ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv
52+
- sh: ./bin/dxc -T ps_6_0 -Fo passthru-ps.spv ../tools/clang/test/CodeGenSPIRV/passthru-ps.hlsl2spv -spirv
5353
- sh: ./tools/clang/unittests/SPIRV/ClangSPIRVTests --spirv-test-root ../tools/clang/test/CodeGenSPIRV/
5454
- sh: ./tools/clang/unittests/HLSL/ClangHLSLTests --HlslDataDir $PWD/../tools/clang/test/HLSL/
5555

azure-pipelines.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
trigger:
2+
- main
3+
- release*
4+
15
resources:
26
- repo: self
37

@@ -49,14 +53,15 @@ stages:
4953
configuration: Release
5054
CC: clang
5155
CXX: clang++
52-
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_ENABLE_SANITIZER=Address -DLLVM_ENABLE_LIBCXX=On
56+
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_USE_SANITIZER=Address,Undefined -DLLVM_ENABLE_LIBCXX=On -DLLVM_USE_LINKER=lld
57+
CHECK_ALL_ENV: ASAN_OPTIONS=alloc_dealloc_mismatch=0
5358
OS: Linux
5459
Linux_Clang_Debug:
5560
image: ${{ variables.linux }}
5661
configuration: Debug
5762
CC: clang
5863
CXX: clang++
59-
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On
64+
CMAKE_OPTS: -DLLVM_ENABLE_WERROR=On -DLLVM_USE_LINKER=lld
6065
Linux_Gcc_Release:
6166
image: ${{ variables.linux }}
6267
configuration: Release
@@ -104,7 +109,7 @@ stages:
104109
displayName: 'Installing dependencies'
105110
condition: eq(variables['image'], variables['macOS'])
106111
- bash: |
107-
cmake -B build -G Ninja $BUILD_SOURCESDIRECTORY -DLLVM_LIT_ARGS=--xunit-xml-output=testresults.xunit.xml -C $BUILD_SOURCESDIRECTORY/cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$(configuration) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) $(CMAKE_OPTS)
112+
cmake -B build -G Ninja $BUILD_SOURCESDIRECTORY -DLLVM_LIT_ARGS='-v --xunit-xml-output=testresults.xunit.xml' -C $BUILD_SOURCESDIRECTORY/cmake/caches/PredefinedParams.cmake -DSPIRV_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$(configuration) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) $(CMAKE_OPTS)
108113
displayName: 'Running Cmake'
109114
- bash: |
110115
ninja -C build test-depends
@@ -116,7 +121,7 @@ stages:
116121
ls -ld $AGENT_BUILDDIRECTORY
117122
ls -ld $BUILD_SOURCESDIRECTORY
118123
displayName: 'Smoke tests'
119-
- bash: ninja -C build check-all
124+
- bash: $(CHECK_ALL_ENV) ninja -C build check-all
120125
displayName: 'DXC tests'
121126
- task: PublishTestResults@2
122127
inputs:

cmake/modules/FindD3D12.cmake

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
# Find the Win10 SDK path.
22
if ("$ENV{WIN10_SDK_PATH}$ENV{WIN10_SDK_VERSION}" STREQUAL "" )
33
get_filename_component(WIN10_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" ABSOLUTE CACHE)
4-
set (WIN10_SDK_VERSION ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
4+
if (CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)
5+
set (WIN10_SDK_VERSION ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION})
6+
else()
7+
# CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION may not be defined if, for example,
8+
# the Ninja generator is used instead of Visual Studio. Attempt to retrieve the
9+
# most recent SDK version from the list of paths under "${WIN10_SDK_PATH}/Include/".
10+
file(GLOB sdk_dirs RELATIVE "${WIN10_SDK_PATH}/Include/" "${WIN10_SDK_PATH}/Include/10.*")
11+
if (sdk_dirs)
12+
list(POP_BACK sdk_dirs WIN10_SDK_VERSION)
13+
endif()
14+
unset(sdk_dirs)
15+
endif()
516
elseif(TRUE)
617
set (WIN10_SDK_PATH $ENV{WIN10_SDK_PATH})
718
set (WIN10_SDK_VERSION $ENV{WIN10_SDK_VERSION})

cmake/modules/FindDiaSDK.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ find_path(DIASDK_INCLUDE_DIR # Set variable DIASDK_INCLUDE_DIR
2222
dia2.h # Find a path with dia2.h
2323
HINTS "${VS_DIA_INC_PATH}"
2424
HINTS "${VSWHERE_LATEST}/DIA SDK/include"
25+
HINTS "${MSVC_DIA_SDK_DIR}/include"
2526
DOC "path to DIA SDK header files"
2627
)
2728

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ if( LLVM_ENABLE_ASSERTIONS )
7878
"${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
7979
endforeach()
8080
endif()
81+
else()
82+
# Disable assertions in Debug builds
83+
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
84+
add_definitions( -DNDEBUG )
85+
endif()
8186
endif()
8287

8388
string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS)

0 commit comments

Comments
 (0)