CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
123 lines
4.4 KiB
C++
123 lines
4.4 KiB
C++
//===--- HLSL.h - HLSL ToolChain Implementations ----------------*- C++ -*-===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HLSL_H
|
|
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HLSL_H
|
|
|
|
#include "clang/Driver/Tool.h"
|
|
#include "clang/Driver/ToolChain.h"
|
|
|
|
namespace clang {
|
|
namespace driver {
|
|
|
|
namespace tools {
|
|
|
|
namespace hlsl {
|
|
class LLVM_LIBRARY_VISIBILITY Validator : public Tool {
|
|
public:
|
|
Validator(const ToolChain &TC)
|
|
: Tool("hlsl::Validator", TC.getTriple().isSPIRV() ? "spirv-val" : "dxv",
|
|
TC) {}
|
|
|
|
bool hasIntegratedCPP() const override { return false; }
|
|
|
|
void ConstructJob(Compilation &C, const JobAction &JA,
|
|
const InputInfo &Output, const InputInfoList &Inputs,
|
|
const llvm::opt::ArgList &TCArgs,
|
|
const char *LinkingOutput) const override;
|
|
};
|
|
|
|
class LLVM_LIBRARY_VISIBILITY MetalConverter : public Tool {
|
|
public:
|
|
MetalConverter(const ToolChain &TC)
|
|
: Tool("hlsl::MetalConverter", "metal-shaderconverter", TC) {}
|
|
|
|
bool hasIntegratedCPP() const override { return false; }
|
|
|
|
void ConstructJob(Compilation &C, const JobAction &JA,
|
|
const InputInfo &Output, const InputInfoList &Inputs,
|
|
const llvm::opt::ArgList &TCArgs,
|
|
const char *LinkingOutput) const override;
|
|
};
|
|
|
|
class LLVM_LIBRARY_VISIBILITY LLVMObjcopy : public Tool {
|
|
public:
|
|
LLVMObjcopy(const ToolChain &TC)
|
|
: Tool("hlsl::LLVMObjcopy", "llvm-objcopy", TC) {}
|
|
|
|
bool hasIntegratedCPP() const override { return false; }
|
|
|
|
void ConstructJob(Compilation &C, const JobAction &JA,
|
|
const InputInfo &Output, const InputInfoList &Inputs,
|
|
const llvm::opt::ArgList &TCArgs,
|
|
const char *LinkingOutput) const override;
|
|
};
|
|
|
|
} // namespace hlsl
|
|
} // namespace tools
|
|
|
|
namespace toolchains {
|
|
|
|
class LLVM_LIBRARY_VISIBILITY HLSLToolChain : public ToolChain {
|
|
public:
|
|
HLSLToolChain(const Driver &D, const llvm::Triple &Triple,
|
|
const llvm::opt::ArgList &Args);
|
|
Tool *getTool(Action::ActionClass AC) const override;
|
|
|
|
bool isPICDefault() const override { return false; }
|
|
bool isPIEDefault(const llvm::opt::ArgList &Args) const override {
|
|
return false;
|
|
}
|
|
bool isPICDefaultForced() const override { return false; }
|
|
|
|
llvm::opt::DerivedArgList *
|
|
TranslateArgs(const llvm::opt::DerivedArgList &Args, StringRef BoundArch,
|
|
Action::OffloadKind DeviceOffloadKind) const override;
|
|
static std::optional<std::string> parseTargetProfile(StringRef TargetProfile);
|
|
|
|
struct ValidationInfo {
|
|
bool NeedsValidation = false;
|
|
bool ProducesOutput = false;
|
|
};
|
|
|
|
/// Returns information about whether validation is required and whether the
|
|
/// validator produces output. When Diagnose is true, emits a warning if the
|
|
/// required validator executable cannot be found.
|
|
ValidationInfo getValidationInfo(llvm::opt::DerivedArgList &Args,
|
|
bool Diagnose = true) const;
|
|
bool requiresBinaryTranslation(llvm::opt::DerivedArgList &Args) const;
|
|
bool requiresObjcopy(llvm::opt::DerivedArgList &Args) const;
|
|
|
|
/// Determines whether the given action class is the last job that produces
|
|
/// an output file. This is used to decide whether to write to the -Fo
|
|
/// output path or to a temporary file.
|
|
///
|
|
/// For example, spirv-val is a pure validator that runs after the compile
|
|
/// step but doesn't produce output, so the compile step is the last
|
|
/// output-producing job. For DXIL, dxv validates and signs, producing the
|
|
/// final output.
|
|
bool isLastOutputProducingJob(llvm::opt::DerivedArgList &Args,
|
|
Action::ActionClass AC) const;
|
|
|
|
// Set default DWARF version to 4 for DXIL uses version 4.
|
|
unsigned GetDefaultDwarfVersion() const override { return 4; }
|
|
|
|
void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const override;
|
|
|
|
private:
|
|
mutable std::unique_ptr<tools::hlsl::Validator> Validator;
|
|
mutable std::unique_ptr<tools::hlsl::MetalConverter> MetalConverter;
|
|
mutable std::unique_ptr<tools::hlsl::LLVMObjcopy> LLVMObjcopy;
|
|
};
|
|
|
|
} // end namespace toolchains
|
|
} // end namespace driver
|
|
} // end namespace clang
|
|
|
|
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_HLSL_H
|