Skip to content

Make HLSL_COPY_GENERATED_SOURCES copy DxilCounters.cpp#8296

Merged
damyanp merged 3 commits intomicrosoft:mainfrom
damyanp:copilot/fix-issue-8293
Mar 28, 2026
Merged

Make HLSL_COPY_GENERATED_SOURCES copy DxilCounters.cpp#8296
damyanp merged 3 commits intomicrosoft:mainfrom
damyanp:copilot/fix-issue-8293

Conversation

@damyanp
Copy link
Copy Markdown
Member

@damyanp damyanp commented Mar 26, 2026

DxilCounters.cpp wasn't getting updated when HLSL_COPY_GENERATED_SOURCES was set. This change fixes that, and includes the updated DxilCounters.cpp.

add_hlsl_hctgen now adds the file extension to the target it creates, which allows us to generate both DxilCounters.h and DxilCounters.cpp.

Copilot AI and others added 2 commits March 25, 2026 22:22
- 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
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
@damyanp damyanp marked this pull request as ready for review March 26, 2026 00:21
@damyanp damyanp requested a review from Copilot March 26, 2026 00:21
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the HCT-generated source workflow so DxilCounters.cpp is treated as a generated CODE_TAG source and gets updated/copied when HLSL_COPY_GENERATED_SOURCES is enabled, and adjusts HCT target naming to support generating multiple outputs for the same mode (e.g., both .h and .cpp).

Changes:

  • Add DxilCounters.cpp to the add_hlsl_hctgen CODE_TAG generation list for lib/DXIL.
  • Change add_hlsl_hctgen to create per-output targets named by file extension (e.g., DxilIntrinsicTables_h) to avoid target-name collisions.
  • Update the checked-in generated DxilCounters.cpp opcode-counter predicates to match the latest generated output.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tools/clang/lib/Sema/CMakeLists.txt Updates the dependency target name to match new HCT per-extension target naming (DxilIntrinsicTables_h).
lib/DXIL/DxilCounters.cpp Brings the checked-in generated counters in sync with updated opcode classifications.
lib/DXIL/CMakeLists.txt Adds HCT generation/copy support for DxilCounters.cpp as a CODE_TAG output.
cmake/modules/HCT.cmake Changes HCT custom target naming to include the output extension, enabling multiple outputs per mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@damyanp damyanp enabled auto-merge (squash) March 27, 2026 22:30
@damyanp damyanp merged commit 745a694 into microsoft:main Mar 28, 2026
12 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Mar 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants