Register DxilCounters.cpp with hctgen and regenerate#10
Register DxilCounters.cpp with hctgen and regenerate#10
Conversation
- Add TARGET_NAME optional parameter to add_hlsl_hctgen() in HCT.cmake to allow different CMake target name and hctgen mode (needed since DxilCounters is already used as the target name for DxilCounters.h) - Add add_hlsl_hctgen(DxilCounters OUTPUT DxilCounters.cpp CODE_TAG ...) to lib/DXIL/CMakeLists.txt so DxilCounters.cpp participates in source regeneration when HLSL_COPY_GENERATED_SOURCES is set - Regenerate DxilCounters.cpp: adds BarrierByMemoryType/Handle/Node, FDot, VectorReduceAnd/Or, SampleCmpGrad/Bias, RawBufferVectorLoad/Store Co-authored-by: damyanp <8118402+damyanp@users.noreply.github.com> Agent-Logs-Url: https://github.com/damyanp/DirectXShaderCompiler/sessions/12071741-931b-464e-90a5-ce03c9b6e9c3
| # This file is distributed under the University of Illinois Open Source License. | ||
| # See LICENSE.TXT for details. | ||
|
|
||
| add_hlsl_hctgen(DxilCounters OUTPUT DxilCounters.cpp CODE_TAG TARGET_NAME DxilCountersCpp) |
There was a problem hiding this comment.
@copilot what is special about DxilCounters.cpp that means it needs a special TARGET_NAME parameter? None of the ones below seem to need this.
There was a problem hiding this comment.
The first argument to add_hlsl_hctgen serves double duty: it's both the hctgen generation mode (passed directly to hctgen.py) and the CMake target name. DxilCounters is the only hctgen mode that generates two separate files — DxilCounters.h (in include/dxc/DXIL/CMakeLists.txt) and DxilCounters.cpp (in lib/DXIL/CMakeLists.txt). Since both calls must pass DxilCounters as the mode, but CMake target names must be unique, one of them needs a different target name.
I tried renaming the mode to DxilCountersH for the .h side, but that breaks hctgen.py which only accepts fixed mode names. TARGET_NAME is the minimal way to decouple the CMake target name from the hctgen mode.
There was a problem hiding this comment.
@copilot I'm convinced that this is truly a special case. Is the target name actually important and relied upon anywhere? If not, then how about the output file extension is always added to the target name?
There was a problem hiding this comment.
The target names were not relied upon by name externally, with one exception: DxilIntrinsicTables in tools/clang/lib/Sema/CMakeLists.txt.
Implemented your suggestion in ddcbecf: the TARGET_NAME parameter is removed and the target name is now always auto-derived as ${mode}_${extension} (e.g. DxilCounters_h, DxilCounters_cpp). Updated the one external reference accordingly (DxilIntrinsicTables → DxilIntrinsicTables_h).
Instead of a special-purpose TARGET_NAME parameter, the CMake target name
is now automatically derived as "${mode}_${extension}" (e.g. DxilCounters_h,
DxilCounters_cpp). This resolves the DxilCounters name conflict between the
.h and .cpp targets without any caller-visible special-casing.
Update the one external reference (DxilIntrinsicTables →
DxilIntrinsicTables_h) in tools/clang/lib/Sema/CMakeLists.txt.
Co-authored-by: damyanp <8118402+damyanp@users.noreply.github.com>
Agent-Logs-Url: https://github.com/damyanp/DirectXShaderCompiler/sessions/9de1b168-12bd-407d-b2e7-e83f2480dc9d
This commit fixes 2 warnings showing on when building on MacOS: - CMP0135: setting which policy is applied on download freshness check - METAL_IRCONVERTER case not matching the FindPackage filename.
) Update `DxilStructAnnotation` to be aware of target types. Otherwise the annotation would declare a struct with a single LinAlg Matrix type as empty, leading to invalid codegen. Declaration names match the style of the surrounding code. Fixes microsoft#8279
Addresses outstanding cleanup requests from the initial LinAlg exec test PR --------- Co-authored-by: Damyan Pepper <damyanp@microsoft.com>
Updates the SPIR-V dependencies, and update an invalid test.
The experimental Cooperative Vector feature has been superseded by LinAlg. This change removes the code supporting the old feature. Fixes microsoft#8147 --------- Co-authored-by: Helena Kotas <hekotas@microsoft.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: damyanp <8118402+damyanp@users.noreply.github.com>
…unction overloads. (microsoft#8287) Part of microsoft#7979 Restructured to test each function overloads.
lib/DXIL/DxilCounters.cppcontains<py>code tags driven by the DXIL instruction database, but was never registered withadd_hlsl_hctgen(). As a result it was never regenerated whenHLSL_COPY_GENERATED_SOURCESwas set, causing it to silently drift out of sync as new opcodes were added.Changes
cmake/modules/HCT.cmake—add_hlsl_hctgen()now automatically derives the CMake target name as${mode}_${extension}(e.g.DxilCounters_h,DxilCounters_cpp). This ensures target names are unique even when the same hctgen mode generates both a.hand a.cppfile, without requiring any caller-visible special-casing. The one existing external reference to a target by name (DxilIntrinsicTables) is updated toDxilIntrinsicTables_hintools/clang/lib/Sema/CMakeLists.txt.lib/DXIL/CMakeLists.txt— RegistersDxilCounters.cppwith the codegen pipeline:lib/DXIL/DxilCounters.cpp— Regenerated. Previously-missing opcodes now covered:barrierBarrierByMemoryType,BarrierByMemoryHandle,BarrierByNodeRecordHandlefloatsFDotints/uintsVectorReduceAnd,VectorReduceOrtex_cmpSampleCmpGrad,SampleCmpBiastex_loadRawBufferVectorLoadtex_storeRawBufferVectorStore⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.