Skip to content

Commit 5257df6

Browse files
Merge pull request #4 from Devsh-Graphics-Programming/before_inout_break
Last sync before changing SPIR-V codegen logic (`inout` changing to copy-in/copy-out)
2 parents 8a281b7 + fcbd2a1 commit 5257df6

File tree

96 files changed

+1673
-477
lines changed

Some content is hidden

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

96 files changed

+1673
-477
lines changed

.github/ISSUE_TEMPLATE/release.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ assignees: ''
1313
- At this point, changes must be cherry-picked into the release branch in
1414
order for them to be included in the release.
1515
- [ ] MM/DD/YYYY - Release Candidate 1 (begin Ask Mode[^1] for release branch).
16-
- At this point, changes must be approved by @microsoft/hlsl-release
16+
- At this point, cherry-picked changes must be approved by @microsoft/hlsl-release
1717
- [ ] MM/DD/YYYY - Final Release Candidate
1818
- [ ] MM/DD/YYYY - Target Release Date
1919

@@ -26,7 +26,7 @@ This part of the release process is to 'prime the pump' - that is to make sure
2626
that all the various parts of the engineering system are set into place so that
2727
we are confident we can generate builds for the new branch
2828

29-
- [ ] Update version number
29+
- [ ] Update version numbers in utils/version/latest-release.json and utils/version/version.inc
3030
- [ ] Create the release branch from `main`
3131
- The release branch is kept into sync with main via regular fast-forward
3232
merges.
@@ -39,7 +39,7 @@ we are confident we can generate builds for the new branch
3939

4040
## After Fork
4141

42-
- [ ] Update README.md
42+
- [ ] Update README.md if necessary
4343
- [ ] Create draft of Release post on GitHub
4444

4545
## Quality Sign Off

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ At the moment, the DirectX HLSL Compiler provides the following components:
1818

1919
- dxilconv.dll, a DLL providing a converter from DXBC (older shader bytecode format)
2020

21+
- dxv.exe, a command-line tool that validates DXIL IR (compiled HLSL programs).
22+
2123
- various other tools based on the above components
2224

2325
The Microsoft Windows SDK releases include a supported version of the compiler and validator.

azure-pipelines.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
trigger:
22
- main
33
- release*
4+
5+
pr:
6+
- main
7+
- release*
48

59
resources:
610
- repo: self
@@ -9,7 +13,7 @@ stages:
913
- stage: Build
1014
jobs:
1115
- job: Windows
12-
timeoutInMinutes: 90
16+
timeoutInMinutes: 120
1317

1418
pool:
1519
vmImage: windows-2022
@@ -38,9 +42,13 @@ stages:
3842
call utils\hct\hctstart.cmd %HLSL_SRC_DIR% %HLSL_BLD_DIR%
3943
call utils\hct\hcttest.cmd -$(configuration) noexec
4044
displayName: 'DXIL Tests'
45+
- script: |
46+
call utils\hct\hctstart.cmd %HLSL_SRC_DIR% %HLSL_BLD_DIR%
47+
call utils\hct\hcttest.cmd -$(configuration) exec-warp
48+
displayName: 'DXIL Execution Tests (Nuget WARP)'
4149
4250
- job: Nix
43-
timeoutInMinutes: 90
51+
timeoutInMinutes: 120
4452

4553
variables:
4654
macOS: macOS-latest

cmake/modules/Nuget.cmake

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
include_guard(GLOBAL)
2+
3+
if(NOT DEFINED BINARY_DIR)
4+
message(SEND_ERROR "Callers must provide BINARY_DIR")
5+
endif()
6+
7+
if(NOT DEFINED BUILD_TYPE)
8+
message(SEND_ERROR "Callers must provide BUILD_TYPE")
9+
endif()
10+
11+
if(NOT DEFINED ENV{USE_WARP_FROM_NUGET})
12+
message(SEND_ERROR "Callers must set a string value for the environment variable USE_WARP_FROM_NUGET."
13+
"Either 'LATEST_RELEASE' or 'LATEST_PREVIEW'")
14+
endif()
15+
16+
set(USE_WARP_FROM_NUGET $ENV{USE_WARP_FROM_NUGET})
17+
18+
# Downloads nuget.exe to the given path if it doesn't exist yet.
19+
function(EnsureNugetExists target_path)
20+
# Download the latest nuget.exe to the given path.
21+
if(NOT EXISTS ${target_path})
22+
message(STATUS "Installing nuget.exe to ${target_path}...")
23+
file(DOWNLOAD
24+
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
25+
${target_path}
26+
)
27+
endif()
28+
endfunction()
29+
30+
# Download the latest nuget package for the given ID. Can pass in a custom source, defaults to nuget public feed.
31+
function(GetNuGetPackageLatestVersion)
32+
set(params NAME ID SOURCE OUTPUT_DIR OUTPUT_VARIABLE PREVIEW)
33+
cmake_parse_arguments(PARSE_ARGV 0 ARG "" "${params}" "")
34+
35+
if(NOT ARG_OUTPUT_DIR)
36+
set(ARG_OUTPUT_DIR )
37+
endif()
38+
39+
set(nuget_exe_path "${ARG_OUTPUT_DIR}\\nuget.exe install")
40+
EnsureNugetExists(${nuget_exe_path})
41+
42+
if (${ARG_ID}_LATEST_VERSION)
43+
set(${ARG_OUTPUT_VARIABLE} ${${ARG_ID}_LATEST_VERSION} PARENT_SCOPE)
44+
else()
45+
if(NOT ARG_SOURCE)
46+
set(ARG_SOURCE https://api.nuget.org/v3/index.json)
47+
endif()
48+
49+
if(NOT ARG_PREVIEW)
50+
set(ARG_PREVIEW OFF)
51+
endif()
52+
53+
if(ARG_PREVIEW)
54+
# Note that '-Prerelease' options will only return a prerelease package if that is also the latest.
55+
# If you want a prerelease package with an older version number than the latest release package then you
56+
# need to pass a specific version number.
57+
message("Will add '-Prelease' to nuget list command")
58+
set(prerelease "-Prerelease")
59+
endif()
60+
61+
execute_process(
62+
COMMAND ${nuget_exe_path}
63+
list ${ARG_ID}
64+
-Source ${ARG_SOURCE}
65+
${prerelease}
66+
RESULT_VARIABLE result
67+
OUTPUT_VARIABLE nuget_list_output
68+
OUTPUT_STRIP_TRAILING_WHITESPACE
69+
)
70+
71+
if(NOT ${result} STREQUAL "0")
72+
message(FATAL_ERROR "NuGet failed to find latest version of package ${ARG_ID} with exit code ${result}.")
73+
endif()
74+
75+
# Get last line of running nuget.exe list <ID>.
76+
string(REPLACE "\n" ";" nuget_list_output ${nuget_list_output})
77+
list(POP_BACK nuget_list_output nuget_list_last_line)
78+
if(nuget_list_last_line STREQUAL "No packages found.")
79+
message(FATAL_ERROR "NuGet failed to find latest version of package ${ARG_ID}.")
80+
endif()
81+
82+
# The last line should have the format <ID> <VERSION>
83+
string(REPLACE " " ";" nuget_list_last_line ${nuget_list_last_line})
84+
list(POP_BACK nuget_list_last_line nuget_version)
85+
86+
if(NOT nuget_version)
87+
message(FATAL_ERROR "NuGet failed to find latest version of package ${ARG_ID}.")
88+
endif()
89+
90+
message("Nuget found version:${nuget_version} for ${ARG_ID}")
91+
92+
# Save output variable and cache the result so subsequent calls to the version-unspecified package
93+
# are faster.
94+
set(${ARG_OUTPUT_VARIABLE} ${nuget_version} PARENT_SCOPE)
95+
set(${ARG_ID}_LATEST_VERSION ${nuget_version} CACHE INTERNAL "")
96+
endif()
97+
endfunction()
98+
99+
# Installs a NuGet package under OUTPUT_DIR.
100+
#
101+
# FetchNuGetPackage(
102+
# ID Microsoft.Direct3D.WARP
103+
# VERSION 1.0.13
104+
# SOURCE https://api.nuget.org/v3/index.json
105+
# )
106+
#
107+
# This function sets a variable <name>_SOURCE_DIR (e.g. Microsoft.Direct3D.WARP_SOURCE_DIR in above example) to the
108+
# extract NuGet package contents.
109+
function(FetchNuGetPackage)
110+
set(params NAME ID VERSION SOURCE OUTPUT_DIR RELEASE_TYPE)
111+
cmake_parse_arguments(PARSE_ARGV 0 ARG "" "${params}" "")
112+
113+
# The NAME parameter is optional: if it's not set then the package ID is used as the name. The
114+
# reason for having a separate NAME is to allow a consistent identifier for packages whose ID
115+
# changes with each release (e.g. GDK).
116+
if(NOT ARG_NAME)
117+
set(ARG_NAME ${ARG_ID})
118+
endif()
119+
120+
if(NOT ARG_OUTPUT_DIR)
121+
set(ARG_OUTPUT_DIR ${BINARY_DIR}/temp)
122+
endif()
123+
124+
set(nuget_exe_path ${ARG_OUTPUT_DIR}/nuget.exe)
125+
126+
if(NOT ARG_SOURCE)
127+
set(ARG_SOURCE https://api.nuget.org/v3/index.json)
128+
endif()
129+
130+
if(NOT ARG_RELEASE_TYPE)
131+
set(ARG_RELEASE_TYPE "LATEST_RELEASE")
132+
endif()
133+
134+
set(PREVIEW OFF)
135+
136+
if(${ARG_RELEASE_TYPE} STREQUAL "LATEST_PREVIEW")
137+
set(PREVIEW ON)
138+
endif()
139+
140+
# Default to latest version
141+
if(NOT ARG_VERSION)
142+
GetNuGetPackageLatestVersion(
143+
ID ${ARG_ID}
144+
SOURCE ${ARG_SOURCE}
145+
PREVIEW ${PREVIEW}
146+
OUTPUT_DIR ${ARG_OUTPUT_DIR}
147+
OUTPUT_VARIABLE ARG_VERSION
148+
)
149+
endif()
150+
151+
set(nupkg_path ${ARG_OUTPUT_DIR}/${ARG_ID}.${ARG_VERSION}/${ARG_ID}.${ARG_VERSION}.nupkg)
152+
153+
if(NOT EXISTS ${nupkg_path})
154+
message(STATUS "NuGet: adding package ${ARG_ID}.${ARG_VERSION}")
155+
156+
EnsureNugetExists(${nuget_exe_path})
157+
158+
set(retry_count 0)
159+
set(max_retries 10)
160+
set(retry_delay 10)
161+
set(result 1)
162+
163+
# Run NuGet CLI to download the package.
164+
while(NOT ${result} STREQUAL "0" AND ${retry_count} LESS ${max_retries})
165+
message(STATUS "'${nuget_exe_path}' install '${ARG_ID}' -Version '${ARG_VERSION}' -Source '${ARG_SOURCE}' -OutputDirectory '${ARG_OUTPUT_DIR}' -DependencyVersion Ignore -Verbosity quiet")
166+
execute_process(
167+
COMMAND
168+
${nuget_exe_path}
169+
install ${ARG_ID}
170+
-Version ${ARG_VERSION}
171+
-Source ${ARG_SOURCE}
172+
-OutputDirectory ${ARG_OUTPUT_DIR}
173+
-DependencyVersion Ignore
174+
-Verbosity quiet
175+
RESULT_VARIABLE result
176+
)
177+
if(NOT ${result} STREQUAL "0")
178+
math(EXPR retry_count "${retry_count} + 1")
179+
180+
message(STATUS "Nuget failed: '${result}'. Retrying in ${retry_delay} seconds...")
181+
execute_process(
182+
COMMAND
183+
${CMAKE_COMMAND} -E sleep ${retry_delay}
184+
)
185+
endif()
186+
endwhile()
187+
188+
if(NOT ${result} STREQUAL "0")
189+
message(FATAL_ERROR "NuGet failed: '${result}' Package '${ARG_NAME}' (${ARG_ID}.${ARG_VERSION})")
190+
endif()
191+
endif()
192+
193+
# Set output variable. The NAME parameter is optional: if it's not set then the package ID is used as the
194+
# name. The reason for having a separate NAME is for packages whose IDs change (e.g. GDK) so that callers
195+
# can use a fixed name in dependents. Example, targets can reference gdk_SOURCE_DIR with the snippet below
196+
# instead of having to reference Microsoft.GDK.PC.230300_SOURCE_DIR.
197+
#
198+
# FetchNuGetPackage(
199+
# NAME gdk
200+
# ID Microsoft.GDK.PC.220300
201+
# VERSION 10.0.22621.3049
202+
# )
203+
set(${ARG_NAME}_SOURCE_DIR ${ARG_OUTPUT_DIR}/${ARG_ID}.${ARG_VERSION} PARENT_SCOPE)
204+
endfunction()
205+
206+
# Begin the 'main' logic of this file. Previous code is all defintions.
207+
message("USE_WARP_FROM_NUGET: ${USE_WARP_FROM_NUGET}")
208+
if(${USE_WARP_FROM_NUGET} STREQUAL "LATEST_RELEASE" OR ${USE_WARP_FROM_NUGET} STREQUAL "LATEST_PREVIEW")
209+
210+
message("Fetching warp from nuget")
211+
212+
FetchNuGetPackage(ID Microsoft.Direct3D.WARP OUTPUT_DIR ${BINARY_DIR}/temp RELEASE_TYPE ${USE_WARP_FROM_NUGET})
213+
214+
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
215+
set(ARCH "x64")
216+
endif()
217+
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "X86")
218+
set(ARCH "win32")
219+
endif()
220+
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64")
221+
set(ARCH "arm64")
222+
endif()
223+
224+
set(WARP_SOURCE_PATH "${Microsoft.Direct3D.WARP_SOURCE_DIR}/build/native/bin/${ARCH}")
225+
set(WARP_DEST_PATH "${BINARY_DIR}/${BUILD_TYPE}/bin/")
226+
message("Copying d3d10warp.dll and d3d10warp.pdb \n"
227+
" from: ${WARP_SOURCE_PATH}\n"
228+
" to: ${WARP_DEST_PATH}")
229+
file(COPY "${WARP_SOURCE_PATH}/d3d10warp.dll"
230+
DESTINATION "${WARP_DEST_PATH}")
231+
file(COPY "${WARP_SOURCE_PATH}/d3d10warp.pdb"
232+
DESTINATION "${WARP_DEST_PATH}")
233+
endif()

docs/ReleaseNotes.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ The included licenses apply to the following files:
2121

2222
Place release notes for the upcoming release below this line and remove this line upon naming this release.
2323

24-
- The incomplete WaveMatrix implementation has been removed.
25-
- DXIL Validator Hash is open sourced.
26-
- DXIL container validation for PSV0 part allows any content ordering inside string and semantic index tables.
24+
### Version 1.8.2502
25+
26+
- The incomplete WaveMatrix implementation has been removed. [#6807](https://github.com/microsoft/DirectXShaderCompiler/pull/6807)
27+
- DXIL Validator Hash is open sourced. [#6846](https://github.com/microsoft/DirectXShaderCompiler/pull/6846)
28+
- DXIL container validation for PSV0 part allows any content ordering inside string and semantic index tables. [#6859](https://github.com/microsoft/DirectXShaderCompiler/pull/6859)
29+
- The and() and or() intrinsics will now accept non-integer parameters by casting them to bools. [#7060](https://github.com/microsoft/DirectXShaderCompiler/pull/7060)
2730

2831
### Version 1.8.2407
2932

docs/SPIR-V.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4145,7 +4145,7 @@ GL_EXT_spirv_intrinsics is an extension of GLSL that allows users to embed
41454145
arbitrary SPIR-V instructions in the GLSL code similar to the concept of
41464146
inline assembly in the C code. We support the HLSL version of
41474147
GL_EXT_spirv_intrinsics. See
4148-
`wiki <https://github.com/microsoft/DirectXShaderCompiler/wiki/GL_EXT_spirv_intrinsics-for-SPIR-V-code-gen>`_
4148+
`wiki <https://github.com/microsoft/DirectXShaderCompiler/wiki/Inline-SPIR%E2%80%90V>`_
41494149
for the details.
41504150

41514151
Supported Command-line Options

include/dxc/DXIL/DxilConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace DXIL {
2929
const unsigned kDxilMajor = 1;
3030
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_dxil_version_minor()</py>*/
3131
// VALRULE-TEXT:BEGIN
32-
const unsigned kDxilMinor = 8;
32+
const unsigned kDxilMinor = 9;
3333
// VALRULE-TEXT:END
3434

3535
inline unsigned MakeDxilVersion(unsigned DxilMajor, unsigned DxilMinor) {

include/dxc/DXIL/DxilShaderModel.h

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ class ShaderModel {
2626
public:
2727
using Kind = DXIL::ShaderKind;
2828

29-
// Major/Minor version of highest shader model
29+
// Major/Minor version of highest recognized shader model
3030
// clang-format off
3131
// Python lines need to be not formatted.
3232
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_highest_shader_model()</py>*/
3333
// clang-format on
3434
// VALRULE-TEXT:BEGIN
3535
static const unsigned kHighestMajor = 6;
36-
static const unsigned kHighestMinor = 8;
36+
static const unsigned kHighestMinor = 9;
3737
// VALRULE-TEXT:END
38+
39+
// Major/Minor version of highest released shader model
40+
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_highest_released_shader_model()</py>*/
41+
// clang-format on
42+
// VALRULE-TEXT:BEGIN
43+
static const unsigned kHighestReleasedMajor = 6;
44+
static const unsigned kHighestReleasedMinor = 8;
45+
// VALRULE-TEXT:END
46+
3847
static const unsigned kOfflineMinor = 0xF;
3948

4049
bool IsPS() const { return m_Kind == Kind::Pixel; }
@@ -74,6 +83,7 @@ class ShaderModel {
7483
bool IsSM66Plus() const { return IsSMAtLeast(6, 6); }
7584
bool IsSM67Plus() const { return IsSMAtLeast(6, 7); }
7685
bool IsSM68Plus() const { return IsSMAtLeast(6, 8); }
86+
bool IsSM69Plus() const { return IsSMAtLeast(6, 9); }
7787
// VALRULE-TEXT:END
7888
const char *GetName() const { return m_pszName; }
7989
const char *GetKindName() const;
@@ -85,6 +95,8 @@ class ShaderModel {
8595
static const ShaderModel *Get(Kind Kind, unsigned Major, unsigned Minor);
8696
static const ShaderModel *GetByName(llvm::StringRef Name);
8797
static const char *GetKindName(Kind kind);
98+
static bool IsPreReleaseShaderModel(int Major, int Minor);
99+
static Kind GetKindFromName(llvm::StringRef Name);
88100
static DXIL::ShaderKind KindFromFullName(llvm::StringRef Name);
89101
static const llvm::StringRef FullNameFromKind(DXIL::ShaderKind sk);
90102
static const char *GetNodeLaunchTypeName(DXIL::NodeLaunchType launchTy);
@@ -121,7 +133,7 @@ class ShaderModel {
121133
bool m_bTypedUavs, unsigned m_UAVRegsLim);
122134
/* <py::lines('VALRULE-TEXT')>hctdb_instrhelp.get_num_shader_models()</py>*/
123135
// VALRULE-TEXT:BEGIN
124-
static const unsigned kNumShaderModels = 92;
136+
static const unsigned kNumShaderModels = 101;
125137
// VALRULE-TEXT:END
126138
static const ShaderModel ms_ShaderModels[kNumShaderModels];
127139

0 commit comments

Comments
 (0)