[all-commits] [llvm/llvm-project] 46167f: Add spirv-val compilation step when targeting SPIR...

Joshua Batista via All-commits all-commits at lists.llvm.org
Mon Apr 13 14:58:17 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 46167f96bd2c5999297591ef362f3b7f051fd757
      https://github.com/llvm/llvm-project/commit/46167f96bd2c5999297591ef362f3b7f051fd757
  Author: Joshua Batista <jbatista at microsoft.com>
  Date:   2026-04-13 (Mon, 13 Apr 2026)

  Changed paths:
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Options/Options.td
    M clang/lib/Driver/Driver.cpp
    M clang/lib/Driver/ToolChains/HLSL.cpp
    M clang/lib/Driver/ToolChains/HLSL.h
    A clang/test/Driver/dxc_spirv-val_missing.hlsl
    A clang/test/Driver/dxc_spirv-val_path.hlsl
    M clang/test/lit.cfg.py

  Log Message:
  -----------
  Add spirv-val compilation step when targeting SPIR-V (#188150)

Clang-dxc.exe currently uses dxv by default after compiling HLSL that
targets DXIL, assuming dxv can be found. However, there is no
counterpart for SPIR-V. This PR changes clang-dxc.exe so that the DXC
driver inserts a step to run spirv-val when SPIR-V is the target. It
also accounts for whether or not the -Fo option is passed. In all cases,
spirv-val will be run, as long as the target is SPIR-V and the spirv-val
executable can be found on the PATH.

This PR also adds a new option --spirv-val-path, a counterpart to
--dxv-path, for specifying an explicit path to spirv-val.

Key differences from dxv: Unlike dxv, which validates and signs DXIL
containers and produces an output file, spirv-val is a pure validator —
it checks the SPIR-V binary and exits with a status code without
producing output. Because of this, the compile step writes directly to
-Fo and spirv-val validates the file in-place.

Additional fixes:

- Fixes a duplicate "validator not found" warning that was emitted twice
per invocation — once from BuildActions and once from isLastJob (via
GetNamedOutputPath). This was a pre-existing bug introduced by #130436
(https://github.com/llvm/llvm-project/pull/130436). Fixed by
adding a Diagnose parameter to requiresValidation so only one call site
emits the diagnostic.
- Fixes an "unused argument" warning for -Vd when targeting SPIR-V,
caused by early returns in requiresValidation before the argument was
claimed.
- Adds a new SPIRVValidation diagnostic group and
warn_drv_dxc_missing_spirv_val diagnostic for the missing spirv-val
warning.

Fixes https://github.com/llvm/llvm-project/issues/142669

Assisted by: Claude Opus 4.6



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list