Repository navigation
[HLSL] Extend LinAlg exec test shapes and types - #2
Closed
JoeCitizen wants to merge 32 commits into
Closed
JoeCitizen wants to merge 32 commits into
JoeCitizen wants to merge 32 commits into
Conversation
This reverts an old HLSL change to the Clang AST that classified external declarations as definitions rather than declarations. This was necessary due to how FXC treats declarations of cbuffer elements as definitions, but the way it was implemented had wider reaching impacts. This change restores the C++ classifications and moves duplicate definition handling into SeamaDecl and enforces the HLSL rules there instead of in the AST. Assisted-by: GitHub Copilot
…otes (microsoft#8931) Update release notes for the 1.9.2609 release. Assisted-By: Github Copilot --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f12a72d2-e956-4ca9-a301-5caca8d1b353
This PR introduces the C++11 and C++17 formations of the C++ `static_assert` expression. The TC57 proposal text is available online: https://hlsl-tc57.github.io/tc57/proposal/0010/ Fixes microsoft#8910 Assisted-by: GitHub Copilot
…#8983) GroupWaveIndexTest was the only test in the ExecutionTest/DxilConf shared section that declared Kits.TestId and Kits.Specification inline with BEGIN_TEST_METHOD_PROPERTIES(). The HLK DxilConf.cpp template declares Kits metadata for each test with BEGIN_TEST_METHOD(), so the inline block made TAEF report both properties twice for the HLK test. The Kits properties are only meaningful for the HLK, so keep them in the DxilConf template only. Co-authored-by: Joao Saffran <jderezende@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This is the same change as microsoft#7704 introduced but did not merge. This is a real bug that makes itself quite obvious when running `IDxcIndex::ParseTranslationUnit` on the following source: ```hlsl #define INVOKE_IMPL(Function, ...) Function(0, ##__VA_ARGS__) #define INVOKE(...) INVOKE_IMPL(__VA_ARGS__) float add(float left, float right) { return left + right; } float4 main() : SV_Target { float value = 1; return INVOKE(add, value).xxxx; } ``` Due to the uninitialized ExpandTokPastingArg, some invocations of `IDxcIndex::ParseTranslationUnit` will erroneously produce the following diagnostic: ``` pasting formed ',value', an invalid preprocessing token ``` Initializing `PreprocessingOptions::ExpandTokPastingArg` fixes this bug.
Fixes microsoft#8398 Restrict MakeInterpretedVector and Convert to exclude invalid calls Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com
> Part 2 of 14 in the PIX instrumentation stack. It targets `users/damyanp/pix-fixes-01`, which supplies the validation helpers. Eleven later layers use the helpers this layer changes, so please review it with care. More than one PIX pass can run on the same module. Each pass adds its own tools UAV, so a pipeline with two passes makes two resources at the same register and space. The code that adds this UAV to a root signature has three unsafe paths. Root signature serialization can fail and give a null blob, which the code then reads. An empty result can replace a correct root signature. Only the first global root-signature subobject gets the new parameter, so a state object that declares more than one is left in a mixed state. The tools UAV is a raw buffer, so it changes the shader flags of the module. The code does not compute the flags again. Some passes make a dx.op overload declaration and then find no callers for it. They leave the declaration in the module, and the validator refuses a module that has an unused declaration. When serialization fails, the helpers keep the original root signature. A valid signature is better than an empty one. Assisted-by: Copilot > This changes only the PIX instrumentation, so it needs no release note. --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93 Copilot-Session: 819bcd16-83fc-4619-ac1a-b12ee50a2fe8 Copilot-Session: d08bc707-8369-41b0-b88d-9b0c997a538b
This was an unexpected gap in the SPIRV emitter. We've always had StaticAssertDecls (just the C-spelling) so it didn't occur to me that the SPIRV emitter didn't handle them until I started writing extra tests using the new static_assert expression.
> Part 3 of 14 in the PIX instrumentation stack. It targets `users/damyanp/pix-fixes-02`, which supplies the shared instrumentation helpers. The non-uniform resource index pass writes each diagnostic bit at an address that it computes from the PIX instruction number of the handle. If a handle has no instruction number, the value stays at 0. A debug build stops at an assertion. A release build writes the bit for instruction 0 and gives the diagnostic to an unrelated instruction. Library helper functions are the usual source of these handles. The pass ignores such a handle instead of guessing. An absent record is correct. A record at instruction 0 is wrong. The report NuriNotInstrumentedMissingInstructionNumber tells the caller that the data is not complete. The pass reads the instruction number before it makes the UAV. A module whose dynamic handles all lack an instruction number therefore gets no UAV that it cannot use. A PIX build that does not read the new report keeps its current behavior. Assisted-by: Copilot > This changes only the PIX instrumentation, so it needs no release note. --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93
) Bit of a bike shedding on the template names as requested by the issue but it does make things more consistent! Fixes microsoft#8318
…soft#8794) ## Summary fixes microsoft#8793 Skip `CompilerTest::CodeGenFloatingPointEnvironment` when the x64 test binary is running under emulation on ARM64 Windows. The test attempts to unmask the divide-by-zero floating-point exception, but x64 emulation leaves `_EM_ZERODIVIDE` masked. The failure occurs before DXC compilation, so it does not indicate an ARM64X compiler regression. The runtime check uses the x64 target macro together with `IsWow64Process2`'s native machine result. `IsWow64Process2` is resolved dynamically to preserve compatibility with older Windows versions. The following PR's originally added skip logic for this test in 2022 microsoft#4308 microsoft#4320 ## Testing Tested on ARM64 Windows with an x64 build of `ClangHLSLTests`: - Before: `CodeGenFloatingPointEnvironment` failed with `0x0208021F` versus `0x02080217`. - After: the test is reported as skipped. - Full suite: `4928` total, `4927` passed, `0` failed, `1` skipped. --------- Co-authored-by: Alex Sepkowski <Alex.Sepkowski@microsoft.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Copilot-Session: cf0be5dd-405f-45e0-897d-a4762fa7b920
> Part 4 of 14 in the PIX instrumentation stack. It targets `users/damyanp/pix-fixes-03`. Its content depends on PR 2 for the shared helpers and PR 1 for the validation helpers. Each DXR invocation takes one slot in the log with an atomic increment on the counter UAV. If the slot number is too large, the pass limits it to the last slot. Every invocation that overflows therefore writes over the last correct record. PIX sees a full log with a plausible final entry and cannot detect the truncation. A capacity of zero makes that clamp wrap to a very large value, so a log with no slots accepts writes. An out-of-range slot must produce no write. The correct records then stay unchanged, and the overflow stays visible, because the claimed count is larger than the capacity. An invocation that overflows contributes no record. A tool that treats a full log as a complete log must compare the claimed count with the capacity. Assisted-by: Copilot > This changes only the PIX instrumentation, so it needs no release note. --- <sub>Stack created with <a href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Add an opt-in size preference for Windows Release builds. ## Change - Add `DXC_OPTIMIZE_FOR_SIZE`, defaulting to `OFF`. - When enabled, append `/Os` to the C and C++ Release flags on MSVC. `/Os` is used alongside `/O2`: Release builds remain fully optimized, while MSVC favors smaller generated code when an optimization involves a choice between code size and execution speed. ## Validation - Configured an x64 build with Visual Studio 18 2026 and `DXC_OPTIMIZE_FOR_SIZE=ON`. - Verified the generated Release `llvm-tblgen.vcxproj` contains `Optimization=MaxSpeed` and `FavorSizeOrSpeed=Size`, confirming `/O2` remains enabled while `/Os` supplies the size preference. - A/B build and package stages completed for x86, x64, and ARM64. Confirmed a reduced binary size and no test failures. Assisted-By: Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These two tests were introduced in PR microsoft#7116, but they are fragile to changes in the optimizer. So I've rewritten them as `-fcgl` tests to isolate them from changes to the optimizer. Notably PR microsoft#7116 contains functional changes only to the Clang CodeGen layer, the other changes in HLOperationLowering are NFC, so there is no additional need to test these changes later in the IR flow.
Several strings passed to TAEF were not wide strings and caused build failures on some machines for the HLSL exec tests depending on the version of TAEF headers used. ``` | [1505/1716] Building CXX object tools\clang\unittests\HLSLExec\CMakeFiles\ExecHLSLTests.dir\LongVectors.cpp.obj | FAILED: [code=2] tools/clang/unittests/HLSLExec/CMakeFiles/ExecHLSLTests.dir/LongVectors.cpp.obj | "C:\Program Files\WinGet\Links\sccache.exe" C:\PROGRA~1\MICROS~1\18\COMMUN~1\VC\Tools\MSVC\1451~1.362\bin\HOSTAR~1\arm64\cl.exe /nologo /TP -DENABLE_SPIRV_CODEGEN -DMSFT_SUPPORTS_CHILD_PROCESSES -DSUPPORT_QUERY_GIT_COMMIT_INFO -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_ITERATOR_DEBUG_LEVEL=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\build\tools\clang\unittests\HLSLExec -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\tools\clang\unittests\HLSLExec -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\tools\clang\include -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\build\tools\clang\include -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\include\llvm\llvm_assert -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\build\include -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\include -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\build\include\dxc\Tracing -I\directx -I\wsl\stubs -I"C:\Program Files (x86)\Windows Kits\10\Testing\Development\inc" -I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um" -I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared" -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\include\dxc\Test -IC:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\include\dxc\Support /DWIN32 /D_WINDOWS -wd4180 -wd4244 -wd4258 -wd4267 -wd4291 -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4324 -we4238 /W4 /Zc:sizedDealloc- /bigobj /O2 /Ob1 -std:c++17 -MD -Z7 -UNDEBUG /EHsc /guard:cf /showIncludes /Fotools\clang\unittests\HLSLExec\CMakeFiles\ExecHLSLTests.dir\LongVectors.cpp.obj /Fdtools\clang\unittests\HLSLExec\CMakeFiles\ExecHLSLTests.dir\ /FS -c C:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\tools\clang\unittests\HLSLExec\LongVectors.cpp | C:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\tools\clang\unittests\HLSLExec\LongVectorTestData.h(61): error C2664: 'bool WEX::TestExecution::Private::MacroVerify::Fail(const WEX::TestExecution::ErrorInfo &,const wchar_t *)': cannot convert argument 2 from 'const char [18]' to 'const wchar_t *' | C:\Users\Admin\.cache\act\771c49b93e7b4b67\hostexecutor\DXC\tools\clang\unittests\HLSLExec\LongVectorTestData.h(61): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast | C:\Program Files (x86)\Windows Kits\10\Testing\Development\inc\Verify.h(1788): note: see declaration of 'WEX::TestExecution::Private::MacroVerify::Fail' ```
This restores the BlockScanLimit in MemoryDependenceAnalysis to its LLVM 3.7 default (100), from what it was changed to in PR microsoft#2725. I'm not entirely sure what PR microsoft#2725 was trying to accomplish, and the tests it added still pass even with the original limit. What I do know is that the larger limit can cause _massive_ compile-time regressions by allowing GVN to go off into the weeds for all eternity. The original PR also didn't seem to catch that the limit impacts not just DSE, but also GVN (and MemCpyOpt but DXC disables that). I've left the rest of PR microsoft#2725 in-tact, but I'm generally dubious of it. We certainly should be _a lot_ more careful about changing LLVM core IR passes since we don't have the ability to run any of the IR pass tests.
The warning for legacy literals changing signedness was firing even on explicitly suffixed unsigned literals. This change fixes the invalid warning by not issuing it if the literal is explicitly unsigned. Fixes microsoft#7864
Add regression coverage for the NURI shader-flag validation path. Exercise instrumentation on a dynamically indexed resource and verify that the resulting module contains WaveActiveAllEqual and passes validation. Also check that the validation helper distinguishes real diagnostics from boilerplate. Assisted-by: Copilot Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93
This PR does two things: first it refactors the existing warning on ignored global initializers to move the general case (implicit cbuffer & groupshared) into Sema from the DXIL & SPIRV codegen layers. This generalization fixes issues where the warning wasn't firing, and expands it to all cbuffer members. Second, this PR turns that warning into an error in HLSL 202x+. Resolves microsoft#8483
Implement the changes in microsoft/DirectX-Specs#257
Add a root `AGENTS.md` with concise guidance for investigating DXC compile-time regressions and miscompiles. - Check local fork history and the LLVM 3.7 baseline before designing new mechanisms. - Enumerate all consumers of shared analysis limits and heuristics. - Account for the disabled upstream LLVM analysis and transform test suites. - Validate that reproducers preserve the original failure's structural sensitivity. - Use microsoft#2725 and microsoft#9003 as a short example of finding and restoring a fork-specific tuning regression. This is contributor and agent guidance only, with no user-visible compiler behavior change, so it does not require a release note under `CONTRIBUTING.md`. _Assisted by GitHub Copilot._ --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ft#8847) Do not record handle annotations or memory barriers as resource accesses. Continue tracing annotated handles so genuine accesses are still recorded. Record sampler accesses in library shaders so sampler bindings are not missed. Tests cover annotation and barrier handling, library sampler records, and dynamically indexed resources. Assisted-by: Copilot --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 40dc9de3-617e-4caf-ab0d-fba0a033ed93
…icrosoft#8715) Since I was doing bitfield fixes in microsoft#8713, I took this one too. This PR fixes microsoft#8526. Copying a `ConstantBuffer` value with merged bitfields into a local struct overwrites the members after the bitfields. For `struct MyData { uint a : 16; uint b : 16; uint c; }`, reading `c` returns the word holding `a` and `b`. This change makes `processFlatConversion` pick the decomposition mode from the source and destination AST types. A same-type conversion emits one scalar per SPIR-V field. But a cast that changes the shape, keeps one scalar per AST field. I added the test from the original issue. --------- Co-authored-by: Gregory Roth <goyoroth@gmail.com>
The DXIL eliminate vector pass was starting at the top of functions and iterating downward which caused cascading IR rewrites to occur. By using a worklist, and working from the back we reduce what was effectively an N^2 IR rewrite to roughly linear. Assisted-by: GitHub Copilot
This cleans up a bunch of places in the SPIRV codegenerator where we were relying on string matching of data types, which is extremely fragile. We've played a bit of wack-a-mole on fixing one-off issues here and there as we find them, but this is a more complete fix. There's still some cases with ROV types and a few other stray bits here and there, but this cleans up most of the SPIRV code. Assisted by Copilot
TC57 has decided not to include `interface` support in the official standard for HLSL. This change removes the feature in HLSL 202x and issues a warning diagnostic in the hlsl-2026-compat group to enable users to identify issues before they move to HLSL 2026. Resolves microsoft#8481 Assisted-by: GitHub Copilot --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…en (microsoft#8517) Building off of microsoft#8281, this PR adds a native lowering via SPV_EXT_descriptor_heap and SPV_KHR_untyped_pointers and is part 1/3 in a series. ResourceDescriptorHeap and SamplerDescriptorHeap are lowered to untyped variables decorated with ResourceHeapEXT and SamplerHeapEXT. Each heap access emits OpUntypedAccessChainKHR into a runtime array of the appropriate descriptor type. Buffer-like resources (StructuredBuffer, ByteAddressBuffer, ConstantBuffer, TextureBuffer) use OpTypeBufferEXT and OpBufferPointerEXT; image and sampler resources use OpLoad. Interlocked operations on RWTexture use OpUntypedImageTexelPointerEXT. Requires -fspv-target-env=vulkan1.3. Assisted by an AI agent. @dnovillo
Match [DirectX-Specs PR microsoft#258](microsoft/DirectX-Specs#258): take ThreadGroupSize as an exact-query input and return only multiplication support flags. Update the private ABI copy and its layout assertions, capability helpers, and capability policy tests.
This is a long-standing bug in the DXIL reflection code. The `ltrim`
function on `llvm::StringRef` takes an input string of characters to
strip, but this strips all occurrances of each character, not the
occurrances of a prefix string.
This means that if you call `lstrip("struct.")` you're not removing a
leading "struct.", you're actually removing any leading characters from
the set `['s', 't', 'r', 'u', 'c', 't', '.']`. Which means if the UDT
starts with any of those characters you drop those too.
Keep Copilot's missing-test feedback focused on clear omissions, using Chris's "TEST CASE?" seagulls meme when a functional change includes no test changes at all. The review guidance posts the meme in the review summary alongside a brief request for tests, at most once per PR. Incomplete coverage gets a normal, specific review comment instead. Docs, infrastructure, dependency bumps, NFC refactors, and PRs explaining why tests are infeasible or linking related test coverage are excluded. Instructions-only change; the behavior has not yet been exercised in a Copilot review. _Assisted by GitHub Copilot._ Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a003681e-c910-420c-a7e6-7b79d07bd97e
Several LinAlg exec checks only ran at shapes below the usual native tile size, and Tier 1 I8/U8 support had little or no coverage. This adds tests at native granularity and fills the I8/U8 gaps. - Wave F16 multiply at 16x16x8, and I8/U8 to I32 at 16x32x8 and 32x32x32. - ThreadGroup multiply and load/store at fixed 128 and 256 thread groups. I8/U8 use 32x32x32 at 128 threads so K stays at 32. - F32 element access, layout round trips and I32/F32 contention on 16x16 and 16x32 accumulators, plus F32 accumulator to F16 A/B casts. - WaveScaled ThreadGroup load/store now sweeps group sizes. - Mandatory I8/U8 vector Convert tests: saturation, rounding, inf/NaN, a partial last word, and Convert feeding a MatVec. Fixes microsoft#9047 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: f05f926c-8544-4ea3-87aa-307088e1622a
Owner
Author
|
Opened against upstream instead: microsoft#9048 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several LinAlg exec checks only ran at shapes below the usual native tile size, and Tier 1 I8/U8 support had little or no coverage. This adds tests at native granularity and fills the I8/U8 gaps.
All new matmul cases stay capability gated. Tested on WARP built from current Direct3D main: all new cases pass except the two I32 contention cases, which skip because I32 atomic accumulate isn't advertised.
Fixes microsoft#9047